Merge to Fedora Core 2 kernel-2.6.8-1.521
authorMark Huang <mlhuang@cs.princeton.edu>
Thu, 16 Sep 2004 18:16:15 +0000 (18:16 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Thu, 16 Sep 2004 18:16:15 +0000 (18:16 +0000)
1095 files changed:
Documentation/devices.txt
Documentation/filesystems/proc.txt
Documentation/laptop-mode.txt
Documentation/power/swsusp.txt
Documentation/scsi/scsi_mid_low_api.txt
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
Documentation/sysctl/vm.txt
MAINTAINERS
Makefile
arch/alpha/defconfig
arch/alpha/kernel/srm_env.c
arch/alpha/kernel/systbls.S
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/boot/bootp/Makefile
arch/arm/boot/bootp/init.S
arch/arm/boot/compressed/Makefile
arch/arm/kernel/entry-armv.S
arch/arm/kernel/ptrace.c
arch/arm/kernel/signal.c
arch/arm/kernel/sys_arm.c
arch/arm/kernel/traps.c
arch/arm/mach-lh7a40x/Makefile
arch/arm/mach-lh7a40x/arch-lpd7a40x.c
arch/arm/mach-lh7a40x/fiq.S [deleted file]
arch/arm/mach-lh7a40x/ide-lpd7a40x.c [deleted file]
arch/arm/mach-s3c2410/Kconfig
arch/arm/mach-s3c2410/Makefile
arch/arm/mach-s3c2410/mach-h1940.c
arch/arm/mach-s3c2410/mach-vr1000.c
arch/arm/mach-s3c2410/s3c2410.h
arch/arm/mm/blockops.c
arch/arm/mm/init.c
arch/cris/arch-v10/defconfig
arch/cris/defconfig
arch/i386/Makefile
arch/i386/boot98/compressed/Makefile [deleted file]
arch/i386/boot98/compressed/head.S [deleted file]
arch/i386/boot98/compressed/misc.c [deleted file]
arch/i386/boot98/compressed/vmlinux.scr [deleted file]
arch/i386/boot98/tools/build.c [deleted file]
arch/i386/kernel/entry.S
arch/i386/kernel/io_apic.c
arch/i386/kernel/irq.c
arch/i386/kernel/process.c
arch/i386/kernel/signal.c
arch/i386/kernel/sys_i386.c
arch/i386/kernel/sysenter.c
arch/i386/kernel/traps.c
arch/i386/mach-generic/bigsmp.c
arch/i386/mm/Makefile
arch/i386/mm/discontig.c
arch/i386/mm/init.c
arch/i386/pci/irq.c
arch/ia64/Kconfig
arch/ia64/Makefile
arch/ia64/configs/sn2_defconfig
arch/ia64/defconfig
arch/ia64/ia32/binfmt_elf32.c
arch/ia64/ia32/ia32_entry.S
arch/ia64/kernel/acpi.c
arch/ia64/kernel/entry.S
arch/ia64/kernel/ia64_ksyms.c
arch/ia64/kernel/irq.c
arch/ia64/kernel/mca.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/process.c
arch/ia64/kernel/setup.c
arch/ia64/kernel/smpboot.c
arch/ia64/mm/init.c
arch/ia64/sn/io/platform_init/sgi_io_init.c
arch/ia64/sn/io/sn2/bte_error.c
arch/ia64/sn/kernel/bte.c
arch/ia64/sn/kernel/irq.c
arch/m68k/defconfig
arch/m68k/ifpsp060/iskeleton.S
arch/m68k/kernel/setup.c
arch/m68k/kernel/signal.c
arch/m68k/kernel/traps.c
arch/m68k/mac/macints.c
arch/m68k/mm/memory.c
arch/m68k/mvme147/config.c
arch/m68k/q40/config.c
arch/mips/configs/atlas_defconfig
arch/mips/configs/bosporus_defconfig
arch/mips/configs/capcella_defconfig
arch/mips/configs/cobalt_defconfig
arch/mips/configs/db1000_defconfig
arch/mips/configs/db1100_defconfig
arch/mips/configs/db1500_defconfig
arch/mips/configs/ddb5476_defconfig
arch/mips/configs/ddb5477_defconfig
arch/mips/configs/decstation_defconfig
arch/mips/configs/e55_defconfig
arch/mips/configs/ev64120_defconfig
arch/mips/configs/ev96100_defconfig
arch/mips/configs/ip22_defconfig
arch/mips/configs/ip27_defconfig
arch/mips/configs/ip32_defconfig
arch/mips/configs/it8172_defconfig
arch/mips/configs/ivr_defconfig
arch/mips/configs/jmr3927_defconfig
arch/mips/configs/lasat200_defconfig
arch/mips/configs/malta_defconfig
arch/mips/configs/mirage_defconfig
arch/mips/configs/mpc30x_defconfig
arch/mips/configs/mtx1_defconfig
arch/mips/configs/ocelot_c_defconfig
arch/mips/configs/ocelot_defconfig
arch/mips/configs/osprey_defconfig
arch/mips/configs/pb1000_defconfig
arch/mips/configs/pb1100_defconfig
arch/mips/configs/pb1500_defconfig
arch/mips/configs/pb1550_defconfig
arch/mips/configs/rm200_defconfig
arch/mips/configs/sb1250-swarm_defconfig
arch/mips/configs/tb0226_defconfig
arch/mips/configs/tb0229_defconfig
arch/mips/configs/workpad_defconfig
arch/mips/configs/xxs1500_defconfig
arch/mips/defconfig
arch/mips/kernel/linux32.c
arch/parisc/Kconfig
arch/parisc/configs/a500_defconfig
arch/parisc/configs/b180_defconfig
arch/parisc/configs/c3000_defconfig
arch/parisc/kernel/cache.c
arch/parisc/kernel/entry.S
arch/parisc/kernel/firmware.c
arch/parisc/kernel/hardware.c
arch/parisc/kernel/head.S
arch/parisc/kernel/head64.S
arch/parisc/kernel/irq.c
arch/parisc/kernel/pci-dma.c
arch/parisc/kernel/process.c
arch/parisc/kernel/processor.c
arch/parisc/kernel/real2.S
arch/parisc/kernel/setup.c
arch/parisc/kernel/smp.c
arch/parisc/kernel/sys_parisc32.c
arch/parisc/kernel/traps.c
arch/parisc/lib/bitops.c
arch/parisc/mm/init.c
arch/ppc/8260_io/enet.c
arch/ppc/8xx_io/commproc.c
arch/ppc/8xx_io/cs4218_tdm.c
arch/ppc/8xx_io/enet.c
arch/ppc/8xx_io/uart.c
arch/ppc/Kconfig
arch/ppc/Makefile
arch/ppc/boot/common/misc-common.c
arch/ppc/boot/simple/Makefile
arch/ppc/boot/simple/embed_config.c
arch/ppc/boot/simple/gt64260_tty.c [new file with mode: 0644]
arch/ppc/boot/simple/head.S
arch/ppc/boot/simple/m8260_tty.c
arch/ppc/boot/simple/misc-ev64260.S
arch/ppc/boot/simple/misc-mv64x60.S [deleted file]
arch/ppc/boot/simple/misc.c
arch/ppc/boot/simple/mv64x60_stub.c [deleted file]
arch/ppc/boot/simple/mv64x60_tty.c [deleted file]
arch/ppc/configs/ash_defconfig
arch/ppc/configs/common_defconfig
arch/ppc/configs/cpci405_defconfig
arch/ppc/configs/ebony_defconfig
arch/ppc/configs/ep405_defconfig
arch/ppc/configs/ev64260_defconfig
arch/ppc/configs/ibmchrp_defconfig
arch/ppc/configs/lopec_defconfig
arch/ppc/configs/ocotea_defconfig
arch/ppc/configs/pmac_defconfig
arch/ppc/configs/power3_defconfig
arch/ppc/configs/redwood5_defconfig
arch/ppc/configs/redwood6_defconfig
arch/ppc/configs/sandpoint_defconfig
arch/ppc/configs/spruce_defconfig
arch/ppc/configs/sycamore_defconfig
arch/ppc/configs/walnut_defconfig
arch/ppc/defconfig
arch/ppc/kernel/Makefile
arch/ppc/kernel/cputable.c
arch/ppc/kernel/head.S
arch/ppc/kernel/head_44x.S
arch/ppc/kernel/irq.c
arch/ppc/kernel/pci-dma.c [deleted file]
arch/ppc/kernel/ppc-stub.c
arch/ppc/kernel/process.c
arch/ppc/kernel/ptrace.c
arch/ppc/kernel/setup.c
arch/ppc/kernel/signal.c
arch/ppc/kernel/syscalls.c
arch/ppc/kernel/traps.c
arch/ppc/mm/Makefile
arch/ppc/mm/fault.c
arch/ppc/platforms/4xx/Kconfig
arch/ppc/platforms/4xx/ebony.h
arch/ppc/platforms/Makefile
arch/ppc/platforms/dmv182.c [deleted file]
arch/ppc/platforms/dmv182.h [deleted file]
arch/ppc/platforms/dmv182_serial.h [deleted file]
arch/ppc/platforms/error_log.c [deleted file]
arch/ppc/platforms/error_log.h [deleted file]
arch/ppc/platforms/ev64260.c [deleted file]
arch/ppc/platforms/ev64260.h
arch/ppc/platforms/ev64260_setup.c [new file with mode: 0644]
arch/ppc/platforms/pmac_cpufreq.c
arch/ppc/platforms/pmac_pic.c
arch/ppc/platforms/prep_setup.c
arch/ppc/platforms/proc_rtas.c [deleted file]
arch/ppc/platforms/rpxsuper.h [deleted file]
arch/ppc/syslib/Makefile
arch/ppc/syslib/gt64260_pic.c
arch/ppc/syslib/mv64360_pic.c [deleted file]
arch/ppc/syslib/mv64x60.c [deleted file]
arch/ppc/syslib/mv64x60_ocp.c [deleted file]
arch/ppc/syslib/open_pic.c
arch/ppc/syslib/prom_init.c
arch/ppc64/Kconfig
arch/ppc64/configs/iSeries_defconfig
arch/ppc64/kernel/Makefile
arch/ppc64/kernel/asm-offsets.c
arch/ppc64/kernel/chrp_setup.c
arch/ppc64/kernel/eeh.c
arch/ppc64/kernel/entry.S
arch/ppc64/kernel/head.S
arch/ppc64/kernel/irq.c
arch/ppc64/kernel/misc.S
arch/ppc64/kernel/open_pic.c
arch/ppc64/kernel/pSeries_pci.c
arch/ppc64/kernel/pacaData.c
arch/ppc64/kernel/pci.h
arch/ppc64/kernel/prom.c
arch/ppc64/kernel/ptrace32.c
arch/ppc64/kernel/ras.c
arch/ppc64/kernel/rtas-proc.c
arch/ppc64/kernel/rtas.c
arch/ppc64/kernel/rtasd.c
arch/ppc64/kernel/rtc.c
arch/ppc64/kernel/smp.c
arch/ppc64/kernel/stab.c
arch/ppc64/kernel/sysfs.c
arch/ppc64/kernel/vio.c
arch/ppc64/kernel/xics.c
arch/ppc64/mm/Makefile
arch/ppc64/mm/fault.c
arch/ppc64/mm/hash_utils.c
arch/ppc64/mm/init.c
arch/ppc64/mm/numa.c
arch/s390/Kconfig
arch/s390/appldata/appldata_base.c
arch/s390/defconfig
arch/s390/kernel/compat_signal.c
arch/s390/kernel/entry.S
arch/s390/kernel/entry64.S
arch/s390/kernel/ptrace.c
arch/s390/mm/Makefile
arch/s390/mm/cmm.c
arch/sparc/Kconfig
arch/sparc/defconfig
arch/sparc/kernel/smp.c
arch/sparc/kernel/sun4m_smp.c
arch/sparc/kernel/sys_sparc.c
arch/sparc64/Kconfig
arch/sparc64/defconfig
arch/sparc64/kernel/binfmt_aout32.c
arch/sparc64/kernel/entry.S
arch/sparc64/kernel/head.S
arch/sparc64/kernel/ioctl32.c
arch/sparc64/kernel/process.c
arch/sparc64/kernel/sbus.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/sys_sparc.c
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/kernel/systbls.S
arch/sparc64/kernel/time.c
arch/sparc64/lib/Makefile
arch/sparc64/lib/blockops.S [deleted file]
arch/sparc64/mm/fault.c
arch/sparc64/mm/init.c
arch/um/config.release
arch/um/defconfig
arch/um/drivers/harddog_kern.c
arch/x86_64/defconfig
arch/x86_64/ia32/sys_ia32.c
arch/x86_64/kernel/i8259.c
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/mpparse.c
arch/x86_64/kernel/pci-gart.c
arch/x86_64/kernel/signal.c
arch/x86_64/kernel/smpboot.c
arch/x86_64/mm/Makefile
arch/x86_64/mm/init.c
configs/kernel-2.6.7-i586-smp.config [deleted file]
configs/kernel-2.6.7-i586.config [deleted file]
configs/kernel-2.6.7-i686-smp.config [deleted file]
configs/kernel-2.6.7-i686.config [deleted file]
crypto/Kconfig
crypto/Makefile
crypto/cipher.c
crypto/tcrypt.c
crypto/tcrypt.h
drivers/acpi/system.c
drivers/atm/firestream.c
drivers/atm/fore200e.c
drivers/base/Kconfig
drivers/block/Kconfig
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/ll_rw_blk.c
drivers/block/paride/pcd.c
drivers/block/scsi_ioctl.c
drivers/block/swim3.c
drivers/bluetooth/bt3c_cs.c
drivers/bluetooth/hci_bcsp.c
drivers/bluetooth/hci_usb.c
drivers/cdrom/aztcd.c
drivers/cdrom/cdrom.c
drivers/cdrom/mcdx.c
drivers/cdrom/viocd.c
drivers/char/Kconfig
drivers/char/Makefile
drivers/char/agp/Kconfig
drivers/char/agp/amd64-agp.c
drivers/char/agp/intel-agp.c
drivers/char/agp/sis-agp.c
drivers/char/agp/via-agp.c
drivers/char/drm/drm.h
drivers/char/drm/drmP.h
drivers/char/drm/drm_agpsupport.h
drivers/char/drm/drm_bufs.h
drivers/char/drm/drm_context.h
drivers/char/drm/drm_dma.h
drivers/char/drm/drm_drv.h
drivers/char/drm/drm_fops.h
drivers/char/drm/drm_ioctl.h
drivers/char/drm/drm_vm.h
drivers/char/drm/ffb_drv.c
drivers/char/drm/gamma_dma.c
drivers/char/drm/i810_dma.c
drivers/char/drm/i830_dma.c
drivers/char/drm/i830_irq.c
drivers/char/drm/mga_dma.c
drivers/char/drm/mga_drm.h
drivers/char/drm/r128_cce.c
drivers/char/drm/r128_drm.h
drivers/char/drm/r128_state.c
drivers/char/drm/radeon_cp.c
drivers/char/drm/radeon_drm.h
drivers/char/drm/radeon_drv.h
drivers/char/drm/radeon_irq.c
drivers/char/drm/radeon_mem.c
drivers/char/drm/radeon_state.c
drivers/char/drm/sis_mm.c
drivers/char/dtlk.c
drivers/char/esp.c
drivers/char/ftape/lowlevel/ftape-init.c
drivers/char/genrtc.c
drivers/char/ip2main.c
drivers/char/ipmi/ipmi_devintf.c
drivers/char/ipmi/ipmi_msghandler.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/ipmi/ipmi_watchdog.c
drivers/char/istallion.c
drivers/char/mem.c
drivers/char/mwave/mwavedd.c
drivers/char/mwave/tp3780i.c
drivers/char/mxser.c
drivers/char/n_hdlc.c
drivers/char/n_tty.c
drivers/char/pcmcia/synclink_cs.c
drivers/char/random.c
drivers/char/sn_serial.c [deleted file]
drivers/char/sonypi.h
drivers/char/stallion.c
drivers/char/synclinkmp.c
drivers/char/tipar.c
drivers/char/tty_io.c
drivers/char/vt.c
drivers/char/vt_ioctl.c
drivers/char/watchdog/Kconfig
drivers/char/watchdog/Makefile
drivers/char/watchdog/acquirewdt.c
drivers/char/watchdog/advantechwdt.c
drivers/char/watchdog/alim1535_wdt.c
drivers/char/watchdog/alim7101_wdt.c
drivers/char/watchdog/eurotechwdt.c
drivers/char/watchdog/i8xx_tco.c
drivers/char/watchdog/ib700wdt.c
drivers/char/watchdog/indydog.c
drivers/char/watchdog/machzwd.c
drivers/char/watchdog/mixcomwd.c
drivers/char/watchdog/pcwd_pci.c
drivers/char/watchdog/pcwd_usb.c
drivers/char/watchdog/sa1100_wdt.c
drivers/char/watchdog/sbc60xxwdt.c
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc520_wdt.c
drivers/char/watchdog/scx200_wdt.c
drivers/char/watchdog/shwdt.c
drivers/char/watchdog/softdog.c
drivers/char/watchdog/w83627hf_wdt.c
drivers/char/watchdog/w83877f_wdt.c
drivers/char/watchdog/wafer5823wdt.c
drivers/char/watchdog/wdt.c
drivers/char/watchdog/wdt_pci.c
drivers/cpufreq/cpufreq_userspace.c
drivers/i2c/busses/i2c-rpx.c
drivers/i2c/chips/Kconfig
drivers/ide/Kconfig
drivers/ide/ide-cd.c
drivers/ide/ide-disk.c
drivers/ide/ide-tape.c
drivers/ide/ide.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/hpt366.h
drivers/ieee1394/dv1394.c
drivers/ieee1394/eth1394.c
drivers/ieee1394/raw1394.c
drivers/ieee1394/video1394.c
drivers/input/joystick/analog.c
drivers/isdn/capi/capi.c
drivers/isdn/hardware/eicon/divamnt.c
drivers/isdn/hardware/eicon/divasproc.c
drivers/isdn/hisax/Kconfig
drivers/isdn/hisax/config.c
drivers/isdn/hisax/diva.c
drivers/isdn/hisax/netjet.c
drivers/isdn/hisax/st5481_d.c
drivers/isdn/hisax/tei.c
drivers/isdn/i4l/isdn_common.c
drivers/isdn/i4l/isdn_net.c
drivers/isdn/i4l/isdn_x25iface.c
drivers/isdn/tpam/tpam_memory.c
drivers/macintosh/Kconfig
drivers/macintosh/adb.c
drivers/macintosh/therm_pm72.c
drivers/md/multipath.c
drivers/md/raid5.c
drivers/md/raid6main.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/dvb/dvb-core/dvb_functions.c
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/frontends/tda1004x.c
drivers/media/radio/miropcm20-radio.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/zoran_procfs.c
drivers/mtd/Kconfig
drivers/mtd/Makefile
drivers/mtd/chips/Kconfig
drivers/mtd/chips/amd_flash.c
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c
drivers/mtd/chips/jedec.c
drivers/mtd/chips/map_ram.c
drivers/mtd/chips/sharp.c
drivers/mtd/devices/Kconfig
drivers/mtd/devices/blkmtd.c
drivers/mtd/devices/doc2000.c
drivers/mtd/devices/doc2001.c
drivers/mtd/devices/doc2001plus.c
drivers/mtd/devices/lart.c
drivers/mtd/devices/ms02-nv.c
drivers/mtd/devices/pmc551.c
drivers/mtd/ftl.c
drivers/mtd/inftlcore.c
drivers/mtd/inftlmount.c
drivers/mtd/maps/Kconfig
drivers/mtd/maps/physmap.c
drivers/mtd/mtdchar.c
drivers/mtd/mtdcore.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/Kconfig
drivers/mtd/nand/autcpu12.c
drivers/mtd/redboot.c
drivers/net/82596.c
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/acenic.c
drivers/net/cs89x0.c
drivers/net/dummy.c
drivers/net/e1000/e1000.h
drivers/net/eepro100.c
drivers/net/epic100.c
drivers/net/eql.c
drivers/net/gianfar.c [deleted file]
drivers/net/gianfar.h [deleted file]
drivers/net/gianfar_ethtool.c [deleted file]
drivers/net/gianfar_phy.c [deleted file]
drivers/net/gianfar_phy.h [deleted file]
drivers/net/hamachi.c
drivers/net/hp-plus.c
drivers/net/irda/Kconfig
drivers/net/ixgb/ixgb_hw.c
drivers/net/ixgb/ixgb_osdep.h
drivers/net/lance.c
drivers/net/lasi_82596.c
drivers/net/lp486e.c
drivers/net/ne.c
drivers/net/ne2.c
drivers/net/ns83820.c
drivers/net/pcmcia/axnet_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/ppp_async.c
drivers/net/ppp_generic.c
drivers/net/ppp_synctty.c
drivers/net/pppoe.c
drivers/net/sb1000.c
drivers/net/sis900.c
drivers/net/skfp/fplustm.c
drivers/net/skfp/hwmtm.c
drivers/net/skfp/pmf.c
drivers/net/skfp/smt.c
drivers/net/skfp/smtdef.c
drivers/net/skfp/smtparse.c
drivers/net/skfp/smttimer.c
drivers/net/skfp/srf.c
drivers/net/sundance.c
drivers/net/sungem.c
drivers/net/tg3.c
drivers/net/tlan.c
drivers/net/tokenring/Kconfig
drivers/net/tulip/tulip_core.c
drivers/net/via-rhine.c
drivers/net/wan/sbni.c
drivers/net/wireless/airo.c
drivers/net/wireless/arlan-proc.c
drivers/net/wireless/atmel.c
drivers/net/wireless/prism54/isl_38xx.c
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/prism54/islpci_dev.c
drivers/net/wireless/prism54/islpci_hotplug.c
drivers/net/wireless/prism54/islpci_mgt.c
drivers/net/wireless/prism54/islpci_mgt.h
drivers/net/wireless/prism54/oid_mgt.c
drivers/net/yellowfin.c
drivers/oprofile/oprofilefs.c
drivers/parisc/superio.c
drivers/parport/procfs.c
drivers/pci/Kconfig
drivers/pci/msi.c
drivers/pci/quirks.c
drivers/pcmcia/sa1100_generic.c
drivers/pnp/pnpbios/bioscalls.c
drivers/s390/cio/chsc.c
drivers/s390/cio/device_fsm.c
drivers/s390/cio/device_ops.c
drivers/s390/cio/device_status.c
drivers/s390/cio/qdio.c
drivers/s390/cio/qdio.h
drivers/s390/net/ctcmain.c
drivers/s390/net/ctctty.c
drivers/s390/net/iucv.c
drivers/s390/net/lcs.c
drivers/s390/net/netiucv.c
drivers/s390/net/qeth.h
drivers/s390/net/qeth_fs.h
drivers/s390/net/qeth_main.c
drivers/s390/net/qeth_sys.c
drivers/s390/scsi/zfcp_aux.c
drivers/s390/scsi/zfcp_ccw.c
drivers/s390/scsi/zfcp_def.h
drivers/s390/scsi/zfcp_erp.c
drivers/s390/scsi/zfcp_fsf.c
drivers/s390/scsi/zfcp_sysfs_port.c
drivers/sbus/char/cpwatchdog.c
drivers/sbus/char/envctrl.c
drivers/sbus/char/riowatchdog.c
drivers/sbus/dvma.c
drivers/scsi/53c700.c
drivers/scsi/Kconfig
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aha152x.c
drivers/scsi/aha1542.c
drivers/scsi/aic7xxx_old.c
drivers/scsi/dpt_i2o.c
drivers/scsi/eata_pio.c
drivers/scsi/fastlane.c
drivers/scsi/fdomain.c
drivers/scsi/g_NCR5380.c
drivers/scsi/ide-scsi.c
drivers/scsi/imm.c
drivers/scsi/in2000.c
drivers/scsi/libata-core.c
drivers/scsi/ncr53c8xx.c
drivers/scsi/nsp32.c
drivers/scsi/osst.c
drivers/scsi/qla1280.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/st.c
drivers/scsi/sym53c8xx_comm.h
drivers/scsi/tmscsim.c
drivers/scsi/ultrastor.c
drivers/serial/8250_pci.c
drivers/serial/Kconfig
drivers/serial/Makefile
drivers/serial/mpsc/Makefile [deleted file]
drivers/serial/mpsc/mpsc.c [deleted file]
drivers/serial/mpsc/mpsc.h [deleted file]
drivers/serial/mpsc/mpsc_defs.h [deleted file]
drivers/serial/mpsc/mpsc_ppc32.c [deleted file]
drivers/serial/pmac_zilog.c
drivers/serial/sunsu.c
drivers/usb/class/audio.c
drivers/usb/class/usb-midi.c
drivers/usb/core/hub.c
drivers/usb/gadget/rndis.c
drivers/usb/host/uhci-debug.c
drivers/usb/media/dabusb.c
drivers/usb/media/ov511.c
drivers/usb/media/pwc-if.c
drivers/usb/misc/auerswald.c
drivers/usb/misc/legousbtower.c
drivers/usb/misc/tiglusb.c
drivers/video/Kconfig
drivers/video/aty/atyfb_base.c
drivers/video/aty/radeon_base.c
drivers/video/aty/radeon_pm.c
drivers/video/cirrusfb.c
drivers/video/console/dummycon.c
drivers/video/console/fbcon.c
drivers/video/console/mdacon.c
drivers/video/console/newport_con.c
drivers/video/console/promcon.c
drivers/video/console/sticon.c
drivers/video/console/vgacon.c
drivers/video/fbmem.c
drivers/video/matrox/matroxfb_base.h
drivers/video/radeonfb.c
drivers/video/riva/fbdev.c
drivers/video/sa1100fb.c
drivers/video/sis/sis_main.c
drivers/video/softcursor.c
drivers/video/tdfxfb.c
fs/Kconfig
fs/binfmt_aout.c
fs/binfmt_elf.c
fs/bio.c
fs/cifs/CHANGES
fs/cifs/README
fs/cifs/TODO
fs/cifs/cifsfs.c
fs/cifs/cifsfs.h
fs/cifs/cifsglob.h
fs/cifs/cifspdu.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/dir.c
fs/cifs/fcntl.c
fs/cifs/inode.c
fs/cifs/transport.c
fs/coda/sysctl.c
fs/compat_ioctl.c
fs/dcache.c
fs/devfs/base.c
fs/dnotify.c
fs/exec.c
fs/fcntl.c
fs/file_table.c
fs/fs-writeback.c
fs/hugetlbfs/inode.c
fs/jbd/transaction.c
fs/jffs2/Makefile
fs/jffs2/erase.c
fs/jffs2/gc.c
fs/jffs2/proc.c [deleted file]
fs/jffs2/super.c
fs/locks.c
fs/mpage.c
fs/namei.c
fs/namespace.c
fs/ncpfs/inode.c
fs/nfs/file.c
fs/nfs/nfs2xdr.c
fs/nfs/nfs3xdr.c
fs/nfs/nfs4xdr.c
fs/nfsd/nfs3xdr.c
fs/nfsd/nfs4state.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsxdr.c
fs/nfsd/vfs.c
fs/ntfs/compress.c
fs/ntfs/dir.c
fs/ntfs/super.c
fs/open.c
fs/partitions/check.c
fs/pipe.c
fs/proc/array.c
fs/read_write.c
include/asm-alpha/fcntl.h
include/asm-alpha/page.h
include/asm-alpha/resource.h
include/asm-alpha/uaccess.h
include/asm-arm/arch-lh7a40x/ide.h [deleted file]
include/asm-arm/cacheflush.h
include/asm-arm/ide.h
include/asm-arm/page.h
include/asm-arm/resource.h
include/asm-arm/setup.h
include/asm-arm/uaccess.h
include/asm-arm26/page.h
include/asm-arm26/resource.h
include/asm-cris/page.h
include/asm-cris/resource.h
include/asm-generic/pgtable.h
include/asm-h8300/page.h
include/asm-h8300/resource.h
include/asm-i386/elf.h
include/asm-i386/fcntl.h
include/asm-i386/io_apic.h
include/asm-i386/page.h
include/asm-i386/pgalloc.h
include/asm-i386/processor.h
include/asm-i386/resource.h
include/asm-i386/string.h
include/asm-i386/uaccess.h
include/asm-i386/unistd.h
include/asm-ia64/fcntl.h
include/asm-ia64/machvec.h
include/asm-ia64/page.h
include/asm-ia64/pgalloc.h
include/asm-ia64/pgtable.h
include/asm-ia64/processor.h
include/asm-ia64/resource.h
include/asm-ia64/sn/sn_sal.h
include/asm-ia64/unistd.h
include/asm-m68k/bitops.h
include/asm-m68k/page.h
include/asm-m68k/resource.h
include/asm-m68k/sun3_pgalloc.h
include/asm-m68knommu/page.h
include/asm-mips/page.h
include/asm-parisc/bitops.h
include/asm-parisc/cacheflush.h
include/asm-parisc/dma-mapping.h
include/asm-parisc/hardware.h
include/asm-parisc/page.h
include/asm-parisc/pdc.h
include/asm-parisc/pgalloc.h
include/asm-parisc/pgtable.h
include/asm-parisc/resource.h
include/asm-parisc/smp.h
include/asm-parisc/spinlock.h
include/asm-parisc/system.h
include/asm-parisc/unistd.h
include/asm-ppc/commproc.h
include/asm-ppc/fcntl.h
include/asm-ppc/gt64260.h [new file with mode: 0644]
include/asm-ppc/gt64260_defs.h [new file with mode: 0644]
include/asm-ppc/io.h
include/asm-ppc/irq.h
include/asm-ppc/mmu_context.h
include/asm-ppc/mpc8260.h
include/asm-ppc/mv64x60.h [deleted file]
include/asm-ppc/mv64x60_defs.h [deleted file]
include/asm-ppc/ocp_ids.h
include/asm-ppc/page.h
include/asm-ppc/ppc405_dma.h [deleted file]
include/asm-ppc/ppcboot.h
include/asm-ppc/reg.h
include/asm-ppc/resource.h
include/asm-ppc/serial.h
include/asm-ppc/uaccess.h
include/asm-ppc64/eeh.h
include/asm-ppc64/fcntl.h
include/asm-ppc64/irq.h
include/asm-ppc64/mmu.h
include/asm-ppc64/mmu_context.h
include/asm-ppc64/paca.h
include/asm-ppc64/page.h
include/asm-ppc64/processor.h
include/asm-ppc64/prom.h
include/asm-ppc64/resource.h
include/asm-ppc64/uaccess.h
include/asm-s390/fcntl.h
include/asm-s390/page.h
include/asm-s390/processor.h
include/asm-s390/resource.h
include/asm-sh/page.h
include/asm-sh/resource.h
include/asm-sparc/fcntl.h
include/asm-sparc/page.h
include/asm-sparc/pci.h
include/asm-sparc/resource.h
include/asm-sparc64/cacheflush.h
include/asm-sparc64/fcntl.h
include/asm-sparc64/page.h
include/asm-sparc64/pgalloc.h
include/asm-sparc64/pgtable.h
include/asm-sparc64/resource.h
include/asm-sparc64/siginfo.h
include/asm-sparc64/signal.h
include/asm-sparc64/spinlock.h
include/asm-sparc64/thread_info.h
include/asm-um/page.h
include/asm-v850/bitops.h
include/asm-v850/page.h
include/asm-v850/resource.h
include/asm-x86_64/compat.h
include/asm-x86_64/fcntl.h
include/asm-x86_64/mpspec.h
include/asm-x86_64/page.h
include/asm-x86_64/processor.h
include/asm-x86_64/resource.h
include/asm-x86_64/topology.h
include/asm-x86_64/uaccess.h
include/linux/acct.h
include/linux/ata.h
include/linux/bio.h
include/linux/blkdev.h
include/linux/buffer_head.h
include/linux/cdrom.h
include/linux/compat_ioctl.h
include/linux/console.h
include/linux/dcache.h
include/linux/dvb/osd.h
include/linux/dvb/video.h
include/linux/elf.h
include/linux/errno.h
include/linux/fb.h
include/linux/file.h
include/linux/fs.h
include/linux/hugetlb.h
include/linux/ide.h
include/linux/ipmi.h
include/linux/kd.h
include/linux/mm.h
include/linux/mmzone.h
include/linux/mtd/cfi.h
include/linux/mtd/mtd.h
include/linux/namei.h
include/linux/net.h
include/linux/netdevice.h
include/linux/nfsd/nfsd.h
include/linux/nfsd/xdr4.h
include/linux/pci.h
include/linux/pci_ids.h
include/linux/personality.h
include/linux/pkt_cls.h
include/linux/poll.h
include/linux/random.h
include/linux/reiserfs_fs.h
include/linux/rtnetlink.h
include/linux/sched.h
include/linux/serial_core.h
include/linux/shm.h
include/linux/skbuff.h
include/linux/socket.h
include/linux/swap.h
include/linux/sysctl.h
include/linux/tcp.h
include/linux/vt_kern.h
include/linux/writeback.h
include/net/addrconf.h
include/net/bluetooth/hci.h
include/net/ip.h
include/net/ip6_route.h
include/net/ipv6.h
include/net/pkt_sched.h
include/net/snmp.h
include/net/sock.h
include/net/tcp.h
include/net/tux.h [new file with mode: 0644]
include/net/tux_u.h [new file with mode: 0644]
include/net/xfrm.h
include/scsi/scsi.h
include/scsi/scsi_host.h
include/scsi/sg.h
include/sound/asound.h
init/Kconfig
ipc/shm.c
ipc/util.c
kernel/acct.c
kernel/compat.c
kernel/exit.c
kernel/fork.c
kernel/module.c
kernel/power/pmdisk.c
kernel/rcupdate.c
kernel/sched.c
kernel/signal.c
kernel/sysctl.c
kernel/timer.c
lib/string.c
lib/vsprintf.c
mm/Makefile
mm/filemap.c
mm/fremap.c
mm/highmem.c
mm/hugetlb.c
mm/memory.c
mm/mlock.c
mm/mmap.c
mm/mprotect.c
mm/mremap.c
mm/oom_kill.c
mm/page-writeback.c
mm/page_alloc.c
mm/readahead.c
mm/rmap.c
mm/shmem.c
mm/swapfile.c
mm/vmscan.c
net/8021q/vlan.h
net/8021q/vlan_dev.c
net/Kconfig
net/Makefile
net/appletalk/ddp.c
net/atm/br2684.c
net/atm/lec.c
net/atm/mpoa_proc.c
net/bluetooth/Kconfig
net/bluetooth/rfcomm/core.c
net/bridge/br_device.c
net/bridge/br_fdb.c
net/bridge/br_forward.c
net/bridge/br_if.c
net/bridge/br_notify.c
net/bridge/br_private.h
net/bridge/br_stp.c
net/bridge/br_stp_if.c
net/core/dev.c
net/core/pktgen.c
net/core/rtnetlink.c
net/core/skbuff.c
net/core/sock.c
net/decnet/dn_dev.c
net/econet/af_econet.c
net/ipv4/Makefile
net/ipv4/ah4.c
net/ipv4/arp.c
net/ipv4/devinet.c
net/ipv4/esp4.c
net/ipv4/icmp.c
net/ipv4/igmp.c
net/ipv4/ip_forward.c
net/ipv4/ip_fragment.c
net/ipv4/ip_input.c
net/ipv4/ip_output.c
net/ipv4/ipcomp.c
net/ipv4/ipmr.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_sync.c
net/ipv4/netfilter/ip_nat_snmp_basic.c
net/ipv4/proc.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_output.c
net/ipv4/tcp_timer.c
net/ipv4/udp.c
net/ipv4/xfrm4_state.c
net/ipv4/xfrm4_tunnel.c
net/ipv6/Makefile
net/ipv6/addrconf.c
net/ipv6/af_inet6.c
net/ipv6/ah6.c
net/ipv6/esp6.c
net/ipv6/exthdrs.c
net/ipv6/icmp.c
net/ipv6/ip6_flowlabel.c
net/ipv6/ip6_input.c
net/ipv6/ip6_output.c
net/ipv6/ipcomp6.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/proc.c
net/ipv6/raw.c
net/ipv6/reassembly.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_state.c
net/irda/af_irda.c
net/key/af_key.c
net/netrom/af_netrom.c
net/rose/af_rose.c
net/rxrpc/connection.c
net/rxrpc/transport.c
net/sched/Kconfig
net/sched/cls_api.c
net/sched/cls_u32.c
net/sched/sch_api.c
net/sched/sch_atm.c
net/sched/sch_cbq.c
net/sched/sch_generic.c
net/sched/sch_gred.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_ingress.c
net/sched/sch_prio.c
net/sched/sch_red.c
net/sched/sch_tbf.c
net/sctp/associola.c
net/sctp/chunk.c
net/sctp/endpointola.c
net/sctp/ipv6.c
net/sctp/output.c
net/sctp/outqueue.c
net/sctp/protocol.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sctp/ulpqueue.c
net/socket.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/cache.c
net/sunrpc/svcsock.c
net/sunrpc/sysctl.c
net/sunrpc/xprt.c
net/tux/Kconfig [new file with mode: 0644]
net/tux/Makefile [new file with mode: 0644]
net/tux/abuf.c [new file with mode: 0644]
net/tux/accept.c [new file with mode: 0644]
net/tux/cachemiss.c [new file with mode: 0644]
net/tux/cgi.c [new file with mode: 0644]
net/tux/directory.c [new file with mode: 0644]
net/tux/extcgi.c [new file with mode: 0644]
net/tux/gzip.c [new file with mode: 0644]
net/tux/input.c [new file with mode: 0644]
net/tux/logger.c [new file with mode: 0644]
net/tux/main.c [new file with mode: 0644]
net/tux/mod.c [new file with mode: 0644]
net/tux/output.c [new file with mode: 0644]
net/tux/parser.h [new file with mode: 0644]
net/tux/postpone.c [new file with mode: 0644]
net/tux/proc.c [new file with mode: 0644]
net/tux/proto_ftp.c [new file with mode: 0644]
net/tux/proto_http.c [new file with mode: 0644]
net/tux/redirect.c [new file with mode: 0644]
net/tux/times.c [new file with mode: 0644]
net/tux/times.h [new file with mode: 0644]
net/tux/userspace.c [new file with mode: 0644]
net/xfrm/xfrm_export.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/Makefile
scripts/Makefile.modpost
scripts/empty.c [deleted file]
scripts/file2alias.c [deleted file]
scripts/kernel-2.6-planetlab.spec
scripts/mk_elfconfig.c [deleted file]
scripts/mkconfigs [deleted file]
scripts/modpost.c [deleted file]
scripts/modpost.h [deleted file]
scripts/sumversion.c [deleted file]
security/selinux/hooks.c
sound/core/oss/pcm_oss.c
sound/drivers/serial-u16550.c
sound/isa/Kconfig
sound/isa/wavefront/wavefront_synth.c
sound/oss/aci.c
sound/oss/ad1816.c
sound/oss/ad1848.c
sound/oss/ad1889.c
sound/oss/cmpci.c
sound/oss/dmasound/dmasound.h
sound/oss/dmasound/dmasound_atari.c
sound/oss/dmasound/dmasound_awacs.c
sound/oss/gus_wave.c
sound/oss/hal2.c
sound/oss/i810_audio.c
sound/oss/trident.c
sound/oss/via82cxxx_audio.c
sound/oss/vwsnd.c
sound/oss/wavfront.c
sound/pci/au88x0/au88x0.h
sound/pci/au88x0/au88x0_a3d.c
sound/pci/azt3328.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/es1968.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1724.c
sound/pci/intel8x0m.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/nm256/nm256.c
sound/pci/rme9652/hdsp.c
sound/pci/sonicvibes.c
sound/ppc/pmac.c
sound/usb/usbaudio.c
sound/usb/usbmixer.c

index 21729ad..954e496 100644 (file)
@@ -2719,6 +2719,7 @@ Your cooperation is appreciated.
                 32 = /dev/ttyDB0               DataBooster serial port 0
                    ...
                 39 = /dev/ttyDB7               DataBooster serial port 7
+                40 = /dev/ttySG0               SGI Altix console port
 
 205 char       Low-density serial ports (alternate device)
                  0 = /dev/culu0                Callout device for ttyLU0
@@ -2743,6 +2744,7 @@ Your cooperation is appreciated.
                 32 = /dev/cudb0                Callout device for ttyDB0
                    ...
                 39 = /dev/cudb7                Callout device for ttyDB7
+                40 = /dev/cusg0                Callout device for ttySG0
 
 206 char       OnStream SC-x0 tape devices
                  0 = /dev/osst0                First OnStream SCSI tape, mode 0
index faf3b7a..9d62659 100644 (file)
@@ -1224,6 +1224,26 @@ On the  other  hand,  enabling this feature can cause you to run out of memory
 and thrash the system to death, so large and/or important servers will want to
 set this value to 0.
 
+nr_hugepages and hugetlb_shm_group
+----------------------------------
+
+nr_hugepages configures number of hugetlb page reserved for the system.
+
+hugetlb_shm_group contains group id that is allowed to create SysV shared
+memory segment using hugetlb page.
+
+laptop_mode
+-----------
+
+laptop_mode is a knob that controls "laptop mode". All the things that are
+controlled by this knob are discussed in Documentation/laptop-mode.txt.
+
+block_dump
+----------
+
+block_dump enables block I/O debugging when set to a nonzero value. More
+information on block I/O debugging is in Documentation/laptop-mode.txt.
+
 2.5 /proc/sys/dev - Device specific parameters
 ----------------------------------------------
 
@@ -1865,10 +1885,3 @@ need to  recompile  the kernel, or even to reboot the system. The files in the
 command to write value into these files, thereby changing the default settings
 of the kernel.
 ------------------------------------------------------------------------------
-
-
-
-
-
-
-
index d2b6ec2..065e59c 100644 (file)
@@ -3,12 +3,12 @@ How to conserve battery power using laptop-mode
 
 Document Author: Bart Samwel (bart@samwel.tk)
 Date created: January 2, 2004
-Last modified: April 3, 2004
+Last modified: July 10, 2004
 
 Introduction
 ------------
 
-Laptopmode is used to minimize the time that the hard disk needs to be spun up,
+Laptop mode is used to minimize the time that the hard disk needs to be spun up,
 to conserve battery power on laptops. It has been reported to cause significant
 power savings.
 
@@ -16,46 +16,43 @@ Contents
 --------
 
 * Introduction
-* The short story
+* Installation
 * Caveats
-* The details
+* The Details
 * Tips & Tricks
 * Control script
 * ACPI integration
 * Monitoring tool
 
 
-The short story
----------------
+Installation
+------------
 
 To use laptop mode, you don't need to set any kernel configuration options
-or anything. You simply need to run the laptop_mode control script (which
-is included in this document) as follows:
-
-# laptop_mode start
+or anything. Simply install all the files included in this document, and
+laptop mode will automatically be started when you're on battery. For
+your convenience, a tarball containing an installer can be downloaded at:
 
-Then set your harddisk spindown time to a relatively low value with hdparm:
+http://www.xs4all.nl/~bsamwel/laptop_mode/tools
 
-hdparm -S 4 /dev/hda
+To configure laptop mode, you need to edit the configuration file, which is
+located in /etc/default/laptop-mode on Debian-based systems, or in
+/etc/sysconfig/laptop-mode on other systems.
 
-The value -S 4 means 20 seconds idle time before spindown. Your harddisk will
-now only spin up when a disk cache miss occurs, or at least once every 10
-minutes to write back any pending changes.
-
-To stop laptop_mode, run "laptop_mode stop".
+Unfortunately, automatic enabling of laptop mode does not work for
+laptops that don't have ACPI. On those laptops, you need to start laptop
+mode manually. To start laptop mode, run "laptop_mode start", and to
+stop it, run "laptop_mode stop". (Note: The laptop mode tools package now
+has experimental support for APM, you might want to try that first.)
 
 
 Caveats
 -------
 
-* The downside of laptop mode is that you have a chance of losing up
-  to 10 minutes of work. If you cannot afford this, don't use it! It's
-  wise to turn OFF laptop mode when you're almost out of battery --
-  although this will make the battery run out faster, at least you'll
-  lose less work when it actually runs out. I'm still looking for someone
-  to submit instructions on how to turn off laptop mode when battery is low,
-  e.g., using ACPI events. I don't have a laptop myself, so if you do and
-  you care to contribute such instructions, please do.
+* The downside of laptop mode is that you have a chance of losing up to 10
+  minutes of work. If you cannot afford this, don't use it! The supplied ACPI
+  scripts automatically turn off laptop mode when the battery almost runs out,
+  so that you won't lose any data at the end of your battery life.
 
 * Most desktop hard drives have a very limited lifetime measured in spindown
   cycles, typically about 50.000 times (it's usually listed on the spec sheet).
@@ -69,23 +66,27 @@ Caveats
 
 * If you have your filesystems listed as type "auto" in fstab, like I did, then
   the control script will not recognize them as filesystems that need remounting.
+  You must list the filesystems with their true type instead.
 
 * It has been reported that some versions of the mutt mail client use file access
   times to determine whether a folder contains new mail. If you use mutt and
-  experience this, you must disable the noatime remounting in the control script
-  by setting DO_REMOUNT_NOATIME=0.
+  experience this, you must disable the noatime remounting by setting the option
+  DO_REMOUNT_NOATIME to 0 in the configuration file.
 
 
-The details
+The Details
 -----------
 
-Laptop-mode is controlled by the flag /proc/sys/vm/laptop_mode. This flag is
+Laptop mode is controlled by the knob /proc/sys/vm/laptop_mode. This knob is
 present for all kernels that have the laptop mode patch, regardless of any
-configuration options. When the flag is set, any physical disk read operation
-(that might have caused the hard disk to spin up) causes Linux to flush all dirty
-blocks. The result of this is that after a disk has spun down, it will not be spun
-up anymore to write dirty blocks, because those blocks had already been written
-immediately after the most recent read operation.
+configuration options. When the knob is set, any physical disk I/O (that might
+have caused the hard disk to spin up) causes Linux to flush all dirty blocks. The
+result of this is that after a disk has spun down, it will not be spun up
+anymore to write dirty blocks, because those blocks had already been written
+immediately after the most recent read operation. The value of the laptop_mode
+knob determines the time between the occurrence of disk I/O and when the flush
+is triggered. A sensible value for the knob is 5 seconds. Setting the knob to
+0 disables laptop mode.
 
 To increase the effectiveness of the laptop_mode strategy, the laptop_mode
 control script increases dirty_expire_centisecs and dirty_writeback_centisecs in
@@ -104,32 +105,102 @@ is set, Linux reports all disk read and write operations that take place, and
 all block dirtyings done to files. This makes it possible to debug why a disk
 needs to spin up, and to increase battery life even more. The output of
 block_dump is written to the kernel output, and it can be retrieved using
-"dmesg". When you use block_dump, you may want to turn off klogd, otherwise
+"dmesg". When you use block_dump and your kernel logging level also includes
+kernel debugging messages, you probably want to turn off klogd, otherwise
 the output of block_dump will be logged, causing disk activity that is not
 normally there.
 
-If 10 minutes is too much or too little downtime for you, you can configure
-this downtime as follows. In the control script, set the MAX_AGE value to the
-maximum number of seconds of disk downtime that you would like. You should
-then set your filesystem's commit interval to the same value. The dirty ratio
-is also configurable from the control script.
 
-If you don't like the idea of the control script remounting your filesystems
-for you, you can change DO_REMOUNTS to 0 in the script.
+Configuration
+-------------
+
+The laptop mode configuration file is located in /etc/default/laptop-mode on
+Debian-based systems, or in /etc/sysconfig/laptop-mode on other systems. It
+contains the following options:
+
+MAX_AGE:
+
+Maximum time, in seconds, of hard drive spindown time that you are
+confortable with. Worst case, it's possible that you could lose this
+amount of work if your battery fails while you're in laptop mode.
+
+MINIMUM_BATTERY_MINUTES:
+
+Automatically disable laptop mode if the remaining number of minutes of
+battery power is less than this value. Default is 10 minutes.
+
+AC_HD/BATT_HD:
+
+The idle timeout that should be set on your hard drive when laptop mode
+is active (BATT_HD) and when it is not active (AC_HD). The defaults are
+20 seconds (value 4) for BATT_HD  and 2 hours (value 244) for AC_HD. The
+possible values are those listed in the manual page for "hdparm" for the
+"-S" option.
+
+HD:
+
+The devices for which the spindown timeout should be adjusted by laptop mode.
+Default is /dev/hda. If you specify multiple devices, separate them by a space.
+
+READAHEAD:
+
+Disk readahead, in 512-byte sectors, while laptop mode is active. A large
+readahead can prevent disk accesses for things like executable pages (which are
+loaded on demand while the application executes) and sequentially accessed data
+(MP3s).
+
+DO_REMOUNTS:
+
+The control script automatically remounts any mounted journaled filesystems
+with approriate commit interval options. When this option is set to 0, this
+feature is disabled.
+
+DO_REMOUNT_NOATIME:
+
+When remounting, should the filesystems be remounted with the noatime option?
+Normally, this is set to "1" (enabled), but there may be programs that require
+access time recording.
+
+DIRTY_RATIO:
 
-Thanks to Kiko Piris, the control script can be used to enable laptop mode on
-both the Linux 2.4 and 2.6 series.
+The percentage of memory that is allowed to contain "dirty" or unsaved data
+before a writeback is forced, while laptop mode is active. Corresponds to
+the /proc/sys/vm/dirty_ratio sysctl.
+
+DIRTY_BACKGROUND_RATIO:
+
+The percentage of memory that is allowed to contain "dirty" or unsaved data
+after a forced writeback is done due to an exceeding of DIRTY_RATIO. Set
+this nice and low. This corresponds to the /proc/sys/vm/dirty_background_ratio
+sysctl.
+
+Note that the behaviour of dirty_background_ratio is quite different
+when laptop mode is active and when it isn't. When laptop mode is inactive,
+dirty_background_ratio is the threshold percentage at which background writeouts
+start taking place. When laptop mode is active, however, background writeouts
+are disabled, and the dirty_background_ratio only determines how much writeback
+is done when dirty_ratio is reached.
+
+DO_CPU:
+
+Enable CPU frequency scaling when in laptop mode. (Requires CPUFreq to be setup.
+See Documentation/cpu-freq/user-guide.txt for more info. Disabled by default.)
+
+CPU_MAXFREQ:
+
+When on battery, what is the maximum CPU speed that the system should use? Legal
+values are "slowest" for the slowest speed that your CPU is able to operate at,
+or a value listed in /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies.
 
 
 Tips & Tricks
 -------------
 
 * Bartek Kania reports getting up to 50 minutes of extra battery life (on top
-  of his regular 3 to 3.5 hours) using very aggressive power management (hdparm
-  -B1) and a spindown time of 5 seconds (hdparm -S1).
+  of his regular 3 to 3.5 hours) using a spindown time of 5 seconds (BATT_HD=1).
 
-* You can spin down the disk while playing MP3, by setting the disk readahead
-  to 8MB (hdparm -a 16384). Effectively, the disk will read a complete MP3 at
+* You can spin down the disk while playing MP3, by setting disk readahead
+  to 8MB (READAHEAD=16384). Effectively, the disk will read a complete MP3 at
   once, and will then spin down while the MP3 is playing. (Thanks to Bartek
   Kania.)
 
@@ -138,18 +209,6 @@ Tips & Tricks
   this on powerbooks too. I hope that this is a piece of information that
   might be useful to the Laptop Mode patch or it's users."
 
-* One thing which will cause disks to spin up is not-present application
-  and dynamic library text pages.  The kernel will load program text off disk
-  on-demand, so each time you invoke an application feature for the first
-  time, the kernel needs to spin the disk up to go and fetch that part of the
-  application.
-
-  So it is useful to increase the disk readahead parameter greatly, so that
-  the kernel will pull all of the executable's pages into memory on the first
-  pagefault.
-
-  The supplied script does this.
-
 * In syslog.conf, you can prefix entries with a dash ``-'' to omit syncing the
   file after every logging. When you're using laptop-mode and your disk doesn't
   spin down, this is a likely culprit.
@@ -158,13 +217,108 @@ Tips & Tricks
   (http://noflushd.sourceforge.net/), it seems that noflushd prevents laptop-mode
   from doing its thing.
 
+* If you're worried about your data, you might want to consider using a USB
+  memory stick or something like that as a "working area". (Be aware though
+  that flash memory can only handle a limited number of writes, and overuse
+  may wear out your memory stick pretty quickly. Do _not_ use journalling
+  filesystems on flash memory sticks.)
+
+
+Configuration file for control and ACPI battery scripts
+-------------------------------------------------------
+
+This allows the tunables to be changed for the scripts via an external
+configuration file
+
+It should be installed as /etc/default/laptop-mode on Debian, and as
+/etc/sysconfig/laptop-mode on Red Hat, SUSE, Mandrake, and other work-alikes.
+
+--------------------CONFIG FILE BEGIN-------------------------------------------
+# Maximum time, in seconds, of hard drive spindown time that you are
+# confortable with. Worst case, it's possible that you could lose this
+# amount of work if your battery fails you while in laptop mode.
+#MAX_AGE=600
+
+# Automatically disable laptop mode when the number of minutes of battery
+# that you have left goes below this threshold.
+MINIMUM_BATTERY_MINUTES=10
+
+# Read-ahead, in 512-byte sectors. You can spin down the disk while playing MP3/OGG
+# by setting the disk readahead to 8MB (READAHEAD=16384). Effectively, the disk
+# will read a complete MP3 at once, and will then spin down while the MP3/OGG is
+# playing.
+#READAHEAD=4096
+
+# Shall we remount journaled fs. with appropiate commit interval? (1=yes)
+#DO_REMOUNTS=1
+
+# And shall we add the "noatime" option to that as well? (1=yes)
+#DO_REMOUNT_NOATIME=1
+
+# Dirty synchronous ratio.  At this percentage of dirty pages the process
+# which
+# calls write() does its own writeback
+#DIRTY_RATIO=40
+
+#
+# Allowed dirty background ratio, in percent.  Once DIRTY_RATIO has been
+# exceeded, the kernel will wake pdflush which will then reduce the amount
+# of dirty memory to dirty_background_ratio.  Set this nice and low, so once
+# some writeout has commenced, we do a lot of it.
+#
+#DIRTY_BACKGROUND_RATIO=5
+
+# kernel default dirty buffer age
+#DEF_AGE=30
+#DEF_UPDATE=5
+#DEF_DIRTY_BACKGROUND_RATIO=10
+#DEF_DIRTY_RATIO=40
+#DEF_XFS_AGE_BUFFER=15
+#DEF_XFS_SYNC_INTERVAL=30
+#DEF_XFS_BUFD_INTERVAL=1
+
+# This must be adjusted manually to the value of HZ in the running kernel
+# on 2.4, until the XFS people change their 2.4 external interfaces to work in
+# centisecs. This can be automated, but it's a work in progress that still
+# needs# some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for
+# external interfaces, and that is currently always set to 100. So you don't
+# need to change this on 2.6.
+#XFS_HZ=100
+
+# Should the maximum CPU frequency be adjusted down while on battery?
+# Requires CPUFreq to be setup.
+# See Documentation/cpu-freq/user-guide.txt for more info
+#DO_CPU=0
+
+# When on battery what is the maximum CPU speed that the system should
+# use? Legal values are "slowest" for the slowest speed that your
+# CPU is able to operate at, or a value listed in:
+# /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
+# Only applicable if DO_CPU=1.
+#CPU_MAXFREQ=slowest
+
+# Idle timeout for your hard drive (man hdparm for valid values, -S option)
+# Default is 2 hours on AC (AC_HD=244) and 20 seconds for battery (BATT_HD=4).
+#AC_HD=244
+#BATT_HD=4
+
+# The drives for which to adjust the idle timeout. Separate them by a space,
+# e.g. HD="/dev/hda /dev/hdb".
+#HD="/dev/hda"
+
+# Set the spindown timeout on a hard drive?
+#DO_HD=1
+
+--------------------CONFIG FILE END---------------------------------------------
+
 
 Control script
 --------------
 
-Please note that this control script works for the Linux 2.4 and 2.6 series.
+Please note that this control script works for the Linux 2.4 and 2.6 series (thanks
+to Kiko Piris).
 
---------------------CONTROL SCRIPT BEGIN------------------------------------------
+--------------------CONTROL SCRIPT BEGIN----------------------------------------
 #!/bin/bash
 
 # start or stop laptop_mode, best run by a power management daemon when
@@ -183,21 +337,50 @@ Please note that this control script works for the Linux 2.4 and 2.6 series.
 
 #############################################################################
 
-# Age time, in seconds. should be put into a sysconfig file
-MAX_AGE=600
+# Source config
+if [ -f /etc/default/laptop-mode ] ; then
+       # Debian
+       . /etc/default/laptop-mode
+elif [ -f /etc/sysconfig/laptop-mode ] ; then
+       # Others
+        . /etc/sysconfig/laptop-mode
+fi
+
+# Don't raise an error if the config file is incomplete
+# set defaults instead:
+
+# Maximum time, in seconds, of hard drive spindown time that you are
+# confortable with. Worst case, it's possible that you could lose this
+# amount of work if your battery fails you while in laptop mode.
+MAX_AGE=${MAX_AGE:-'600'}
 
 # Read-ahead, in kilobytes
-READAHEAD=4096
+READAHEAD=${READAHEAD:-'4096'}
 
 # Shall we remount journaled fs. with appropiate commit interval? (1=yes)
-DO_REMOUNTS=1
+DO_REMOUNTS=${DO_REMOUNTS:-'1'}
 
 # And shall we add the "noatime" option to that as well? (1=yes)
-DO_REMOUNT_NOATIME=1
+DO_REMOUNT_NOATIME=${DO_REMOUNT_NOATIME:-'1'}
+
+# Shall we adjust the idle timeout on a hard drive?
+DO_HD=${DO_HD:-'1'}
+
+# Adjust idle timeout on which hard drive?
+HD="${HD:-'/dev/hda'}"
+
+# spindown time for HD (hdparm -S values)
+AC_HD=${AC_HD:-'244'}
+BATT_HD=${BATT_HD:-'4'}
 
 # Dirty synchronous ratio.  At this percentage of dirty pages the process which
 # calls write() does its own writeback
-DIRTY_RATIO=40
+DIRTY_RATIO=${DIRTY_RATIO:-'40'}
+
+# cpu frequency scaling
+# See Documentation/cpu-freq/user-guide.txt for more info
+DO_CPU=${CPU_MANAGE:-'0'}
+CPU_MAXFREQ=${CPU_MAXFREQ:-'slowest'}
 
 #
 # Allowed dirty background ratio, in percent.  Once DIRTY_RATIO has been
@@ -205,16 +388,16 @@ DIRTY_RATIO=40
 # of dirty memory to dirty_background_ratio.  Set this nice and low, so once
 # some writeout has commenced, we do a lot of it.
 #
-DIRTY_BACKGROUND_RATIO=5
+DIRTY_BACKGROUND_RATIO=${DIRTY_BACKGROUND_RATIO:-'5'}
 
 # kernel default dirty buffer age
-DEF_AGE=30
-DEF_UPDATE=5
-DEF_DIRTY_BACKGROUND_RATIO=10
-DEF_DIRTY_RATIO=40
-DEF_XFS_AGE_BUFFER=15
-DEF_XFS_SYNC_INTERVAL=30
-DEF_XFS_BUFD_INTERVAL=1
+DEF_AGE=${DEF_AGE:-'30'}
+DEF_UPDATE=${DEF_UPDATE:-'5'}
+DEF_DIRTY_BACKGROUND_RATIO=${DEF_DIRTY_BACKGROUND_RATIO:-'10'}
+DEF_DIRTY_RATIO=${DEF_DIRTY_RATIO:-'40'}
+DEF_XFS_AGE_BUFFER=${DEF_XFS_AGE_BUFFER:-'15'}
+DEF_XFS_SYNC_INTERVAL=${DEF_XFS_SYNC_INTERVAL:-'30'}
+DEF_XFS_BUFD_INTERVAL=${DEF_XFS_BUFD_INTERVAL:-'1'}
 
 # This must be adjusted manually to the value of HZ in the running kernel
 # on 2.4, until the XFS people change their 2.4 external interfaces to work in
@@ -222,7 +405,7 @@ DEF_XFS_BUFD_INTERVAL=1
 # some fixes. On 2.6 kernels, XFS uses USER_HZ instead of HZ for external
 # interfaces, and that is currently always set to 100. So you don't need to
 # change this on 2.6.
-XFS_HZ=100
+XFS_HZ=${XFS_HZ:-'100'}
 
 #############################################################################
 
@@ -342,6 +525,20 @@ parse_mount_opts_wfstab () {
        fi
 }
 
+deduce_fstype () {
+       MP="$1"
+       # My root filesystem unfortunately has
+       # type "unknown" in /etc/mtab. If we encounter
+       # "unknown", we try to get the type from fstab.
+       cat /etc/fstab |
+       grep -v '^#' |
+       while read FSTAB_DEV FSTAB_MP FSTAB_FST FSTAB_OPTS FSTAB_DUMP FSTAB_DUMP ; do
+               if [ "$FSTAB_MP" = "$MP" ]; then
+                       echo $FSTAB_FST
+                       exit 0
+               fi
+       done
+}
 
 if [ $DO_REMOUNT_NOATIME -eq 1 ] ; then
        NOATIME_OPT=",noatime"
@@ -395,6 +592,9 @@ case "$1" in
                if [ $DO_REMOUNTS -eq 1 ]; then
                        cat /etc/mtab | while read DEV MP FST OPTS DUMP PASS ; do
                                PARSEDOPTS="$(parse_mount_opts "$OPTS")"
+                               if [ "$FST" = 'unknown' ]; then
+                                       FST=$(deduce_fstype $MP)
+                               fi
                                case "$FST" in
                                        "ext3"|"reiserfs")
                                                PARSEDOPTS="$(parse_mount_opts commit "$OPTS")"
@@ -409,6 +609,18 @@ case "$1" in
                                fi
                        done
                fi
+               if [ $DO_HD -eq 1 ] ; then
+                       for THISHD in $HD ; do
+                               /sbin/hdparm -S $BATT_HD $THISHD > /dev/null 2>&1
+                               /sbin/hdparm -B 1 $THISHD > /dev/null 2>&1
+                       done
+               fi
+               if [ $DO_CPU -eq 1 -a -e /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq ]; then
+                       if [ $CPU_MAXFREQ = 'slowest' ]; then
+                               CPU_MAXFREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+                       fi
+                       echo $CPU_MAXFREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+               fi
                echo "."
                ;;
        stop)
@@ -440,6 +652,9 @@ case "$1" in
                if [ $DO_REMOUNTS -eq 1 ] ; then
                        cat /etc/mtab | while read DEV MP FST OPTS DUMP PASS ; do
                                # Reset commit and atime options to defaults.
+                               if [ "$FST" = 'unknown' ]; then
+                                       FST=$(deduce_fstype $MP)
+                               fi
                                case "$FST" in
                                        "ext3"|"reiserfs")
                                                PARSEDOPTS="$(parse_mount_opts_wfstab $DEV commit $OPTS)"
@@ -456,6 +671,15 @@ case "$1" in
                                fi
                        done
                fi
+               if [ $DO_HD -eq 1 ] ; then
+                       for THISHD in $HD ; do
+                               /sbin/hdparm -S $AC_HD $THISHD > /dev/null 2>&1
+                               /sbin/hdparm -B 255 $THISHD > /dev/null 2>&1
+                       done
+               fi
+               if [ $DO_CPU -eq 1 -a -e /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq ]; then
+                       echo `cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq` > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
+               fi
                echo "."
                ;;
        *)
@@ -466,56 +690,90 @@ case "$1" in
 esac
 
 exit 0
---------------------CONTROL SCRIPT END--------------------------------------------
+--------------------CONTROL SCRIPT END------------------------------------------
 
 
 ACPI integration
 ----------------
 
 Dax Kelson submitted this so that the ACPI acpid daemon will
-kick off the laptop_mode script and run hdparm.
+kick off the laptop_mode script and run hdparm. The part that
+automatically disables laptop mode when the battery is low was
+writen by Jan Topinski.
 
----------------------------/etc/acpi/events/ac_adapter BEGIN-------------------------------------------
+-----------------/etc/acpi/events/ac_adapter BEGIN------------------------------
 event=ac_adapter
-action=/etc/acpi/actions/battery.sh
----------------------------/etc/acpi/events/ac_adapter END-------------------------------------------
+action=/etc/acpi/actions/ac.sh %e
+----------------/etc/acpi/events/ac_adapter END---------------------------------
+
 
----------------------------/etc/acpi/actions/battery.sh BEGIN-------------------------------------------
-#!/bin/sh
+-----------------/etc/acpi/events/battery BEGIN---------------------------------
+event=battery.*
+action=/etc/acpi/actions/battery.sh %e
+----------------/etc/acpi/events/battery END------------------------------------
 
-# cpu throttling
-# cat /proc/acpi/processor/CPU0/throttling for more info
-ACAD_THR=0
-BATT_THR=2
 
-# spindown time for HD (man hdparm for valid values)
-# I prefer 2 hours for acad and 20 seconds for batt
-ACAD_HD=244
-BATT_HD=4
+----------------/etc/acpi/actions/ac.sh BEGIN-----------------------------------
+#!/bin/bash
 
-# ac/battery event handler
+# ac on/offline event handler
 
-status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/AC/state`
+status=`awk '/^state: / { print $2 }' /proc/acpi/ac_adapter/$2/state`
 
 case $status in
         "on-line")
-                echo "Setting HD spindown for AC mode."
                 /sbin/laptop_mode stop
-                /sbin/hdparm -S $ACAD_HD /dev/hda > /dev/null 2>&1
-                /sbin/hdparm -B 255 /dev/hda > /dev/null 2>&1
-                #echo -n $ACAD_CPU:$ACAD_THR > /proc/acpi/processor/CPU0/limit
                 exit 0
         ;;
         "off-line")
-                echo "Setting HD spindown for battery mode."
                 /sbin/laptop_mode start
-                /sbin/hdparm -S $BATT_HD /dev/hda > /dev/null 2>&1
-                /sbin/hdparm -B 1 /dev/hda > /dev/null 2>&1
-                #echo -n $BATT_CPU:$BATT_THR > /proc/acpi/processor/CPU0/limit
                 exit 0
         ;;
 esac
----------------------------/etc/acpi/actions/battery.sh END-------------------------------------------
+---------------------------/etc/acpi/actions/ac.sh END--------------------------
+
+
+---------------------------/etc/acpi/actions/battery.sh BEGIN-------------------
+#! /bin/bash
+
+# Automatically disable laptop mode when the battery almost runs out.
+
+BATT_INFO=/proc/acpi/battery/$2/state
+
+if [[ -f /proc/sys/vm/laptop_mode ]]
+then
+   LM=`cat /proc/sys/vm/laptop_mode`
+   if [[ $LM -gt 0 ]]
+   then
+     if [[ -f $BATT_INFO ]]
+     then
+        # Source the config file only now that we know we need
+        if [ -f /etc/default/laptop-mode ] ; then
+                # Debian
+                . /etc/default/laptop-mode
+        elif [ -f /etc/sysconfig/laptop-mode ] ; then
+                # Others
+                . /etc/sysconfig/laptop-mode
+        fi
+        MINIMUM_BATTERY_MINUTES=${MINIMUM_BATTERY_MINUTES:-'10'}
+
+        ACTION="`cat $BATT_INFO | grep charging | cut -c 26-`"
+        if [[ ACTION -eq "discharging" ]]
+        then
+           PRESENT_RATE=`cat $BATT_INFO | grep "present rate:" | sed  "s/.* \([0-9][0-9]* \).*/\1/" `
+           REMAINING=`cat $BATT_INFO | grep "remaining capacity:" | sed  "s/.* \([0-9][0-9]* \).*/\1/" `
+        fi
+        if (($REMAINING * 60 / $PRESENT_RATE < $MINIMUM_BATTERY_MINUTES))
+        then
+           /sbin/laptop_mode stop
+        fi
+     else
+       logger -p daemon.warning "You are using laptop mode and your battery interface $BATT_INFO is missing. This may lead to loss of data when the battery runs out. Check kernel ACPI support and /proc/acpi/battery folder, and edit /etc/acpi/battery.sh to set BATT_INFO to the correct path."
+     fi
+   fi
+fi
+---------------------------/etc/acpi/actions/battery.sh END--------------------
+
 
 Monitoring tool
 ---------------
@@ -523,7 +781,7 @@ Monitoring tool
 Bartek Kania submitted this, it can be used to measure how much time your disk
 spends spun up/down.
 
----------------------------dslm.c BEGIN-------------------------------------------
+---------------------------dslm.c BEGIN-----------------------------------------
 /*
  * Simple Disk Sleep Monitor
  *  by Bartek Kania
@@ -689,4 +947,4 @@ int main(int ac, char **av)
 
     return 0;
 }
----------------------------dslm.c END---------------------------------------------
+---------------------------dslm.c END-------------------------------------------
index d5ffa57..5cdab4c 100644 (file)
@@ -202,3 +202,30 @@ or an NFS share[Work In Progress]). Questions regarding suspend2
 should be sent to the mailing list available through the suspend2
 website, and not to the Linux Kernel Mailing List. We are working
 toward merging suspend2 into the mainline kernel.
+
+Q: Kernel thread must voluntarily freeze itself (call 'refrigerator'). But
+I found some kernel threads don't do it, and they don't freeze, and
+so the system can't sleep. Is this a known behavior?
+
+A: All such kernel threads need to be fixed, one by one. Select place
+where it is safe to be frozen (no kernel semaphores should be held at
+that point and it must be safe to sleep there), and add:
+
+            if (current->flags & PF_FREEZE)
+                    refrigerator(PF_FREEZE);
+
+Q: What is the difference between between "platform", "shutdown" and
+"firmware" in /sys/power/disk?
+
+A:
+
+shutdown: save state in linux, then tell bios to powerdown
+
+platform: save state in linux, then tell bios to powerdown and blink
+          "suspended led"
+
+firmware: tell bios to save state itself [needs BIOS-specific suspend
+         partition, and has very little to do with swsusp]
+
+"platform" is actually right thing to do, but "shutdown" is most
+reliable.
index c3407f6..463dfc7 100644 (file)
@@ -40,7 +40,7 @@ This version of the document roughly matches linux kernel version 2.6.0-test4.
 Documentation
 =============
 There is a SCSI documentation directory within the kernel source tree, 
-typically /usr/src/linux/Documentation/scsi . Most documents are in plain
+typically Documentation/scsi . Most documents are in plain
 (i.e. ASCII) text. This file is named scsi_mid_low_api.txt and can be 
 found in that directory. A more recent copy of this document may be found
 at http://www.torque.net/scsi/scsi_mid_low_api.txt.gz . 
index 934a49a..fae0c98 100644 (file)
@@ -3641,7 +3641,7 @@ struct _snd_pcm_runtime {
 
         <para>
           More precise information can be found in
-        <filename>alsa-kernel/Documentation/sound/alsa/ControlNames.txt</filename>.
+        <filename>Documentation/sound/alsa/ControlNames.txt</filename>.
         </para>
       </section>
     </section>
@@ -5182,7 +5182,7 @@ struct _snd_pcm_runtime {
       The callback is much more complicated than the text-file
       version. You need to use a low-level i/o functions such as
       <function>copy_from/to_user()</function> to transfer the
-      data. Also, you have to keep tracking the file position, too. 
+      data.
 
       <informalexample>
         <programlisting>
@@ -5190,14 +5190,15 @@ struct _snd_pcm_runtime {
   static long my_file_io_read(snd_info_entry_t *entry,
                               void *file_private_data,
                               struct file *file,
-                              char *buf, long count)
+                              char *buf,
+                              unsigned long count,
+                              unsigned long pos)
   {
           long size = count;
-          if (file->f_pos + size > local_max_size)
-                  size = local_max_size - file->f_pos;
-          if (copy_to_user(buf, local_data + file->f_pos, size))
+          if (pos + size > local_max_size)
+                  size = local_max_size - pos;
+          if (copy_to_user(buf, local_data + pos, size))
                   return -EFAULT;
-          file->f_pos += size;
           return size;
   }
 ]]>
index c873ef9..b0349d8 100644 (file)
@@ -24,11 +24,14 @@ Currently, these files are in /proc/sys/vm:
 - dirty_writeback_centisecs
 - max_map_count
 - min_free_kbytes
+- laptop_mode
+- block_dump
 
 ==============================================================
 
 dirty_ratio, dirty_background_ratio, dirty_expire_centisecs,
-dirty_writeback_centisecs, vfs_cache_pressure:
+dirty_writeback_centisecs, vfs_cache_pressure, laptop_mode,
+block_dump:
 
 See Documentation/filesystems/proc.txt
 
index 79cfc19..c8c25df 100644 (file)
@@ -632,7 +632,7 @@ S:  Maintained
 
 DEFXX FDDI NETWORK DRIVER
 P:     Maciej W. Rozycki
-M:     macro@ds2.pg.gda.pl
+M:     macro@linux-mips.org
 S:     Maintained
 
 DELL LAPTOP SMM DRIVER
@@ -1283,6 +1283,13 @@ W:       http://www.penguinppc.org/
 L:     linuxppc-embedded@lists.linuxppc.org
 S:     Maintained
 
+LINUX FOR POWERPC EMBEDDED PPC8XX AND BOOT CODE
+P:     Tom Rini
+M:     trini@kernel.crashing.org
+W:     http://www.penguinppc.org/
+L:     linuxppc-embedded@lists.linuxppc.org
+S:     Maintained
+
 LINUX FOR POWERPC EMBEDDED PPC85XX
 P:     Kumar Gala
 M:     kumar.gala@freescale.com
@@ -1324,11 +1331,14 @@ M:      matthew@wil.cx
 L:     linux-scsi@vger.kernel.org
 S:     Maintained
 
-M68K
-P:     Jes Sorensen
-M:     jes@trained-monkey.org
-W:     http://www.clark.net/pub/lawrencc/linux/index.html
+M68K ARCHITECTURE
+P:     Geert Uytterhoeven
+M:     geert@linux-m68k.org
+P:     Roman Zippel
+M:     zippel@linux-m68k.org
 L:     linux-m68k@lists.linux-m68k.org
+W:     http://www.linux-m68k.org/
+W:     http://linux-m68k-cvs.ubb.ca/
 S:     Maintained
 
 M68K ON APPLE MACINTOSH
@@ -1374,7 +1384,7 @@ MEMORY TECHNOLOGY DEVICES
 P:     David Woodhouse
 M:     dwmw2@redhat.com
 W:     http://www.linux-mtd.infradead.org/
-L:     mtd@infradead.org
+L:     linux-mtd@lists.infradead.org
 S:     Maintained
 
 MICROTEK X6 SCANNER
@@ -1494,6 +1504,8 @@ P:        James Morris
 M:     jmorris@redhat.com
 P:     Hideaki YOSHIFUJI
 M:     yoshfuji@linux-ipv6.org
+P:     Patrick McHardy
+M:     kaber@coreworks.de
 L:     netdev@oss.sgi.com
 S:     Maintained
 
@@ -1557,7 +1569,7 @@ S:        Maintained
 ONSTREAM SCSI TAPE DRIVER
 P:     Willem Riede
 M:     osst@riede.org
-L:     osst@linux1.onstream.nl
+L:     osst-users@lists.sourceforge.net
 L:     linux-scsi@vger.kernel.org
 S:     Maintained
 
@@ -1945,8 +1957,8 @@ L:        ultralinux@vger.kernel.org
 S:     Maintained
 
 SPARC (sparc32):
-P:     Keith M. Wesolowski
-M:     wesolows@foobazco.org
+P:     William L. Irwin
+M:     wli@holomorphy.com
 L:     sparclinux@vger.kernel.org
 S:     Maintained
 
index c4daf4a..c23dcfb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 2
 PATCHLEVEL = 6
-SUBLEVEL = 7
+SUBLEVEL = 8
 EXTRAVERSION = -1.planetlab
 NAME=Zonked Quokka
 
@@ -53,7 +53,7 @@ ifndef KBUILD_CHECKSRC
   KBUILD_CHECKSRC = 0
 endif
 
-# Use make M=dir to specify direcotry of external module to build
+# Use make M=dir to specify directory of external module to build
 # Old syntax make ... SUBDIRS=$PWD is still supported
 # Setting the environment variable KBUILD_EXTMOD take precedence
 ifdef SUBDIRS
@@ -130,16 +130,6 @@ else
 _all: modules
 endif
 
-# Make sure we're not wasting cpu-cycles doing locale handling, yet do make
-# sure error messages appear in the user-desired language
-ifdef LC_ALL
-LANG := $(LC_ALL)
-LC_ALL :=
-endif
-LC_COLLATE := C
-LC_CTYPE := C
-export LANG LC_ALL LC_COLLATE LC_CTYPE
-
 srctree                := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
 TOPDIR         := $(srctree)
 # FIXME - TOPDIR is obsolete, use srctree/objtree
@@ -621,7 +611,11 @@ vmlinux: $(vmlinux-objs) $(kallsyms.o) arch/$(ARCH)/kernel/vmlinux.lds.s FORCE
 
 $(sort $(vmlinux-objs)) arch/$(ARCH)/kernel/vmlinux.lds.s: $(vmlinux-dirs) ;
 
-#      Handle descending into subdirectories listed in $(vmlinux-dirs)
+# Handle descending into subdirectories listed in $(vmlinux-dirs)
+# Preset locale variables to speed up the build process. Limit locale
+# tweaks to this spot to avoid wrong language settings when running
+# make menuconfig etc.
+# Error messages still appears in the original language
 
 .PHONY: $(vmlinux-dirs)
 $(vmlinux-dirs): prepare-all scripts
@@ -632,14 +626,24 @@ $(vmlinux-dirs): prepare-all scripts
 # A multi level approach is used. prepare1 is updated first, then prepare0.
 # prepare-all is the collection point for the prepare targets.
 
-.PHONY: prepare-all prepare prepare0 prepare1
+.PHONY: prepare-all prepare prepare0 prepare1 prepare2
+
+# prepare 2 generate Makefile to be placed in output directory, if
+# using a seperate output directory. This allows convinient use
+# of make in output directory
+prepare2:
+       $(Q)if [ ! $(srctree) -ef $(objtree) ]; then       \
+       $(CONFIG_SHELL) $(srctree)/scripts/mkmakefile      \
+           $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) \
+           > $(objtree)/Makefile;                         \
+       fi
 
 # prepare1 is used to check if we are building in a separate output directory,
 # and if so do:
 # 1) Check that make has not been executed in the kernel src $(srctree)
 # 2) Create the include2 directory, used for the second asm symlink
 
-prepare1:
+prepare1: prepare2
 ifneq ($(KBUILD_SRC),)
        @echo '  Using $(srctree) as source for kernel'
        $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \
@@ -760,9 +764,13 @@ _modinst_:
                sleep 1; \
        fi
        @rm -rf $(MODLIB)/kernel
-       @rm -f $(MODLIB)/build
+       @rm -f $(MODLIB)/source
        @mkdir -p $(MODLIB)/kernel
-       @ln -s $(TOPDIR) $(MODLIB)/build
+       @ln -s $(srctree) $(MODLIB)/source
+       @if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
+               rm -f $(MODLIB)/build ; \
+               ln -s $(objtree) $(MODLIB)/build ; \
+       fi
        $(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
 
 # If System.map exists, run depmod.  This deliberately does not have a
@@ -1009,19 +1017,19 @@ endif # KBUILD_EXTMOD
 # ---------------------------------------------------------------------------
 
 define all-sources
-       ( find . $(RCS_FIND_IGNORE) \
+       ( find $(srctree) $(RCS_FIND_IGNORE) \
               \( -name include -o -name arch \) -prune -o \
               -name '*.[chS]' -print; \
-         find arch/$(ARCH) $(RCS_FIND_IGNORE) \
+         find $(srctree)/arch/$(ARCH) $(RCS_FIND_IGNORE) \
               -name '*.[chS]' -print; \
-         find security/selinux/include $(RCS_FIND_IGNORE) \
+         find $(srctree)/security/selinux/include $(RCS_FIND_IGNORE) \
               -name '*.[chS]' -print; \
-         find include $(RCS_FIND_IGNORE) \
+         find $(srctree)/include $(RCS_FIND_IGNORE) \
               \( -name config -o -name 'asm-*' \) -prune \
               -o -name '*.[chS]' -print; \
-         find include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
+         find $(srctree)/include/asm-$(ARCH) $(RCS_FIND_IGNORE) \
               -name '*.[chS]' -print; \
-         find include/asm-generic $(RCS_FIND_IGNORE) \
+         find $(srctree)/include/asm-generic $(RCS_FIND_IGNORE) \
               -name '*.[chS]' -print )
 endef
 
index 99a3843..da929a2 100644 (file)
@@ -422,7 +422,6 @@ CONFIG_VLAN_8021Q=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index e98b02c..5c98fc8 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (C) 2001-2002 Jan-Benedict Glaw <jbglaw@lug-owl.de>
  *
  * This driver is at all a modified version of Erik Mouw's
- * ./linux/Documentation/DocBook/procfs_example.c, so: thank
+ * Documentation/DocBook/procfs_example.c, so: thank
  * you, Erik! He can be reached via email at
  * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea
  * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They
index bf9c1a2..57052d8 100644 (file)
@@ -240,7 +240,15 @@ sys_call_table:
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 220 */
        .quad alpha_ni_syscall
+#ifdef CONFIG_TUX
+       .quad __sys_tux
+#else
+# ifdef CONFIG_TUX_MODULE
+       .quad sys_tux
+# else
        .quad alpha_ni_syscall
+# endif
+#endif
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall
        .quad alpha_ni_syscall                  /* 225 */
index d97eda7..e4435a4 100644 (file)
@@ -253,7 +253,7 @@ menu "General setup"
 # Select various configuration options depending on the machine type
 config DISCONTIGMEM
        bool
-       depends on ARCH_EDB7211 || ARCH_SA1100 || (ARCH_LH7A40X && !LH7A40X_SROMLL)
+       depends on ARCH_EDB7211 || ARCH_SA1100 || (ARCH_LH7A40X && !LH7A40X_CONTIGMEM)
        default y
        help
          Say Y to support efficient handling of discontiguous physical memory,
@@ -370,7 +370,7 @@ config CPU_FREQ_INTEGRATOR
        help
          This enables the CPUfreq driver for ARM Integrator CPUs.
 
-         For details, take a look at linux/Documentation/cpu-freq.
+         For details, take a look at <file:Documentation/cpu-freq>.
 
          If in doubt, say Y.
 
index aeafdd7..8b34b0d 100644 (file)
@@ -55,9 +55,11 @@ tune-$(CONFIG_CPU_XSCALE)    :=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
 tune-$(CONFIG_CPU_V6)          :=-mtune=strongarm
 
 # Need -Uarm for gcc < 3.x
-CFLAGS         +=-mapcs-32 $(arch-y) $(tune-y) -mshort-load-bytes -msoft-float -Wa,-mno-fpu -Uarm
+CFLAGS         +=-mapcs-32 $(arch-y) $(tune-y) $(call check_gcc,-malignment-traps,-mshort-load-bytes) -msoft-float -Wa,-mno-fpu -Uarm
 AFLAGS         +=-mapcs-32 $(arch-y) $(tune-y) -msoft-float -Wa,-mno-fpu
 
+CHECK          := $(CHECK) -D__arm__=1
+
 #Default value
 DATAADDR       := .
 
index 6318bc9..8e8879b 100644 (file)
@@ -7,10 +7,10 @@ LDFLAGS_bootp :=-p --no-undefined -X \
                 --defsym params_phys=$(PARAMS_PHYS) -T
 AFLAGS_initrd.o :=-DINITRD=\"$(INITRD)\"
 
-targets        := bootp bootp.lds init.o kernel.o initrd.o
+targets        := bootp init.o kernel.o initrd.o
 
 # Note that bootp.lds picks up kernel.o and initrd.o
-$(obj)/bootp:  $(addprefix $(obj)/,bootp.lds init.o kernel.o initrd.o) FORCE
+$(obj)/bootp:  $(src)/bootp.lds $(addprefix $(obj)/,init.o kernel.o initrd.o) FORCE
        $(call if_changed,ld)
        @:
 
index fc4cc2f..df7bc70 100644 (file)
                .type   _start, #function
                .globl  _start
 
-_start:                adr     r13, data
+_start:                add     lr, pc, #-0x8           @ lr = current load addr
+               adr     r13, data
                ldmia   r13!, {r4-r6}           @ r5 = dest, r6 = length
+               add     r4, r4, lr              @ r4 = initrd_start + load addr
                bl      move                    @ move the initrd
 
 /*
index 4b5a13f..951fbf6 100644 (file)
@@ -101,7 +101,7 @@ $(obj)/piggy.o:  $(obj)/piggy.gz FORCE
 CFLAGS_font.o := -Dstatic=
 $(obj)/font.o: $(FONTC)
 
-$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm/boot/Makefile .config
+$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
        @sed "$(SEDFLAGS)" < $< > $@
 
 $(obj)/misc.o: $(obj)/misc.c include/asm/arch/uncompress.h lib/inflate.c
index e483bc9..7fe5c2d 100644 (file)
@@ -952,7 +952,7 @@ __dabt_svc: sub     sp, sp, #S_FRAME_SIZE
                bl      do_DataAbort
                disable_irq r0
                ldr     r0, [sp, #S_PSR]
-               msr     spsr, r0
+               msr     spsr_cxsf, r0
                ldmia   sp, {r0 - pc}^                  @ load r0 - pc, cpsr
 
                .align  5
@@ -988,7 +988,7 @@ preempt_return:
                strne   r0, [r0, -r0]                   @ bug()
 #endif
                ldr     r0, [sp, #S_PSR]                @ irqs are already disabled
-               msr     spsr, r0
+               msr     spsr_cxsf, r0
                ldmia   sp, {r0 - pc}^                  @ load r0 - pc, cpsr
 
                .ltorg
@@ -1031,7 +1031,7 @@ __und_svc:        sub     sp, sp, #S_FRAME_SIZE
 
 1:             disable_irq r0
                ldr     lr, [sp, #S_PSR]                @ Get SVC cpsr
-               msr     spsr, lr
+               msr     spsr_cxsf, lr
                ldmia   sp, {r0 - pc}^                  @ Restore SVC registers
 
                .align  5
@@ -1052,7 +1052,7 @@ __pabt_svc:       sub     sp, sp, #S_FRAME_SIZE
                bl      do_PrefetchAbort                @ call abort handler
                disable_irq r0
                ldr     r0, [sp, #S_PSR]
-               msr     spsr, r0
+               msr     spsr_cxsf, r0
                ldmia   sp, {r0 - pc}^                  @ load r0 - pc, cpsr
 
                .align  5
@@ -1303,7 +1303,7 @@ vector_IRQ:       @
                mrs     r13, cpsr
                bic     r13, r13, #MODE_MASK
                orr     r13, r13, #MODE_SVC
-               msr     spsr, r13                       @ switch to SVC_32 mode
+               msr     spsr_cxsf, r13                  @ switch to SVC_32 mode
 
                and     lr, lr, #15
                ldr     lr, [pc, lr, lsl #2]
@@ -1346,7 +1346,7 @@ vector_data:      @
                mrs     r13, cpsr
                bic     r13, r13, #MODE_MASK
                orr     r13, r13, #MODE_SVC
-               msr     spsr, r13                       @ switch to SVC_32 mode
+               msr     spsr_cxsf, r13                  @ switch to SVC_32 mode
 
                and     lr, lr, #15
                ldr     lr, [pc, lr, lsl #2]
@@ -1390,7 +1390,7 @@ vector_prefetch:
                mrs     r13, cpsr
                bic     r13, r13, #MODE_MASK
                orr     r13, r13, #MODE_SVC
-               msr     spsr, r13                       @ switch to SVC_32 mode
+               msr     spsr_cxsf, r13                  @ switch to SVC_32 mode
 
                ands    lr, lr, #15
                ldr     lr, [pc, lr, lsl #2]
@@ -1433,7 +1433,7 @@ vector_undefinstr:
                mrs     r13, cpsr
                bic     r13, r13, #MODE_MASK
                orr     r13, r13, #MODE_SVC
-               msr     spsr, r13                       @ switch to SVC_32 mode
+               msr     spsr_cxsf, r13                  @ switch to SVC_32 mode
 
                and     lr, lr, #15
                ldr     lr, [pc, lr, lsl #2]
index 4bcf7f6..d99255a 100644 (file)
@@ -485,7 +485,7 @@ void ptrace_break(struct task_struct *tsk, struct pt_regs *regs)
        info.si_signo = SIGTRAP;
        info.si_errno = 0;
        info.si_code  = TRAP_BRKPT;
-       info.si_addr  = (void *)instruction_pointer(regs);
+       info.si_addr  = (void __user *)instruction_pointer(regs);
 
        force_sig_info(SIGTRAP, &info, tsk);
 }
index 4aef808..d214e8d 100644 (file)
@@ -419,7 +419,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
        __put_user_error(NULL, &frame->uc.uc_link, err);
 
        memset(&stack, 0, sizeof(stack));
-       stack.ss_sp = (void *)current->sas_ss_sp;
+       stack.ss_sp = (void __user *)current->sas_ss_sp;
        stack.ss_flags = sas_ss_flags(regs->ARM_sp);
        stack.ss_size = current->sas_ss_size;
        err |= __copy_to_user(&frame->uc.uc_stack, &stack, sizeof(stack));
index 79acdd1..fb26b3b 100644 (file)
@@ -178,7 +178,7 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third,
                union semun fourth;
                if (!ptr)
                        return -EINVAL;
-               if (get_user(fourth.__pad, (void __user **) ptr))
+               if (get_user(fourth.__pad, (void __user * __user *) ptr))
                        return -EFAULT;
                return sys_semctl (first, second, third, fourth);
        }
index 5b21d20..e5c7f28 100644 (file)
@@ -263,7 +263,7 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
        unsigned int instr;
        struct undef_hook *hook;
        siginfo_t info;
-       void *pc;
+       void __user *pc;
 
        /*
         * According to the ARM ARM, PC is 2 or 4 bytes ahead,
@@ -272,11 +272,11 @@ asmlinkage void do_undefinstr(struct pt_regs *regs)
         */
        regs->ARM_pc -= correction;
 
-       pc = (void *)instruction_pointer(regs);
+       pc = (void __user *)instruction_pointer(regs);
        if (thumb_mode(regs)) {
-               get_user(instr, (u16 *)pc);
+               get_user(instr, (u16 __user *)pc);
        } else {
-               get_user(instr, (u32 *)pc);
+               get_user(instr, (u32 __user *)pc);
        }
 
        spin_lock_irq(&undef_lock);
@@ -368,7 +368,7 @@ static int bad_syscall(int n, struct pt_regs *regs)
        info.si_signo = SIGILL;
        info.si_errno = 0;
        info.si_code  = ILL_ILLTRP;
-       info.si_addr  = (void *)instruction_pointer(regs) -
+       info.si_addr  = (void __user *)instruction_pointer(regs) -
                         (thumb_mode(regs) ? 2 : 4);
 
        force_sig_info(SIGILL, &info, current);
@@ -481,7 +481,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
        info.si_signo = SIGILL;
        info.si_errno = 0;
        info.si_code  = ILL_ILLTRP;
-       info.si_addr  = (void *)instruction_pointer(regs) -
+       info.si_addr  = (void __user *)instruction_pointer(regs) -
                         (thumb_mode(regs) ? 2 : 4);
 
        force_sig_info(SIGILL, &info, current);
@@ -519,7 +519,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
        info.si_signo = SIGILL;
        info.si_errno = 0;
        info.si_code  = ILL_ILLOPC;
-       info.si_addr  = (void *)addr;
+       info.si_addr  = (void __user *)addr;
 
        force_sig_info(SIGILL, &info, current);
        die_if_kernel("unknown data abort code", regs, instr);
index 6b361f7..e90512d 100644 (file)
@@ -4,11 +4,10 @@
 
 # Object file lists.
 
-obj-y                  := fiq.o time.o
-# generic.o
+obj-y                  := time.o
 obj-$(CONFIG_MACH_KEV7A400) += arch-kev7a400.o irq-lh7a400.o
-obj-$(CONFIG_MACH_LPD7A400) += arch-lpd7a40x.o ide-lpd7a40x.o irq-lh7a400.o
-obj-$(CONFIG_MACH_LPD7A404) += arch-lpd7a40x.o ide-lpd7a40x.o irq-lh7a404.o
+obj-$(CONFIG_MACH_LPD7A400) += arch-lpd7a40x.o irq-lh7a400.o
+obj-$(CONFIG_MACH_LPD7A404) += arch-lpd7a40x.o irq-lh7a404.o
 
 obj-m                  :=
 obj-n                  :=
index 33eb4b8..9e0bf6c 100644 (file)
@@ -265,6 +265,7 @@ lpd7a400_map_io(void)
 #ifdef CONFIG_MACH_LPD7A400
 
 extern void lh7a400_init_irq (void);
+extern void lh7a40x_init_time (void);
 
 MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10")
        MAINTAINER ("Marc Singer")
@@ -272,6 +273,7 @@ MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10")
        BOOT_PARAMS (0xc0000100)
        MAPIO (lpd7a400_map_io)
        INITIRQ (lh7a400_init_irq)
+       INITTIME (lh7a40x_init_time)
        INIT_MACHINE (lpd7a40x_init)
 MACHINE_END
 
diff --git a/arch/arm/mach-lh7a40x/fiq.S b/arch/arm/mach-lh7a40x/fiq.S
deleted file mode 100644 (file)
index fefedf8..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  linux/arch/arm/lib/lh7a400-fiqhandler.S
- *     Copyright (C) 2002, Lineo, Inc.
- *  based on  linux/arch/arm/lib/floppydma.S, which is
- *      Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-       .text
-
-       .global fiqhandler_end
-
-       @ register usage:
-       @        r8  &interrupt controller registers
-       @        r9  &gpio registers
-       @       r11  work
-       @       r12  work
-
-ENTRY(fiqhandler)
-
-       @ read the status register to find out which FIQ this is
-
-       ldr     r12, [r8]               @ intc->status
-       and     r12, r12, #0xf          @ only interested in low-order 4 bits
-
-       @ translate FIQ 0:3 to IRQ 23:26
-       @ disable this FIQ and enable the corresponding IRQ
-
-       str     r12, [r8, #0xc]         @ disable this FIQ
-       mov     r12, r12, lsl #23       @ get the corresopnding IRQ bit
-       str     r12, [r8, #0x8]         @ enable that IRQ
-
-       subs    pc, lr, #4
-fiqhandler_end:
-
diff --git a/arch/arm/mach-lh7a40x/ide-lpd7a40x.c b/arch/arm/mach-lh7a40x/ide-lpd7a40x.c
deleted file mode 100644 (file)
index fedca41..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/* arch/arm/mach-lh7a40x/ide-lpd7a40x.c
- *
- *  Copyright (C) 2004 Logic Product Development
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  version 2 as published by the Free Software Foundation.
- *
- */
-
-
-#include <linux/config.h>
-#include <linux/ide.h>
-
-#include <asm/io.h>
-
-#define IOBARRIER_READ         readl (IOBARRIER_VIRT)
-
-static u8 lpd7a40x_ide_inb (unsigned long port)
-{
-       u16 v = (u16) readw (port & ~0x1);
-       IOBARRIER_READ;
-       if (port & 0x1)
-               v >>= 8;
-       return v & 0xff;
-}
-
-static u16 lpd7a40x_ide_inw (unsigned long port)
-{
-       u16 v = (u16) readw (port);
-       IOBARRIER_READ;
-       return v;
-}
-
-static void lpd7a40x_ide_insw (unsigned long port, void *addr, u32 count)
-{
-       while (count--) {
-               *((u16*) addr)++ = (u16) readw (port);
-               IOBARRIER_READ;
-       }
-}
-
-static u32 lpd7a40x_ide_inl (unsigned long port)
-{
-       u32 v = (u16) readw (port);
-       IOBARRIER_READ;
-       v |= (u16) readw (port + 2);
-       IOBARRIER_READ;
-
-       return v;
-}
-
-static void lpd7a40x_ide_insl (unsigned long port, void *addr, u32 count)
-{
-       while (count--) {
-               *((u16*) addr)++ = (u16) readw (port);
-               IOBARRIER_READ;
-               *((u16*) addr)++ = (u16) readw (port + 2);
-               IOBARRIER_READ;
-       }
-}
-
-/* lpd7a40x_ide_outb -- this function is complicated by the fact that
- * the user wants to be able to do byte IO and the hardware cannot.
- * In order to write the high byte, we need to write a short.  So, we
- * read before writing in order to maintain the register values that
- * shouldn't change.  This isn't a good idea for the data IO registers
- * since reading from them will not return the current value.  We
- * expect that this function handles the control register adequately.
-*/
-
-static void lpd7a40x_ide_outb (u8 valueUser, unsigned long port)
-{
-       /* Block writes to SELECT register.  Draconian, but the only
-        * way to cope with this hardware configuration without
-        * modifying the SELECT_DRIVE call in the ide driver. */
-       if ((port & 0xf) == 0x6)
-               return;
-
-       if (port & 0x1) {       /* Perform read before write.  Only
-                                * the COMMAND register needs
-                                * this.  */
-               u16 value = (u16) readw (port & ~0x1);
-               IOBARRIER_READ;
-               value = (value & 0x00ff) | (valueUser << 8);
-               writew (value, port & ~0x1);
-               IOBARRIER_READ;
-       }
-       else {                  /* Allow low-byte writes which seem to
-                                * be OK. */
-               writeb (valueUser, port);
-               IOBARRIER_READ;
-       }
-}
-
-static void lpd7a40x_ide_outbsync (ide_drive_t *drive, u8 value,
-                                  unsigned long port)
-{
-       lpd7a40x_ide_outb (value, port);
-}
-
-static void lpd7a40x_ide_outw (u16 value, unsigned long port)
-{
-       writew (value, port);
-       IOBARRIER_READ;
-}
-
-static void lpd7a40x_ide_outsw (unsigned long port, void *addr, u32 count)
-{
-       while (count-- > 0) {
-               writew (*((u16*) addr)++, port);
-               IOBARRIER_READ;
-       }
-}
-
-static void lpd7a40x_ide_outl (u32 value, unsigned long port)
-{
-       writel (value, port);
-       IOBARRIER_READ;
-}
-
-static void lpd7a40x_ide_outsl (unsigned long port, void *addr, u32 count)
-{
-       while (count-- > 0) {
-               writel (*((u32*) addr)++, port);
-               IOBARRIER_READ;
-       }
-}
-
-void lpd7a40x_SELECT_DRIVE (ide_drive_t *drive)
-{
-       unsigned jifStart = jiffies;
-#define WAIT_TIME      (30*HZ/1000)
-
-       /* Check for readiness. */
-       while ((HWIF(drive)->INB(IDE_STATUS_REG) & 0x40) == 0)
-               if (jifStart <= jiffies + WAIT_TIME)
-                       return;
-
-       /* Only allow one drive.
-          For more information, see Documentation/arm/Sharp-LH/ */
-       if (drive->select.all & (1<<4))
-               return;
-
-       /* OUTW so that the IDLE_IMMEDIATE (and not NOP) command is sent. */
-       HWIF(drive)->OUTW(drive->select.all | 0xe100, IDE_SELECT_REG);
-}
-
-void lpd7a40x_hwif_ioops (ide_hwif_t *hwif)
-{
-       hwif->mmio      = 2;    /* Just for show */
-       hwif->irq       = IDE_NO_IRQ;   /* Stop this probing */
-
-       hwif->OUTB      = lpd7a40x_ide_outb;
-       hwif->OUTBSYNC  = lpd7a40x_ide_outbsync;
-       hwif->OUTW      = lpd7a40x_ide_outw;
-       hwif->OUTL      = lpd7a40x_ide_outl;
-       hwif->OUTSW     = lpd7a40x_ide_outsw;
-       hwif->OUTSL     = lpd7a40x_ide_outsl;
-       hwif->INB       = lpd7a40x_ide_inb;
-       hwif->INW       = lpd7a40x_ide_inw;
-       hwif->INL       = lpd7a40x_ide_inl;
-       hwif->INSW      = lpd7a40x_ide_insw;
-       hwif->INSL      = lpd7a40x_ide_insl;
-       hwif->selectproc = lpd7a40x_SELECT_DRIVE;
-}
index b71f89e..40e78bc 100644 (file)
@@ -23,9 +23,12 @@ config ARCH_SMDK2410
            <http://www.fsforth.de>
 
 config MACH_VR1000
-       bool "Simtec VR1000"
+       bool "Thorcom VR1000"
        help
-         Say Y here if you are using the Simtec VR1000 board.
+         Say Y here if you are using the Thorcom VR1000 board.
+
+         This linux port is currently being maintained by Simtec, on behalf
+         of Thorcom. Any queries, please contact Thorcom first.
 
 endmenu
 
index d183de7..476c6ca 100644 (file)
@@ -4,7 +4,7 @@
 
 # Object file lists.
 
-obj-y                  := s3c2410.o irq.o time.o
+obj-y                  := s3c2410.o irq.o time.o gpio.o
 obj-m                  :=
 obj-n                  :=
 obj-                   :=
index f3515bc..0a9ba13 100644 (file)
@@ -52,7 +52,7 @@ static struct s3c2410_uartcfg ipaq_uartcfgs[] = {
        [0] = {
                .hwport      = 0,
                .flags       = 0,
-               .clock       = &s3c2410_hclk,
+               .clock       = &s3c2410_pclk,
                .ucon        = 0x3c5,
                .ulcon       = 0x03,
                .ufcon       = 0x51,
@@ -60,7 +60,7 @@ static struct s3c2410_uartcfg ipaq_uartcfgs[] = {
        [1] = {
                .hwport      = 1,
                .flags       = 0,
-               .clock       = &s3c2410_hclk,
+               .clock       = &s3c2410_pclk,
                .ucon        = 0x245,
                .ulcon       = 0x03,
                .ufcon       = 0x00,
@@ -69,7 +69,7 @@ static struct s3c2410_uartcfg ipaq_uartcfgs[] = {
        [2] = {
                .hwport      = 2,
                .flags       = 0,
-               .clock       = &s3c2410_hclk,
+               .clock       = &s3c2410_pclk,
                .ucon        = 0x3c5,
                .ulcon       = 0x43,
                .ufcon       = 0x51,
index 2246a30..aae341c 100644 (file)
@@ -11,6 +11,7 @@
  * published by the Free Software Foundation.
  *
  * Modifications:
+ *     06-Aug-2004 BJD  Fixed call to time initialisation
  *     12-Jul-2004 BJD  Renamed machine
  *     16-May-2003 BJD  Created initial version
  *     16-Aug-2003 BJD  Fixed header files and copyright, added URL
@@ -159,7 +160,7 @@ void __init vr1000_init_irq(void)
 
 void __init vr1000_init_time(void)
 {
-       s3c2401_init_time();
+       s3c2410_init_time();
 }
 
 MACHINE_START(VR1000, "Thorcom-VR1000")
index 5ff1320..862a7c8 100644 (file)
@@ -4,5 +4,5 @@ extern void s3c2410_map_io(struct map_desc *, int count);
 
 extern void s3c2410_init_irq(void);
 
-extern s3c2410_init_time(void);
+extern void s3c2410_init_time(void);
 
index 9982c4c..806c6ee 100644 (file)
@@ -130,6 +130,7 @@ static struct undef_hook blockops_hook __initdata = {
 static int __init blockops_check(void)
 {
        register unsigned int err asm("r4") = 0;
+       unsigned int err_pos = 1;
        unsigned int cache_type;
        int i;
 
@@ -156,8 +157,8 @@ static int __init blockops_check(void)
 
        unregister_undef_hook(&blockops_hook);
 
-       for (i = 0; i < ARRAY_SIZE(func); i++, err >>= 1)
-               printk("%30s: %ssupported\n", func[i], err & 1 ? "not " : "");
+       for (i = 0; i < ARRAY_SIZE(func); i++, err_pos <<= 1)
+               printk("%30s: %ssupported\n", func[i], err & err_pos ? "not " : "");
 
        if ((err & 8) == 0) {
                printk(" --> Using %s block cache invalidate\n",
index c183e65..060fea2 100644 (file)
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#ifdef CONFIG_CPU_32
-#define TABLE_OFFSET   (PTRS_PER_PTE)
-#else
-#define TABLE_OFFSET   0
-#endif
-
-#define TABLE_SIZE     ((TABLE_OFFSET + PTRS_PER_PTE) * sizeof(pte_t))
+#define TABLE_SIZE     (2 * PTRS_PER_PTE * sizeof(pte_t))
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -289,14 +283,13 @@ static __init void reserve_node_zero(unsigned int bootmap_pfn, unsigned int boot
         */
        reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
 
-#ifdef CONFIG_CPU_32
        /*
         * Reserve the page tables.  These are already in use,
         * and can only be in node 0.
         */
        reserve_bootmem_node(pgdat, __pa(swapper_pg_dir),
                             PTRS_PER_PGD * sizeof(pgd_t));
-#endif
+
        /*
         * And don't forget to reserve the allocator bitmap,
         * which will be freed later.
@@ -502,7 +495,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
                 */
                arch_adjust_zones(node, zone_size, zhole_size);
 
-               free_area_init_node(node, pgdat, 0, zone_size,
+               free_area_init_node(node, pgdat, NULL, zone_size,
                                bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
        }
 
index 9d40dd3..2a3411e 100644 (file)
@@ -230,7 +230,6 @@ CONFIG_INET=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 0cef3f9..32c9c98 100644 (file)
@@ -323,7 +323,6 @@ CONFIG_NETFILTER=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 7cfc154..acecbae 100644 (file)
@@ -104,7 +104,8 @@ head-y := arch/i386/kernel/head.o arch/i386/kernel/init_task.o
 libs-y                                         += arch/i386/lib/
 core-y                                 += arch/i386/kernel/ \
                                           arch/i386/mm/ \
-                                          arch/i386/$(mcore-y)/
+                                          arch/i386/$(mcore-y)/ \
+                                          arch/i386/crypto/
 drivers-$(CONFIG_MATH_EMULATION)       += arch/i386/math-emu/
 drivers-$(CONFIG_PCI)                  += arch/i386/pci/
 # must be linked after kernel/
diff --git a/arch/i386/boot98/compressed/Makefile b/arch/i386/boot98/compressed/Makefile
deleted file mode 100644 (file)
index 258ea95..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# linux/arch/i386/boot/compressed/Makefile
-#
-# create a compressed vmlinux image from the original vmlinux
-#
-
-targets                := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o
-EXTRA_AFLAGS   := -traditional
-
-LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -e startup_32
-
-$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE
-       $(call if_changed,ld)
-       @:
-
-$(obj)/vmlinux.bin: vmlinux FORCE
-       $(call if_changed,objcopy)
-
-$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
-       $(call if_changed,gzip)
-
-LDFLAGS_piggy.o := -r --format binary --oformat elf32-i386 -T
-
-$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.gz FORCE
-       $(call if_changed,ld)
diff --git a/arch/i386/boot98/compressed/head.S b/arch/i386/boot98/compressed/head.S
deleted file mode 100644 (file)
index c5e80b6..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- *  linux/boot/head.S
- *
- *  Copyright (C) 1991, 1992, 1993  Linus Torvalds
- */
-
-/*
- *  head.S contains the 32-bit startup code.
- *
- * NOTE!!! Startup happens at absolute address 0x00001000, which is also where
- * the page directory will exist. The startup code will be overwritten by
- * the page directory. [According to comments etc elsewhere on a compressed
- * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC]
- *
- * Page 0 is deliberately kept safe, since System Management Mode code in 
- * laptops may need to access the BIOS data stored there.  This is also
- * useful for future device drivers that either access the BIOS via VM86 
- * mode.
- */
-
-/*
- * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
- */
-.text
-
-#include <linux/linkage.h>
-#include <asm/segment.h>
-
-       .globl startup_32
-       
-startup_32:
-       cld
-       cli
-       movl $(__BOOT_DS),%eax
-       movl %eax,%ds
-       movl %eax,%es
-       movl %eax,%fs
-       movl %eax,%gs
-
-       lss stack_start,%esp
-       xorl %eax,%eax
-1:     incl %eax               # check that A20 really IS enabled
-       movl %eax,0x000000      # loop forever if it isn't
-       cmpl %eax,0x100000
-       je 1b
-
-/*
- * Initialize eflags.  Some BIOS's leave bits like NT set.  This would
- * confuse the debugger if this code is traced.
- * XXX - best to initialize before switching to protected mode.
- */
-       pushl $0
-       popfl
-/*
- * Clear BSS
- */
-       xorl %eax,%eax
-       movl $_edata,%edi
-       movl $_end,%ecx
-       subl %edi,%ecx
-       cld
-       rep
-       stosb
-/*
- * Do the decompression, and jump to the new kernel..
- */
-       subl $16,%esp   # place for structure on the stack
-       movl %esp,%eax
-       pushl %esi      # real mode pointer as second arg
-       pushl %eax      # address of structure as first arg
-       call decompress_kernel
-       orl  %eax,%eax 
-       jnz  3f
-       popl %esi       # discard address
-       popl %esi       # real mode pointer
-       xorl %ebx,%ebx
-       ljmp $(__BOOT_CS), $0x100000
-
-/*
- * We come here, if we were loaded high.
- * We need to move the move-in-place routine down to 0x1000
- * and then start it with the buffer addresses in registers,
- * which we got from the stack.
- */
-3:
-       movl $move_routine_start,%esi
-       movl $0x1000,%edi
-       movl $move_routine_end,%ecx
-       subl %esi,%ecx
-       addl $3,%ecx
-       shrl $2,%ecx
-       cld
-       rep
-       movsl
-
-       popl %esi       # discard the address
-       popl %ebx       # real mode pointer
-       popl %esi       # low_buffer_start
-       popl %ecx       # lcount
-       popl %edx       # high_buffer_start
-       popl %eax       # hcount
-       movl $0x100000,%edi
-       cli             # make sure we don't get interrupted
-       ljmp $(__BOOT_CS), $0x1000 # and jump to the move routine
-
-/*
- * Routine (template) for moving the decompressed kernel in place,
- * if we were high loaded. This _must_ PIC-code !
- */
-move_routine_start:
-       movl %ecx,%ebp
-       shrl $2,%ecx
-       rep
-       movsl
-       movl %ebp,%ecx
-       andl $3,%ecx
-       rep
-       movsb
-       movl %edx,%esi
-       movl %eax,%ecx  # NOTE: rep movsb won't move if %ecx == 0
-       addl $3,%ecx
-       shrl $2,%ecx
-       rep
-       movsl
-       movl %ebx,%esi  # Restore setup pointer
-       xorl %ebx,%ebx
-       ljmp $(__BOOT_CS), $0x100000
-move_routine_end:
diff --git a/arch/i386/boot98/compressed/misc.c b/arch/i386/boot98/compressed/misc.c
deleted file mode 100644 (file)
index 5574009..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * misc.c
- * 
- * This is a collection of several routines from gzip-1.0.3 
- * adapted for Linux.
- *
- * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
- * puts by Nick Holloway 1993, better puts by Martin Mares 1995
- * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
- */
-
-#include <linux/linkage.h>
-#include <linux/vmalloc.h>
-#include <linux/tty.h>
-#include <asm/io.h>
-#ifdef STANDARD_MEMORY_BIOS_CALL
-#undef STANDARD_MEMORY_BIOS_CALL
-#endif
-
-/*
- * gzip declarations
- */
-
-#define OF(args)  args
-#define STATIC static
-
-#undef memset
-#undef memcpy
-
-/*
- * Why do we do this? Don't ask me..
- *
- * Incomprehensible are the ways of bootloaders.
- */
-static void* memset(void *, int, size_t);
-static void* memcpy(void *, __const void *, size_t);
-#define memzero(s, n)     memset ((s), 0, (n))
-
-typedef unsigned char  uch;
-typedef unsigned short ush;
-typedef unsigned long  ulg;
-
-#define WSIZE 0x8000           /* Window size must be at least 32k, */
-                               /* and a power of two */
-
-static uch *inbuf;          /* input buffer */
-static uch window[WSIZE];    /* Sliding window buffer */
-
-static unsigned insize = 0;  /* valid bytes in inbuf */
-static unsigned inptr = 0;   /* index of next byte to be processed in inbuf */
-static unsigned outcnt = 0;  /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG   0x01 /* bit 0 set: file probably ASCII text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define COMMENT      0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
-#define RESERVED     0xC0 /* bit 6,7:   reserved */
-
-#define get_byte()  (inptr < insize ? inbuf[inptr++] : fill_inbuf())
-               
-/* Diagnostic functions */
-#ifdef DEBUG
-#  define Assert(cond,msg) {if(!(cond)) error(msg);}
-#  define Trace(x) fprintf x
-#  define Tracev(x) {if (verbose) fprintf x ;}
-#  define Tracevv(x) {if (verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
-#else
-#  define Assert(cond,msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c,x)
-#  define Tracecv(c,x)
-#endif
-
-static int  fill_inbuf(void);
-static void flush_window(void);
-static void error(char *m);
-static void gzip_mark(void **);
-static void gzip_release(void **);
-  
-/*
- * This is set up by the setup-routine at boot-time
- */
-static unsigned char *real_mode; /* Pointer to real-mode data */
-
-#define EXT_MEM_K   (*(unsigned short *)(real_mode + 0x2))
-#ifndef STANDARD_MEMORY_BIOS_CALL
-#define ALT_MEM_K   (*(unsigned long *)(real_mode + 0x1e0))
-#endif
-#define SCREEN_INFO (*(struct screen_info *)(real_mode+0))
-
-extern char input_data[];
-extern int input_len;
-
-static long bytes_out = 0;
-static uch *output_data;
-static unsigned long output_ptr = 0;
-
-static void *malloc(int size);
-static void free(void *where);
-
-static void puts(const char *);
-
-extern int end;
-static long free_mem_ptr = (long)&end;
-static long free_mem_end_ptr;
-
-#define INPLACE_MOVE_ROUTINE  0x1000
-#define LOW_BUFFER_START      0x2000
-#define LOW_BUFFER_MAX       0x90000
-#define HEAP_SIZE             0x3000
-static unsigned int low_buffer_end, low_buffer_size;
-static int high_loaded =0;
-static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/;
-
-static char *vidmem = (char *)0xa0000;
-static int lines, cols;
-
-#ifdef CONFIG_X86_NUMAQ
-static void * xquad_portio = NULL;
-#endif
-
-#include "../../../../lib/inflate.c"
-
-static void *malloc(int size)
-{
-       void *p;
-
-       if (size <0) error("Malloc error");
-       if (free_mem_ptr <= 0) error("Memory error");
-
-       free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
-
-       p = (void *)free_mem_ptr;
-       free_mem_ptr += size;
-
-       if (free_mem_ptr >= free_mem_end_ptr)
-               error("Out of memory");
-
-       return p;
-}
-
-static void free(void *where)
-{      /* Don't care */
-}
-
-static void gzip_mark(void **ptr)
-{
-       *ptr = (void *) free_mem_ptr;
-}
-
-static void gzip_release(void **ptr)
-{
-       free_mem_ptr = (long) *ptr;
-}
-static void scroll(void)
-{
-       int i;
-
-       memcpy ( vidmem, vidmem + cols * 2, ( lines - 1 ) * cols * 2 );
-       for ( i = ( lines - 1 ) * cols * 2; i < lines * cols * 2; i += 2 )
-               vidmem[i] = ' ';
-}
-
-static void puts(const char *s)
-{
-       int x,y,pos;
-       char c;
-
-       x = SCREEN_INFO.orig_x;
-       y = SCREEN_INFO.orig_y;
-
-       while ( ( c = *s++ ) != '\0' ) {
-               if ( c == '\n' ) {
-                       x = 0;
-                       if ( ++y >= lines ) {
-                               scroll();
-                               y--;
-                       }
-               } else {
-                       vidmem [ ( x + cols * y ) * 2 ] = c; 
-                       if ( ++x >= cols ) {
-                               x = 0;
-                               if ( ++y >= lines ) {
-                                       scroll();
-                                       y--;
-                               }
-                       }
-               }
-       }
-
-       SCREEN_INFO.orig_x = x;
-       SCREEN_INFO.orig_y = y;
-
-       pos = x + cols * y;     /* Update cursor position */
-       while (!(inb_p(0x60) & 4));
-       outb_p(0x49, 0x62);
-       outb_p(pos & 0xff, 0x60);
-       outb_p((pos >> 8) & 0xff, 0x60);
-}
-
-static void* memset(void* s, int c, size_t n)
-{
-       int i;
-       char *ss = (char*)s;
-
-       for (i=0;i<n;i++) ss[i] = c;
-       return s;
-}
-
-static void* memcpy(void* __dest, __const void* __src,
-                           size_t __n)
-{
-       int i;
-       char *d = (char *)__dest, *s = (char *)__src;
-
-       for (i=0;i<__n;i++) d[i] = s[i];
-       return __dest;
-}
-
-/* ===========================================================================
- * Fill the input buffer. This is called only when the buffer is empty
- * and at least one byte is really needed.
- */
-static int fill_inbuf(void)
-{
-       if (insize != 0) {
-               error("ran out of input data");
-       }
-
-       inbuf = input_data;
-       insize = input_len;
-       inptr = 1;
-       return inbuf[0];
-}
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-static void flush_window_low(void)
-{
-    ulg c = crc;         /* temporary variable */
-    unsigned n;
-    uch *in, *out, ch;
-    
-    in = window;
-    out = &output_data[output_ptr]; 
-    for (n = 0; n < outcnt; n++) {
-           ch = *out++ = *in++;
-           c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
-    }
-    crc = c;
-    bytes_out += (ulg)outcnt;
-    output_ptr += (ulg)outcnt;
-    outcnt = 0;
-}
-
-static void flush_window_high(void)
-{
-    ulg c = crc;         /* temporary variable */
-    unsigned n;
-    uch *in,  ch;
-    in = window;
-    for (n = 0; n < outcnt; n++) {
-       ch = *output_data++ = *in++;
-       if ((ulg)output_data == low_buffer_end) output_data=high_buffer_start;
-       c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
-    }
-    crc = c;
-    bytes_out += (ulg)outcnt;
-    outcnt = 0;
-}
-
-static void flush_window(void)
-{
-       if (high_loaded) flush_window_high();
-       else flush_window_low();
-}
-
-static void error(char *x)
-{
-       puts("\n\n");
-       puts(x);
-       puts("\n\n -- System halted");
-
-       while(1);       /* Halt */
-}
-
-#define STACK_SIZE (4096)
-
-long user_stack [STACK_SIZE];
-
-struct {
-       long * a;
-       short b;
-       } stack_start = { & user_stack [STACK_SIZE] , __BOOT_DS };
-
-static void setup_normal_output_buffer(void)
-{
-#ifdef STANDARD_MEMORY_BIOS_CALL
-       if (EXT_MEM_K < 1024) error("Less than 2MB of memory");
-#else
-       if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory");
-#endif
-       output_data = (char *)0x100000; /* Points to 1M */
-       free_mem_end_ptr = (long)real_mode;
-}
-
-struct moveparams {
-       uch *low_buffer_start;  int lcount;
-       uch *high_buffer_start; int hcount;
-};
-
-static void setup_output_buffer_if_we_run_high(struct moveparams *mv)
-{
-       high_buffer_start = (uch *)(((ulg)&end) + HEAP_SIZE);
-#ifdef STANDARD_MEMORY_BIOS_CALL
-       if (EXT_MEM_K < (3*1024)) error("Less than 4MB of memory");
-#else
-       if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory");
-#endif 
-       mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
-       low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
-         ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff;
-       low_buffer_size = low_buffer_end - LOW_BUFFER_START;
-       high_loaded = 1;
-       free_mem_end_ptr = (long)high_buffer_start;
-       if ( (0x100000 + low_buffer_size) > ((ulg)high_buffer_start)) {
-               high_buffer_start = (uch *)(0x100000 + low_buffer_size);
-               mv->hcount = 0; /* say: we need not to move high_buffer */
-       }
-       else mv->hcount = -1;
-       mv->high_buffer_start = high_buffer_start;
-}
-
-static void close_output_buffer_if_we_run_high(struct moveparams *mv)
-{
-       if (bytes_out > low_buffer_size) {
-               mv->lcount = low_buffer_size;
-               if (mv->hcount)
-                       mv->hcount = bytes_out - low_buffer_size;
-       } else {
-               mv->lcount = bytes_out;
-               mv->hcount = 0;
-       }
-}
-
-
-asmlinkage int decompress_kernel(struct moveparams *mv, void *rmode)
-{
-       real_mode = rmode;
-
-       vidmem = (char *)(((unsigned int)SCREEN_INFO.orig_video_page) << 4);
-
-       lines = SCREEN_INFO.orig_video_lines;
-       cols = SCREEN_INFO.orig_video_cols;
-
-       if (free_mem_ptr < 0x100000) setup_normal_output_buffer();
-       else setup_output_buffer_if_we_run_high(mv);
-
-       makecrc();
-       puts("Uncompressing Linux... ");
-       gunzip();
-       puts("Ok, booting the kernel.\n");
-       if (high_loaded) close_output_buffer_if_we_run_high(mv);
-       return high_loaded;
-}
-
-/* We don't actually check for stack overflows this early. */
-__asm__(".globl mcount ; mcount: ret\n");
-
diff --git a/arch/i386/boot98/compressed/vmlinux.scr b/arch/i386/boot98/compressed/vmlinux.scr
deleted file mode 100644 (file)
index 1ed9d79..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-SECTIONS
-{
-  .data : { 
-       input_len = .;
-       LONG(input_data_end - input_data) input_data = .; 
-       *(.data) 
-       input_data_end = .; 
-       }
-}
diff --git a/arch/i386/boot98/tools/build.c b/arch/i386/boot98/tools/build.c
deleted file mode 100644 (file)
index 9b10395..0000000
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *  $Id: build.c,v 1.5 1997/05/19 12:29:58 mj Exp $
- *
- *  Copyright (C) 1991, 1992  Linus Torvalds
- *  Copyright (C) 1997 Martin Mares
- */
-
-/*
- * This file builds a disk-image from three different files:
- *
- * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest
- * - setup: 8086 machine code, sets up system parm
- * - system: 80386 code for actual system
- *
- * It does some checking that all files are of the correct type, and
- * just writes the result to stdout, removing headers and padding to
- * the right amount. It also writes some system data to stderr.
- */
-
-/*
- * Changes by tytso to allow root device specification
- * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
- * Cross compiling fixes by Gertjan van Wingerde, July 1996
- * Rewritten by Martin Mares, April 1997
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/sysmacros.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <asm/boot.h>
-
-typedef unsigned char byte;
-typedef unsigned short word;
-typedef unsigned long u32;
-
-#define DEFAULT_MAJOR_ROOT 0
-#define DEFAULT_MINOR_ROOT 0
-
-/* Minimal number of setup sectors (see also bootsect.S) */
-#define SETUP_SECTS 4
-
-byte buf[1024];
-int fd;
-int is_big_kernel;
-
-void die(const char * str, ...)
-{
-       va_list args;
-       va_start(args, str);
-       vfprintf(stderr, str, args);
-       fputc('\n', stderr);
-       exit(1);
-}
-
-void file_open(const char *name)
-{
-       if ((fd = open(name, O_RDONLY, 0)) < 0)
-               die("Unable to open `%s': %m", name);
-}
-
-void usage(void)
-{
-       die("Usage: build [-b] bootsect setup system [rootdev] [> image]");
-}
-
-int main(int argc, char ** argv)
-{
-       unsigned int i, c, sz, setup_sectors;
-       u32 sys_size;
-       byte major_root, minor_root;
-       struct stat sb;
-
-       if (argc > 2 && !strcmp(argv[1], "-b"))
-         {
-           is_big_kernel = 1;
-           argc--, argv++;
-         }
-       if ((argc < 4) || (argc > 5))
-               usage();
-       if (argc > 4) {
-               if (!strcmp(argv[4], "CURRENT")) {
-                       if (stat("/", &sb)) {
-                               perror("/");
-                               die("Couldn't stat /");
-                       }
-                       major_root = major(sb.st_dev);
-                       minor_root = minor(sb.st_dev);
-               } else if (strcmp(argv[4], "FLOPPY")) {
-                       if (stat(argv[4], &sb)) {
-                               perror(argv[4]);
-                               die("Couldn't stat root device.");
-                       }
-                       major_root = major(sb.st_rdev);
-                       minor_root = minor(sb.st_rdev);
-               } else {
-                       major_root = 0;
-                       minor_root = 0;
-               }
-       } else {
-               major_root = DEFAULT_MAJOR_ROOT;
-               minor_root = DEFAULT_MINOR_ROOT;
-       }
-       fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
-
-       file_open(argv[1]);
-       i = read(fd, buf, sizeof(buf));
-       fprintf(stderr,"Boot sector %d bytes.\n",i);
-       if (i != 512)
-               die("Boot block must be exactly 512 bytes");
-       if (buf[510] != 0x55 || buf[511] != 0xaa)
-               die("Boot block hasn't got boot flag (0xAA55)");
-       buf[508] = minor_root;
-       buf[509] = major_root;
-       if (write(1, buf, 512) != 512)
-               die("Write call failed");
-       close (fd);
-
-       file_open(argv[2]);                                 /* Copy the setup code */
-       for (i=0 ; (c=read(fd, buf, sizeof(buf)))>0 ; i+=c )
-               if (write(1, buf, c) != c)
-                       die("Write call failed");
-       if (c != 0)
-               die("read-error on `setup'");
-       close (fd);
-
-       setup_sectors = (i + 511) / 512;        /* Pad unused space with zeros */
-       if (!(setup_sectors & 1))
-               setup_sectors++;    /* setup_sectors must be odd on NEC PC-9800 */
-       fprintf(stderr, "Setup is %d bytes.\n", i);
-       memset(buf, 0, sizeof(buf));
-       while (i < setup_sectors * 512) {
-               c = setup_sectors * 512 - i;
-               if (c > sizeof(buf))
-                       c = sizeof(buf);
-               if (write(1, buf, c) != c)
-                       die("Write call failed");
-               i += c;
-       }
-
-       file_open(argv[3]);
-       if (fstat (fd, &sb))
-               die("Unable to stat `%s': %m", argv[3]);
-       sz = sb.st_size;
-       fprintf (stderr, "System is %d kB\n", sz/1024);
-       sys_size = (sz + 15) / 16;
-       /* 0x40000*16 = 4.0 MB, reasonable estimate for the current maximum */
-       if (sys_size > (is_big_kernel ? 0x40000 : DEF_SYSSIZE))
-               die("System is too big. Try using %smodules.",
-                       is_big_kernel ? "" : "bzImage or ");
-       while (sz > 0) {
-               int l, n;
-
-               l = (sz > sizeof(buf)) ? sizeof(buf) : sz;
-               if ((n=read(fd, buf, l)) != l) {
-                       if (n < 0)
-                               die("Error reading %s: %m", argv[3]);
-                       else
-                               die("%s: Unexpected EOF", argv[3]);
-               }
-               if (write(1, buf, l) != l)
-                       die("Write failed");
-               sz -= l;
-       }
-       close(fd);
-
-       if (lseek(1, 497, SEEK_SET) != 497)                 /* Write sizes to the bootsector */
-               die("Output: seek failed");
-       buf[0] = setup_sectors;
-       if (write(1, buf, 1) != 1)
-               die("Write of setup sector count failed");
-       if (lseek(1, 500, SEEK_SET) != 500)
-               die("Output: seek failed");
-       buf[0] = (sys_size & 0xff);
-       buf[1] = ((sys_size >> 8) & 0xff);
-       if (write(1, buf, 2) != 2)
-               die("Write of image length failed");
-
-       return 0;                                           /* Everything is OK */
-}
index 061a60f..bb91de3 100644 (file)
@@ -960,7 +960,15 @@ ENTRY(sys_call_table)
        .long sys_madvise
        .long sys_getdents64    /* 220 */
        .long sys_fcntl64
-       .long sys_ni_syscall    /* reserved for TUX */
+#ifdef CONFIG_TUX
+       .long __sys_tux
+#else
+# ifdef CONFIG_TUX_MODULE
+       .long sys_tux
+# else
+       .long sys_ni_syscall
+# endif
+#endif
        .long sys_ni_syscall
        .long sys_gettid
        .long sys_readahead     /* 225 */
index 7760864..39af35d 100644 (file)
@@ -73,7 +73,7 @@ static struct irq_pin_list {
 } irq_2_pin[PIN_MAP_SIZE];
 
 int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 #define vector_to_irq(vector)  \
        (platform_legacy_irq(vector) ? vector : vector_irq[vector])
 #else
@@ -1114,7 +1114,7 @@ static inline int IO_APIC_irq_trigger(int irq)
 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
 u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 };
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 int assign_irq_vector(int irq)
 #else
 int __init assign_irq_vector(int irq)
@@ -1714,7 +1714,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
                reg_00.raw = io_apic_read(apic, 0);
                spin_unlock_irqrestore(&ioapic_lock, flags);
                if (reg_00.bits.ID != mp_ioapics[apic].mpc_apicid)
-                       panic("could not set ID!\n");
+                       printk("could not set ID!\n");
                else
                        printk(" ok.\n");
        }
@@ -1868,7 +1868,7 @@ static void end_level_ioapic_irq (unsigned int irq)
        }
 }
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 static unsigned int startup_edge_ioapic_vector(unsigned int vector)
 {
        int irq = vector_to_irq(vector);
@@ -2212,7 +2212,7 @@ static inline void check_timer(void)
                return;
        }
        printk(" failed :(.\n");
-       panic("IO-APIC + timer doesn't work! pester mingo@redhat.com");
+       panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
 }
 
 /*
index 9bd3bb1..22f7fc7 100644 (file)
@@ -1095,8 +1095,12 @@ void init_irq_proc (void)
 }
 
 
-static char softirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned")));
-static char hardirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE), __section__(".bss.page_aligned")));
+/*
+ * These should really be __section__(".bss.page_aligned") as well, but
+ * gcc's 3.0 and earlier don't handle that correctly.
+ */
+static char softirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE)));
+static char hardirq_stack[NR_CPUS * THREAD_SIZE]  __attribute__((__aligned__(THREAD_SIZE)));
 
 /*
  * allocate per-cpu stacks for hardirq and for softirq processing
index 1fda8b0..3093d1f 100644 (file)
@@ -828,30 +828,6 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
        return 0;
 }
 
-/*
- * Get a random word:
- */
-static inline unsigned int get_random_int(void)
-{
-       unsigned int val = 0;
-
-       if (!exec_shield_randomize)
-               return 0;
-
-#ifdef CONFIG_X86_HAS_TSC
-       rdtscl(val);
-#endif
-       val += current->pid + jiffies + (int)&val;
-
-       /*
-        * Use IP's RNG. It suits our purpose perfectly: it re-keys itself
-        * every second, from the entropy pool (and thus creates a limited
-        * drain on it), and uses halfMD4Transform within the second. We
-        * also spice it with the TSC (if available), jiffies, PID and the
-        * stack address:
-        */
-       return secure_ip_id(val);
-}
 
 unsigned long arch_align_stack(unsigned long sp)
 {
@@ -860,201 +836,6 @@ unsigned long arch_align_stack(unsigned long sp)
        return sp & ~0xf;
 }
 
-#if SHLIB_BASE >= 0x01000000
-# error SHLIB_BASE must be under 16MB!
-#endif
-
-static unsigned long
-arch_get_unmapped_nonexecutable_area(struct mm_struct *mm, unsigned long addr, unsigned long len)
-{
-       struct vm_area_struct *vma, *prev_vma;
-       unsigned long stack_limit;
-       int first_time = 1;     
-
-       if (!mm->mmap_top) {
-               printk("hm, %s:%d, !mmap_top.\n", current->comm, current->pid);
-               mm->mmap_top = mmap_top();
-       }
-       stack_limit = mm->mmap_top;
-
-       /* requested length too big for entire address space */
-       if (len > TASK_SIZE) 
-               return -ENOMEM;
-
-       /* dont allow allocations above current stack limit */
-       if (mm->non_executable_cache > stack_limit)
-               mm->non_executable_cache = stack_limit;
-
-       /* requesting a specific address */
-        if (addr) {
-                addr = PAGE_ALIGN(addr);
-                vma = find_vma(mm, addr);
-               if (TASK_SIZE - len >= addr && 
-                   (!vma || addr + len <= vma->vm_start))
-                       return addr;
-        }
-
-       /* make sure it can fit in the remaining address space */
-       if (mm->non_executable_cache < len)
-               return -ENOMEM;
-
-       /* either no address requested or cant fit in requested address hole */
-try_again:
-        addr = (mm->non_executable_cache - len)&PAGE_MASK;
-       do {
-                       if (!(vma = find_vma_prev(mm, addr, &prev_vma)))
-                        return -ENOMEM;
-
-               /* new region fits between prev_vma->vm_end and vma->vm_start, use it */
-               if (addr+len <= vma->vm_start && (!prev_vma || (addr >= prev_vma->vm_end))) {
-                       /* remember the address as a hint for next time */
-                       mm->non_executable_cache = addr;
-                       return addr;
-
-               /* pull non_executable_cache down to the first hole */
-               } else if (mm->non_executable_cache == vma->vm_end)
-                               mm->non_executable_cache = vma->vm_start;       
-
-               /* try just below the current vma->vm_start */
-               addr = vma->vm_start-len;
-        } while (len <= vma->vm_start);
-       /* if hint left us with no space for the requested mapping try again */
-       if (first_time) {
-               first_time = 0;
-               mm->non_executable_cache = stack_limit;
-               goto try_again;
-       }
-       return -ENOMEM;
-}
-
-static unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len)
-{
-       unsigned long range = end - len - start;
-       if (end <= start + len)
-               return 0;
-       return PAGE_ALIGN(get_random_int() % range + start);
-}
-
-static inline unsigned long
-stock_arch_get_unmapped_area(struct file *filp, unsigned long addr,
-               unsigned long len, unsigned long pgoff, unsigned long flags)
-{
-       struct mm_struct *mm = current->mm;
-       struct vm_area_struct *vma;
-       unsigned long start_addr;
-
-       if (len > TASK_SIZE)
-               return -ENOMEM;
-
-       if (addr) {
-               addr = PAGE_ALIGN(addr);
-               vma = find_vma(mm, addr);
-               if (TASK_SIZE - len >= addr &&
-                   (!vma || addr + len <= vma->vm_start))
-                       return addr;
-       }
-       start_addr = addr = mm->free_area_cache;
-
-full_search:
-       for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
-               /* At this point:  (!vma || addr < vma->vm_end). */
-               if (TASK_SIZE - len < addr) {
-                       /*
-                        * Start a new search - just in case we missed
-                        * some holes.
-                        */
-                       if (start_addr != TASK_UNMAPPED_BASE) {
-                               start_addr = addr = TASK_UNMAPPED_BASE;
-                               goto full_search;
-                       }
-                       return -ENOMEM;
-               }
-               if (!vma || addr + len <= vma->vm_start) {
-                       /*
-                        * Remember the place where we stopped the search:
-                        */
-                       mm->free_area_cache = addr + len;
-                       return addr;
-               }
-               addr = vma->vm_end;
-       }
-}
-
-unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0,
-               unsigned long len0, unsigned long pgoff, unsigned long flags,
-               unsigned long prot)
-{
-       unsigned long addr = addr0, len = len0;
-       struct mm_struct *mm = current->mm;
-       struct vm_area_struct *vma;
-       int ascii_shield = 0;
-       unsigned long tmp;
-
-       /*
-        * Fall back to the old layout:
-        */
-       if (!(current->flags & PF_RELOCEXEC))
-              return stock_arch_get_unmapped_area(filp, addr0, len0, pgoff, flags);
-       if (len > TASK_SIZE)
-               return -ENOMEM;
-
-       if (!addr && (prot & PROT_EXEC) && !(flags & MAP_FIXED))
-               addr = randomize_range(SHLIB_BASE, 0x01000000, len);
-
-       if (addr) {
-               addr = PAGE_ALIGN(addr);
-               vma = find_vma(mm, addr);
-               if (TASK_SIZE - len >= addr &&
-                   (!vma || addr + len <= vma->vm_start)) {
-                       return addr;
-               }
-       }
-
-       if (prot & PROT_EXEC) {
-               ascii_shield = 1;
-               addr = SHLIB_BASE;
-       } else {
-               /* this can fail if the stack was unlimited */
-               if ((tmp = arch_get_unmapped_nonexecutable_area(mm, addr, len)) != -ENOMEM)
-                       return tmp;
-search_upper:
-               addr = PAGE_ALIGN(arch_align_stack(TASK_UNMAPPED_BASE));
-       }
-
-       for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
-               /* At this point:  (!vma || addr < vma->vm_end). */
-               if (TASK_SIZE - len < addr) {
-                       return -ENOMEM;
-               }
-               if (!vma || addr + len <= vma->vm_start) {
-                       /*
-                        * Must not let a PROT_EXEC mapping get into the
-                        * brk area:
-                        */
-                       if (ascii_shield && (addr + len > mm->brk)) {
-                               ascii_shield = 0;
-                               goto search_upper;
-                       }
-                       /*
-                        * Up until the brk area we randomize addresses
-                        * as much as possible:
-                        */
-                       if (ascii_shield && (addr >= 0x01000000)) {
-                               tmp = randomize_range(0x01000000, mm->brk, len);
-                               vma = find_vma(mm, tmp);
-                               if (TASK_SIZE - len >= tmp &&
-                                   (!vma || tmp + len <= vma->vm_start))
-                                       return tmp;
-                       }
-                       /*
-                        * Ok, randomization didnt work out - return
-                        * the result of the linear search:
-                        */
-                       return addr;
-               }
-               addr = vma->vm_end;
-       }
-}
 
 void arch_add_exec_range(struct mm_struct *mm, unsigned long limit)
 {
@@ -1106,25 +887,3 @@ void randomize_brk(unsigned long old_brk)
                current->mm->brk = new_brk;
 }
 
-/*
- * Top of mmap area (just below the process stack).
- * leave an at least ~128 MB hole. Randomize it.
- */
-#define MIN_GAP (128*1024*1024)
-#define MAX_GAP (TASK_SIZE/6*5)
-
-unsigned long mmap_top(void)
-{
-       unsigned long gap = 0;
-
-       gap = current->rlim[RLIMIT_STACK].rlim_cur;
-       if (gap < MIN_GAP)
-               gap = MIN_GAP;
-       else if (gap > MAX_GAP)
-               gap = MAX_GAP;
-
-       gap = arch_align_stack(gap) & PAGE_MASK;
-
-       return TASK_SIZE - gap;
-}
-
index 5b83da1..7cebb68 100644 (file)
@@ -336,7 +336,6 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
    See vsyscall-sigreturn.S.  */
 extern void __user __kernel_sigreturn;
 extern void __user __kernel_rt_sigreturn;
-extern SYSENTER_RETURN;
 
 static void setup_frame(int sig, struct k_sigaction *ka,
                        sigset_t *set, struct pt_regs * regs)
index ce190eb..551e33c 100644 (file)
@@ -150,7 +150,7 @@ asmlinkage int sys_ipc (uint call, int first, int second,
                union semun fourth;
                if (!ptr)
                        return -EINVAL;
-               if (get_user(fourth.__pad, (void * __user *) ptr))
+               if (get_user(fourth.__pad, (void __user * __user *) ptr))
                        return -EFAULT;
                return sys_semctl (first, second, third, fourth);
        }
index 8047133..f936357 100644 (file)
@@ -76,7 +76,7 @@ __initcall(sysenter_setup);
 
 extern void SYSENTER_RETURN_OFFSET;
 
-unsigned int vdso_enabled = 1;
+unsigned int vdso_enabled = 0;
 
 void map_vsyscall(void)
 {
index da76654..6e9ed08 100644 (file)
@@ -513,7 +513,7 @@ static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
 {
        printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n");
        printk("You probably have a hardware problem with your RAM chips\n");
-
+       panic("Halting\n");
        /* Clear and disable the memory parity error line. */
        clear_mem_error(reason);
 }
index f599d85..a22da86 100644 (file)
 #include <linux/kernel.h>
 #include <linux/smp.h>
 #include <linux/init.h>
+#include <linux/dmi.h>
 #include <asm/mach-bigsmp/mach_apic.h>
 #include <asm/mach-bigsmp/mach_apicdef.h>
 #include <asm/mach-bigsmp/mach_ipi.h>
 #include <asm/mach-default/mach_mpparse.h>
 
-int dmi_bigsmp; /* can be set by dmi scanners */
+static int dmi_bigsmp; /* can be set by dmi scanners */
+
+static __init int hp_ht_bigsmp(struct dmi_system_id *d) 
+{ 
+#ifdef CONFIG_X86_GENERICARCH
+       printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
+       dmi_bigsmp = 1;
+#endif
+       return 0;
+} 
+
+
+static struct dmi_system_id __initdata bigsmp_dmi_table[] = {
+       { hp_ht_bigsmp, "HP ProLiant DL760 G2", {
+               DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
+               DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
+       }},
+
+       { hp_ht_bigsmp, "HP ProLiant DL740", {
+               DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
+               DMI_MATCH(DMI_BIOS_VERSION, "P47-"),
+        }},
+        { }     
+};
+
 
 static __init int probe_bigsmp(void)
 { 
+       dmi_check_system(bigsmp_dmi_table);
        return dmi_bigsmp; 
 } 
 
index 87dd63c..fc32725 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the linux i386-specific parts of the memory manager.
 #
 
-obj-y  := init.o pgtable.o fault.o ioremap.o extable.o pageattr.o 
+obj-y  := init.o pgtable.o fault.o ioremap.o extable.o pageattr.o mmap.o
 
 obj-$(CONFIG_DISCONTIGMEM)     += discontig.o
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
index 9eecccc..569e08e 100644 (file)
@@ -448,7 +448,11 @@ void __init set_highmem_pages_init(int bad_ppro)
 void __init set_max_mapnr_init(void)
 {
 #ifdef CONFIG_HIGHMEM
-       highmem_start_page = NODE_DATA(0)->node_zones[ZONE_HIGHMEM].zone_mem_map;
+       struct zone *high0 = &NODE_DATA(0)->node_zones[ZONE_HIGHMEM];
+       if (high0->spanned_pages > 0)
+               highmem_start_page = high0->zone_mem_map;
+       else
+               highmem_start_page = pfn_to_page(max_low_pfn+1); 
        num_physpages = highend_pfn;
 #else
        num_physpages = max_low_pfn;
index 5cd4a39..a008d43 100644 (file)
@@ -55,7 +55,7 @@ static inline int page_kills_ppro(unsigned long pagenr)
 
 extern int is_available_memory(efi_memory_desc_t *);
 
-int page_is_ram(unsigned long pagenr)
+static inline int page_is_ram(unsigned long pagenr)
 {
        int i;
        unsigned long addr, end;
@@ -100,6 +100,26 @@ int pfn_is_ram(unsigned long pfn)
 }
 
 
+/*
+ * 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)
+               return 1;
+       if (!page_is_ram(pagenr))
+               return 1;
+       return 0;
+}
+
+
 pte_t *kmap_pte;
 
 EXPORT_SYMBOL(kmap_pte);
index 4103f59..6aa9e5f 100644 (file)
@@ -817,7 +817,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
                        if ( dev2->irq && dev2->irq != irq && \
                        (!(pci_probe & PCI_USE_PIRQ_MASK) || \
                        ((1 << dev2->irq) & mask)) ) {
-#ifndef CONFIG_PCI_USE_VECTOR
+#ifndef CONFIG_PCI_MSI
                                printk(KERN_INFO "IRQ routing conflict for %s, have irq %d, want irq %d\n",
                                       pci_name(dev2), dev2->irq, irq);
 #endif
@@ -1034,7 +1034,7 @@ int pirq_enable_irq(struct pci_dev *dev)
                                }
                                dev = temp_dev;
                                if (irq >= 0) {
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
                                        if (!platform_legacy_irq(irq))
                                                irq = IO_APIC_VECTOR(irq);
 #endif
index ad903fc..7eef15f 100644 (file)
@@ -167,7 +167,7 @@ config VIRTUAL_MEM_MAP
 
 config DISCONTIGMEM
        bool "Discontiguous memory support"
-       depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC) && NUMA && VIRTUAL_MEM_MAP
+       depends on (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC || IA64_HP_ZX1) && NUMA && VIRTUAL_MEM_MAP
        default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA
        help
          Say Y to support efficient handling of discontiguous physical memory,
@@ -176,10 +176,10 @@ config DISCONTIGMEM
          See <file:Documentation/vm/numa> for more.
 
 config IA64_CYCLONE
-       bool "Support Cyclone(EXA) Time Source"
+       bool "Cyclone (EXA) Time Source support"
        help
-               Say Y here to enable support for IBM EXA Cyclone time source.
-               If you're unsure, answer N.
+         Say Y here to enable support for IBM EXA Cyclone time source.
+         If you're unsure, answer N.
 
 config IOSAPIC
        bool
index 523292a..d8b6b60 100644 (file)
@@ -60,16 +60,12 @@ core-$(CONFIG_IA32_SUPPORT) += arch/ia64/ia32/
 core-$(CONFIG_IA64_DIG)        += arch/ia64/dig/
 core-$(CONFIG_IA64_GENERIC)    += arch/ia64/dig/
 core-$(CONFIG_IA64_HP_ZX1)     += arch/ia64/dig/
-ifeq ($(CONFIG_DISCONTIGMEM),y)
-       core-$(CONFIG_IA64_SGI_SN2)     += arch/ia64/sn/
-endif
+core-$(CONFIG_IA64_SGI_SN2)    += arch/ia64/sn/
+
 drivers-$(CONFIG_PCI)          += arch/ia64/pci/
 drivers-$(CONFIG_IA64_HP_SIM)  += arch/ia64/hp/sim/
 drivers-$(CONFIG_IA64_HP_ZX1)  += arch/ia64/hp/common/ arch/ia64/hp/zx1/
-drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/
-ifeq ($(CONFIG_DISCONTIGMEM),y)
-drivers-$(CONFIG_IA64_GENERIC) +=   arch/ia64/sn/
-endif
+drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/
 drivers-$(CONFIG_OPROFILE)     += arch/ia64/oprofile/
 
 boot := arch/ia64/hp/sim/boot
index 306c952..2797cb4 100644 (file)
@@ -24,6 +24,7 @@ CONFIG_HOTPLUG=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -85,6 +86,7 @@ CONFIG_IA64_PALINFO=y
 # Firmware Drivers
 #
 CONFIG_EFI_VARS=y
+# CONFIG_EFI_PCDP is not set
 CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 
@@ -271,7 +273,6 @@ CONFIG_SCSI_FC_ATTRS=y
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_ADVANSYS is not set
 # CONFIG_SCSI_MEGARAID is not set
 CONFIG_SCSI_SATA=y
 # CONFIG_SCSI_SATA_SVW is not set
@@ -391,7 +392,6 @@ CONFIG_IPV6=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -527,8 +527,6 @@ CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_SYNCLINKMP is not set
 # CONFIG_N_HDLC is not set
 # CONFIG_STALDRV is not set
-CONFIG_SGI_L1_SERIAL=y
-CONFIG_SGI_L1_SERIAL_CONSOLE=y
 
 #
 # Serial drivers
@@ -538,6 +536,8 @@ CONFIG_SGI_L1_SERIAL_CONSOLE=y
 #
 # Non-8250 serial port support
 #
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_SGI_L1_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
@@ -572,6 +572,11 @@ CONFIG_MAX_RAW_DEVS=256
 #
 # CONFIG_I2C is not set
 
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
 #
 # Misc devices
 #
@@ -751,6 +756,7 @@ CONFIG_ISO9660_FS=y
 CONFIG_JOLIET=y
 # CONFIG_ZISOFS is not set
 CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
@@ -785,6 +791,7 @@ CONFIG_RAMFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -885,6 +892,7 @@ CONFIG_NLS_UTF8=y
 #
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=m
@@ -935,6 +943,7 @@ CONFIG_CRYPTO_DES=m
 # CONFIG_CRYPTO_AES is not set
 # CONFIG_CRYPTO_CAST5 is not set
 # CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index 0505515..b63441d 100644 (file)
@@ -18,6 +18,7 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
 CONFIG_SYSCTL=y
 # CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=16
@@ -27,6 +28,7 @@ CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
@@ -86,6 +88,7 @@ CONFIG_IA64_PALINFO=y
 # Firmware Drivers
 #
 CONFIG_EFI_VARS=y
+CONFIG_EFI_PCDP=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
 
@@ -136,6 +139,7 @@ CONFIG_PCI_NAMES=y
 #
 # Generic Driver Options
 #
+CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_DEBUG_DRIVER is not set
 
@@ -163,7 +167,7 @@ CONFIG_PCI_NAMES=y
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_CARMEL is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
@@ -177,6 +181,7 @@ CONFIG_BLK_DEV_IDE=y
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 CONFIG_IDEDISK_MULTI_MODE=y
 CONFIG_BLK_DEV_IDECD=y
@@ -259,6 +264,7 @@ CONFIG_SCSI_SPI_ATTRS=y
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
@@ -312,6 +318,9 @@ CONFIG_MD_RAID5=m
 CONFIG_MD_MULTIPATH=m
 CONFIG_BLK_DEV_DM=m
 # CONFIG_DM_CRYPT is not set
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_ZERO is not set
 
 #
 # Fusion MPT device support
@@ -393,13 +402,13 @@ CONFIG_IP_NF_ARPTABLES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
@@ -454,6 +463,7 @@ CONFIG_EEPRO100=y
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_VIA_RHINE is not set
+# CONFIG_VIA_VELOCITY is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -557,7 +567,6 @@ CONFIG_HW_CONSOLE=y
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_HCDP=y
 CONFIG_SERIAL_8250_ACPI=y
 CONFIG_SERIAL_8250_NR_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
@@ -606,6 +615,7 @@ CONFIG_DRM_RADEON=m
 # CONFIG_DRM_MGA is not set
 # CONFIG_DRM_SIS is not set
 # CONFIG_RAW_DRIVER is not set
+# CONFIG_HPET is not set
 
 #
 # I2C support
@@ -647,12 +657,15 @@ CONFIG_I2C_ALGOBIT=y
 #
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
 # CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
 # CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
@@ -676,6 +689,11 @@ CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
 
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
 #
 # Misc devices
 #
@@ -700,6 +718,7 @@ CONFIG_FB=y
 # CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 CONFIG_FB_RIVA=m
+CONFIG_FB_RIVA_I2C=y
 # CONFIG_FB_MATROX is not set
 # CONFIG_FB_RADEON_OLD is not set
 CONFIG_FB_RADEON=m
@@ -723,7 +742,6 @@ CONFIG_VGA_CONSOLE=y
 # CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
@@ -950,6 +968,7 @@ CONFIG_ISO9660_FS=y
 CONFIG_JOLIET=y
 # CONFIG_ZISOFS is not set
 CONFIG_UDF_FS=y
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
@@ -957,6 +976,8 @@ CONFIG_UDF_FS=y
 CONFIG_FAT_FS=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
 
 #
@@ -982,6 +1003,7 @@ CONFIG_RAMFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -999,7 +1021,7 @@ CONFIG_NFS_DIRECTIO=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
 # CONFIG_NFSD_V4 is not set
-CONFIG_NFSD_TCP=y
+# CONFIG_NFSD_TCP is not set
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
@@ -1027,7 +1049,6 @@ CONFIG_MSDOS_PARTITION=y
 # CONFIG_SOLARIS_X86_PARTITION is not set
 # CONFIG_UNIXWARE_DISKLABEL is not set
 # CONFIG_LDM_PARTITION is not set
-# CONFIG_NEC98_PARTITION is not set
 # CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
 # CONFIG_SUN_PARTITION is not set
@@ -1039,46 +1060,48 @@ CONFIG_EFI_PARTITION=y
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_CODEPAGE_737=y
-CONFIG_NLS_CODEPAGE_775=y
-CONFIG_NLS_CODEPAGE_850=y
-CONFIG_NLS_CODEPAGE_852=y
-CONFIG_NLS_CODEPAGE_855=y
-CONFIG_NLS_CODEPAGE_857=y
-CONFIG_NLS_CODEPAGE_860=y
-CONFIG_NLS_CODEPAGE_861=y
-CONFIG_NLS_CODEPAGE_862=y
-CONFIG_NLS_CODEPAGE_863=y
-CONFIG_NLS_CODEPAGE_864=y
-CONFIG_NLS_CODEPAGE_865=y
-CONFIG_NLS_CODEPAGE_866=y
-CONFIG_NLS_CODEPAGE_869=y
-CONFIG_NLS_CODEPAGE_936=y
-CONFIG_NLS_CODEPAGE_950=y
-CONFIG_NLS_CODEPAGE_932=y
-CONFIG_NLS_CODEPAGE_949=y
-CONFIG_NLS_CODEPAGE_874=y
-CONFIG_NLS_ISO8859_8=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
 # CONFIG_NLS_CODEPAGE_1250 is not set
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_ASCII=y
 CONFIG_NLS_ISO8859_1=y
-CONFIG_NLS_ISO8859_2=y
-CONFIG_NLS_ISO8859_3=y
-CONFIG_NLS_ISO8859_4=y
-CONFIG_NLS_ISO8859_5=y
-CONFIG_NLS_ISO8859_6=y
-CONFIG_NLS_ISO8859_7=y
-CONFIG_NLS_ISO8859_9=y
-CONFIG_NLS_ISO8859_13=y
-CONFIG_NLS_ISO8859_14=y
-CONFIG_NLS_ISO8859_15=y
-CONFIG_NLS_KOI8_R=y
-CONFIG_NLS_KOI8_U=y
-CONFIG_NLS_UTF8=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
 
 #
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 
@@ -1128,6 +1151,7 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_AES is not set
 # CONFIG_CRYPTO_CAST5 is not set
 # CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
index cc942f8..85c5f1b 100644 (file)
@@ -41,6 +41,8 @@ static void elf32_set_personality (void);
 #undef SET_PERSONALITY
 #define SET_PERSONALITY(ex, ibcs2)     elf32_set_personality()
 
+#define elf_read_implies_exec(ex, have_pt_gnu_stack)   (!(have_pt_gnu_stack))
+
 /* Ugly but avoids duplication */
 #include "../../../fs/binfmt_elf.c"
 
@@ -215,7 +217,6 @@ elf32_set_personality (void)
        set_personality(PER_LINUX32);
        current->thread.map_base  = IA32_PAGE_OFFSET/3;
        current->thread.task_size = IA32_PAGE_OFFSET;   /* use what Linux/x86 uses... */
-       current->thread.flags |= IA64_THREAD_XSTACK;    /* data must be executable */
        set_fs(USER_DS);                                /* set addr limit for new TASK_SIZE */
 }
 
index f0868ac..fa3ac96 100644 (file)
@@ -478,8 +478,8 @@ ia32_syscall_table:
        data8 compat_clock_gettime /* 265 */
        data8 compat_clock_getres
        data8 compat_clock_nanosleep
-       data8 sys_statfs64
-       data8 sys_fstatfs64
+       data8 compat_statfs64
+       data8 compat_fstatfs64
        data8 sys_tgkill        /* 270 */
        data8 compat_sys_utimes
        data8 sys32_fadvise64_64
index 2826444..cf61f3e 100644 (file)
@@ -171,8 +171,6 @@ acpi_parse_lapic_addr_ovr (
        if (BAD_MADT_ENTRY(lapic, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        if (lapic->address) {
                iounmap((void *) ipi_base_addr);
                ipi_base_addr = (unsigned long) ioremap(lapic->address, 0);
@@ -191,25 +189,13 @@ acpi_parse_lsapic (acpi_table_entry_header *header, const unsigned long end)
        if (BAD_MADT_ENTRY(lsapic, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
-       printk(KERN_INFO "CPU %d (0x%04x)", total_cpus, (lsapic->id << 8) | lsapic->eid);
-
-       if (!lsapic->flags.enabled)
-               printk(" disabled");
-       else {
-               printk(" enabled");
+       if (lsapic->flags.enabled) {
 #ifdef CONFIG_SMP
                smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
-               if (hard_smp_processor_id()
-                   == (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
-                       printk(" (BSP)");
 #endif
                ++available_cpus;
        }
 
-       printk("\n");
-
        total_cpus++;
        return 0;
 }
@@ -225,8 +211,6 @@ acpi_parse_lapic_nmi (acpi_table_entry_header *header, const unsigned long end)
        if (BAD_MADT_ENTRY(lacpi_nmi, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        /* TBD: Support lapic_nmi entries */
        return 0;
 }
@@ -242,8 +226,6 @@ acpi_parse_iosapic (acpi_table_entry_header *header, const unsigned long end)
        if (BAD_MADT_ENTRY(iosapic, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        iosapic_init(iosapic->address, iosapic->global_irq_base);
 
        return 0;
@@ -262,8 +244,6 @@ acpi_parse_plat_int_src (
        if (BAD_MADT_ENTRY(plintsrc, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        /*
         * Get vector assignment for this interrupt, set attributes,
         * and program the IOSAPIC routing table.
@@ -292,8 +272,6 @@ acpi_parse_int_src_ovr (
        if (BAD_MADT_ENTRY(p, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        iosapic_override_isa_irq(p->bus_irq, p->global_irq,
                                 (p->flags.polarity == 1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
                                 (p->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
@@ -311,26 +289,24 @@ acpi_parse_nmi_src (acpi_table_entry_header *header, const unsigned long end)
        if (BAD_MADT_ENTRY(nmi_src, end))
                return -EINVAL;
 
-       acpi_table_print_madt_entry(header);
-
        /* TBD: Support nimsrc entries */
        return 0;
 }
 
-/* Hook from generic ACPI tables.c */
-void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static void __init
+acpi_madt_oem_check (char *oem_id, char *oem_table_id)
 {
        if (!strncmp(oem_id, "IBM", 3) &&
-           (!strncmp(oem_table_id, "SERMOW", 6))){
+           (!strncmp(oem_table_id, "SERMOW", 6))) {
 
-               /* Unfortunatly ITC_DRIFT is not yet part of the
+               /*
+                * Unfortunately ITC_DRIFT is not yet part of the
                 * official SAL spec, so the ITC_DRIFT bit is not
                 * set by the BIOS on this hardware.
                 */
                sal_platform_features |= IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT;
 
-               /*Start cyclone clock*/
-               cyclone_setup(0);
+               cyclone_setup();
        }
 }
 
index 0b24641..6c0fc63 100644 (file)
@@ -1377,7 +1377,15 @@ sys_call_table:
        data8 sys_syslog
        data8 sys_setitimer
        data8 sys_getitimer
+#ifdef CONFIG_TUX
+       data8 __sys_tux                         // 1120         /* was: ia64_oldstat */
+#else
+# ifdef CONFIG_TUX_MODULE
+       data8 sys_tux                           // 1120         /* was: ia64_oldstat */
+# else
        data8 sys_ni_syscall                    // 1120         /* was: ia64_oldstat */
+# endif
+#endif
        data8 sys_ni_syscall                                    /* was: ia64_oldlstat */
        data8 sys_ni_syscall                                    /* was: ia64_oldfstat */
        data8 sys_vhangup
index c34ccbf..4fc74cc 100644 (file)
@@ -58,8 +58,11 @@ EXPORT_SYMBOL(__strlen_user);
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(__strnlen_user);
 
+#define __KERNEL_SYSCALLS__
 #include <asm/unistd.h>
 EXPORT_SYMBOL(__ia64_syscall);
+EXPORT_SYMBOL(execve);
+EXPORT_SYMBOL(clone);
 
 /* from arch/ia64/lib */
 extern void __divsi3(void);
index 8355dda..9ec161c 100644 (file)
@@ -87,7 +87,8 @@ irq_desc_t _irq_desc[NR_IRQS] __cacheline_aligned = {
 /*
  * This is updated when the user sets irq affinity via /proc
  */
-cpumask_t    __cacheline_aligned pending_irq_cpumask[NR_IRQS];
+cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS];
+static unsigned long pending_irq_redir[BITS_TO_LONGS(NR_IRQS)];
 
 #ifdef CONFIG_IA64_GENERIC
 irq_desc_t * __ia64_irq_desc (unsigned int irq)
@@ -973,6 +974,7 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
        int prelen;
        irq_desc_t *desc = irq_descp(irq);
        unsigned long flags;
+       int redir = 0;
 
        if (!desc->handler->set_affinity)
                return -EIO;
@@ -995,7 +997,7 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
        prelen = 0;
        if (tolower(*rbuf) == 'r') {
                prelen = strspn(rbuf, "Rr ");
-               irq |= IA64_IRQ_REDIRECTED;
+               redir++;
        }
 
        err = cpumask_parse(buffer+prelen, count-prelen, new_value);
@@ -1013,6 +1015,10 @@ static int irq_affinity_write_proc (struct file *file, const char *buffer,
 
        spin_lock_irqsave(&desc->lock, flags);
        pending_irq_cpumask[irq] = new_value;
+       if (redir)
+               set_bit(irq, pending_irq_redir);
+       else
+               clear_bit(irq, pending_irq_redir);
        spin_unlock_irqrestore(&desc->lock, flags);
 
        return full_count;
@@ -1023,11 +1029,13 @@ void move_irq(int irq)
        /* note - we hold desc->lock */
        cpumask_t tmp;
        irq_desc_t *desc = irq_descp(irq);
+       int redir = test_bit(irq, pending_irq_redir);
 
        if (!cpus_empty(pending_irq_cpumask[irq])) {
                cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map);
                if (unlikely(!cpus_empty(tmp))) {
-                       desc->handler->set_affinity(irq, pending_irq_cpumask[irq]);
+                       desc->handler->set_affinity(irq | (redir ? IA64_IRQ_REDIRECTED : 0),
+                                                   pending_irq_cpumask[irq]);
                }
                cpus_clear(pending_irq_cpumask[irq]);
        }
index 3b9e545..9c5104c 100644 (file)
@@ -128,10 +128,10 @@ static int cmc_polling_enabled = 1;
  */
 static int cpe_poll_enabled = 1;
 
-static int cpe_vector = -1;
-
 extern void salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe);
 
+static int mca_init;
+
 /*
  * IA64_MCA log support
  */
@@ -274,6 +274,8 @@ ia64_mca_log_sal_error_record(int sal_info_type)
 
 #ifdef CONFIG_ACPI
 
+static int cpe_vector = -1;
+
 static irqreturn_t
 ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
 {
@@ -542,7 +544,7 @@ ia64_mca_register_cpev (int cpev)
        }
 
        IA64_MCA_DEBUG("%s: corrected platform error "
-                      "vector %#x setup and enabled\n", __FUNCTION__, cpev);
+                      "vector %#x registered\n", __FUNCTION__, cpev);
 }
 #endif /* CONFIG_ACPI */
 
@@ -551,8 +553,9 @@ ia64_mca_register_cpev (int cpev)
 /*
  * ia64_mca_cmc_vector_setup
  *
- *  Setup the corrected machine check vector register in the processor and
- *  unmask interrupt.  This function is invoked on a per-processor basis.
+ *  Setup the corrected machine check vector register in the processor.
+ *  (The interrupt is masked on boot. ia64_mca_late_init unmask this.)
+ *  This function is invoked on a per-processor basis.
  *
  * Inputs
  *      None
@@ -566,12 +569,12 @@ ia64_mca_cmc_vector_setup (void)
        cmcv_reg_t      cmcv;
 
        cmcv.cmcv_regval        = 0;
-       cmcv.cmcv_mask          = 0;        /* Unmask/enable interrupt */
+       cmcv.cmcv_mask          = 1;        /* Mask/disable interrupt at first */
        cmcv.cmcv_vector        = IA64_CMC_VECTOR;
        ia64_setreg(_IA64_REG_CR_CMCV, cmcv.cmcv_regval);
 
        IA64_MCA_DEBUG("%s: CPU %d corrected "
-                      "machine check vector %#x setup and enabled.\n",
+                      "machine check vector %#x registered.\n",
                       __FUNCTION__, smp_processor_id(), IA64_CMC_VECTOR);
 
        IA64_MCA_DEBUG("%s: CPU %d CMCV = %#016lx\n",
@@ -1293,7 +1296,7 @@ ia64_mca_init(void)
         */
        register_percpu_irq(IA64_CMC_VECTOR, &cmci_irqaction);
        register_percpu_irq(IA64_CMCP_VECTOR, &cmcp_irqaction);
-       ia64_mca_cmc_vector_setup();       /* Setup vector on BSP & enable */
+       ia64_mca_cmc_vector_setup();       /* Setup vector on BSP */
 
        /* Setup the MCA rendezvous interrupt vector */
        register_percpu_irq(IA64_MCA_RENDEZ_VECTOR, &mca_rdzv_irqaction);
@@ -1303,23 +1306,8 @@ ia64_mca_init(void)
 
 #ifdef CONFIG_ACPI
        /* Setup the CPEI/P vector and handler */
-       {
-               irq_desc_t *desc;
-               unsigned int irq;
-
-               cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI);
-
-               if (cpe_vector >= 0) {
-                       for (irq = 0; irq < NR_IRQS; ++irq)
-                               if (irq_to_vector(irq) == cpe_vector) {
-                                       desc = irq_descp(irq);
-                                       desc->status |= IRQ_PER_CPU;
-                                       setup_irq(irq, &mca_cpe_irqaction);
-                               }
-                       ia64_mca_register_cpev(cpe_vector);
-               }
-               register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
-       }
+       cpe_vector = acpi_request_vector(ACPI_INTERRUPT_CPEI);
+       register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
 #endif
 
        /* Initialize the areas set aside by the OS to buffer the
@@ -1331,6 +1319,7 @@ ia64_mca_init(void)
        ia64_log_init(SAL_INFO_TYPE_CMC);
        ia64_log_init(SAL_INFO_TYPE_CPE);
 
+       mca_init = 1;
        printk(KERN_INFO "MCA related initialization done\n");
 }
 
@@ -1347,21 +1336,46 @@ ia64_mca_init(void)
 static int __init
 ia64_mca_late_init(void)
 {
+       if (!mca_init)
+               return 0;
+
+       /* Setup the CMCI/P vector and handler */
        init_timer(&cmc_poll_timer);
        cmc_poll_timer.function = ia64_mca_cmc_poll;
 
-       /* Reset to the correct state */
+       /* Unmask/enable the vector */
        cmc_polling_enabled = 0;
+       schedule_work(&cmc_enable_work);
+
+       IA64_MCA_DEBUG("%s: CMCI/P setup and enabled.\n", __FUNCTION__);
 
+#ifdef CONFIG_ACPI
+       /* Setup the CPEI/P vector and handler */
        init_timer(&cpe_poll_timer);
        cpe_poll_timer.function = ia64_mca_cpe_poll;
 
-#ifdef CONFIG_ACPI
-       /* If platform doesn't support CPEI, get the timer going. */
-       if (cpe_vector < 0 && cpe_poll_enabled) {
-               ia64_mca_cpe_poll(0UL);
-       } else {
-               cpe_poll_enabled = 0;
+       {
+               irq_desc_t *desc;
+               unsigned int irq;
+
+               if (cpe_vector >= 0) {
+                       /* If platform supports CPEI, enable the irq. */
+                       cpe_poll_enabled = 0;
+                       for (irq = 0; irq < NR_IRQS; ++irq)
+                               if (irq_to_vector(irq) == cpe_vector) {
+                                       desc = irq_descp(irq);
+                                       desc->status |= IRQ_PER_CPU;
+                                       setup_irq(irq, &mca_cpe_irqaction);
+                               }
+                       ia64_mca_register_cpev(cpe_vector);
+                       IA64_MCA_DEBUG("%s: CPEI/P setup and enabled.\n", __FUNCTION__);
+               } else {
+                       /* If platform doesn't support CPEI, get the timer going. */
+                       if (cpe_poll_enabled) {
+                               ia64_mca_cpe_poll(0UL);
+                               IA64_MCA_DEBUG("%s: CPEP setup and enabled.\n", __FUNCTION__);
+                       }
+               }
        }
 #endif
 
index 346731e..2f71b39 100644 (file)
@@ -600,7 +600,7 @@ pfm_do_munmap(struct mm_struct *mm, unsigned long addr, size_t len, int acct)
 static inline unsigned long 
 pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
 {
-       return get_unmapped_area(file, addr, len, pgoff, flags, 0);
+       return get_unmapped_area(file, addr, len, pgoff, flags);
 }
 
 
@@ -1512,13 +1512,6 @@ exit_pfm_fs(void)
        mntput(pfmfs_mnt);
 }
 
-static loff_t
-pfm_lseek(struct file *file, loff_t offset, int whence)
-{
-       DPRINT(("pfm_lseek called\n"));
-       return -ESPIPE;
-}
-
 static ssize_t
 pfm_read(struct file *filp, char *buf, size_t size, loff_t *ppos)
 {
@@ -1545,10 +1538,6 @@ pfm_read(struct file *filp, char *buf, size_t size, loff_t *ppos)
                DPRINT(("message is too small ctx=%p (>=%ld)\n", ctx, sizeof(pfm_msg_t)));
                return -EINVAL;
        }
-       /*
-        * seeks are not allowed on message queues
-        */
-       if (ppos != &filp->f_pos) return -ESPIPE;
 
        PROTECT_CTX(ctx, flags);
 
@@ -2141,7 +2130,7 @@ pfm_no_open(struct inode *irrelevant, struct file *dontcare)
 
 
 static struct file_operations pfm_file_ops = {
-       .llseek   = pfm_lseek,
+       .llseek   = no_llseek,
        .read     = pfm_read,
        .write    = pfm_write,
        .poll     = pfm_poll,
@@ -4729,6 +4718,11 @@ recheck:
         */
        if (task == current || ctx->ctx_fl_system) return 0;
 
+       /*
+        * if context is UNLOADED we are safe to go
+        */
+       if (state == PFM_CTX_UNLOADED) return 0;
+
        /*
         * no command can operate on a zombie context
         */
@@ -4738,12 +4732,9 @@ recheck:
        }
 
        /*
-        * if context is UNLOADED, MASKED we are safe to go
-        */
-       if (state != PFM_CTX_LOADED) return 0;
-
-       /*
-        * context is LOADED, we must make sure the task is stopped
+        * context is LOADED or MASKED. Some commands may need to have 
+        * the task stopped.
+        *
         * We could lift this restriction for UP but it would mean that
         * the user has no guarantee the task would not run between
         * two successive calls to perfmonctl(). That's probably OK.
index f49b98c..842c95b 100644 (file)
@@ -616,16 +616,6 @@ out:
        return error;
 }
 
-void
-ia64_set_personality (struct elf64_hdr *elf_ex, int ibcs2_interpreter)
-{
-       set_personality(PER_LINUX);
-       if (elf_ex->e_flags & EF_IA_64_LINUX_EXECUTABLE_STACK)
-               current->thread.flags |= IA64_THREAD_XSTACK;
-       else
-               current->thread.flags &= ~IA64_THREAD_XSTACK;
-}
-
 pid_t
 kernel_thread (int (*fn)(void *), void *arg, unsigned long flags)
 {
index 462fd9f..8aff39d 100644 (file)
@@ -375,9 +375,10 @@ setup_arch (char **cmdline_p)
        }
 #endif
 
-       /* enable IA-64 Machine Check Abort Handling */
-       ia64_mca_init();
-
+       /* enable IA-64 Machine Check Abort Handling unless disabled */
+       if (!strstr(saved_command_line, "nomca"))
+               ia64_mca_init();
+       
        platform_setup(cmdline_p);
        paging_init();
 }
index 8cef119..9a0f792 100644 (file)
@@ -299,7 +299,7 @@ smp_callin (void)
 
        smp_setup_percpu_timer();
 
-       ia64_mca_cmc_vector_setup();    /* Setup vector on AP & enable */
+       ia64_mca_cmc_vector_setup();    /* Setup vector on AP */
 
 #ifdef CONFIG_PERFMON
        pfm_init_percpu();
index b0a67b6..90fecb3 100644 (file)
@@ -63,6 +63,7 @@ check_pgt_cache (void)
        low = pgt_cache_water[0];
        high = pgt_cache_water[1];
 
+       preempt_disable();
        if (pgtable_cache_size > (u64) high) {
                do {
                        if (pgd_quicklist)
@@ -71,6 +72,7 @@ check_pgt_cache (void)
                                free_page((unsigned long)pmd_alloc_one_fast(0, 0));
                } while (pgtable_cache_size > (u64) low);
        }
+       preempt_enable();
 }
 
 void
@@ -128,7 +130,7 @@ ia64_init_addr_space (void)
                vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
                vma->vm_end = vma->vm_start + PAGE_SIZE;
                vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7];
-               vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE|VM_GROWSUP;
+               vma->vm_flags = VM_DATA_DEFAULT_FLAGS | VM_GROWSUP;
                insert_vm_struct(current->mm, vma);
        }
 
@@ -169,7 +171,7 @@ free_initrd_mem (unsigned long start, unsigned long end)
 {
        struct page *page;
        /*
-        * EFI uses 4KB pages while the kernel can use 4KB  or bigger.
+        * EFI uses 4KB pages while the kernel can use 4KB or bigger.
         * Thus EFI and the kernel may have different page sizes. It is
         * therefore possible to have the initrd share the same page as
         * the end of the kernel (given current setup).
@@ -587,7 +589,7 @@ mem_init (void)
                if (!fsyscall_table[i] || nolwsys)
                        fsyscall_table[i] = sys_call_table[i] | 1;
        }
-       setup_gate();   /* setup gate pages before we free up boot memory... */
+       setup_gate();
 
 #ifdef CONFIG_IA32_SUPPORT
        ia32_boot_gdt_init();
index 8e410fc..4833cfb 100644 (file)
@@ -37,7 +37,7 @@ nasid_t master_nasid = INVALID_NASID; /* This is the partition master nasid */
  *
  *     This code is executed once for each Hub chip.
  */
-static void
+static void __init
 per_hub_init(cnodeid_t cnode)
 {
        nasid_t nasid;
@@ -130,10 +130,8 @@ sgi_master_io_infr_init(void)
        klhwg_add_all_modules(hwgraph_root);
        klhwg_add_all_nodes(hwgraph_root);
 
-       for (cnode = 0; cnode < numionodes; cnode++) {
-               extern void per_hub_init(cnodeid_t);
+       for (cnode = 0; cnode < numionodes; cnode++)
                per_hub_init(cnode);
-       }
 
        /*
         *
index 61f70c9..b77e9e2 100644 (file)
@@ -90,6 +90,7 @@ bte_error_handler(unsigned long _nodepda)
        ii_icrb0_d_u_t icrbd;   /* II CRB Register D */
        ii_ibcr_u_t ibcr;
        ii_icmr_u_t icmr;
+       ii_ieclr_u_t ieclr;
 
 
        BTE_PRINTK(("bte_error_handler(%p) - %d\n", err_nodepda,
@@ -177,6 +178,14 @@ bte_error_handler(unsigned long _nodepda)
        imem.ii_imem_fld_s.i_b0_esd = imem.ii_imem_fld_s.i_b1_esd = 1;
        REMOTE_HUB_S(nasid, IIO_IMEM, imem.ii_imem_regval);
 
+       /* Clear IBLS0/1 error bits */
+       ieclr.ii_ieclr_regval = 0;
+       if (err_nodepda->bte_if[0].bh_error != BTE_SUCCESS)
+               ieclr.ii_ieclr_fld_s.i_e_bte_0 = 1;
+       if (err_nodepda->bte_if[1].bh_error != BTE_SUCCESS)
+                ieclr.ii_ieclr_fld_s.i_e_bte_1 = 1;
+       REMOTE_HUB_S(nasid, IIO_IECLR, ieclr.ii_ieclr_regval);
+
        /* Reinitialize both BTE state machines. */
        ibcr.ii_ibcr_regval = REMOTE_HUB_L(nasid, IIO_IBCR);
        ibcr.ii_ibcr_fld_s.i_soft_reset = 1;
index 454f842..e040fc3 100644 (file)
@@ -16,7 +16,6 @@
 #include <asm/sn/pda.h>
 #include <asm/sn/sn2/shubio.h>
 #include <asm/nodedata.h>
-#include <asm/delay.h>
 
 #include <linux/bootmem.h>
 #include <linux/string.h>
@@ -71,6 +70,7 @@ bte_result_t
 bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
 {
        u64 transfer_size;
+       u64 transfer_stat;
        struct bteinfo_s *bte;
        bte_result_t bte_status;
        unsigned long irq_flags;
@@ -148,9 +148,6 @@ bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
                if (!(mode & BTE_WACQUIRE)) {
                        return BTEFAIL_NOTAVAIL;
                }
-
-               /* Wait until a bte is available. */
-               udelay(1);
        } while (1);
 
 
@@ -194,15 +191,15 @@ bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
                return BTE_SUCCESS;
        }
 
-       while (*bte->most_rcnt_na == -1UL) {
+       while ((transfer_stat = *bte->most_rcnt_na) == -1UL) {
        }
 
 
        BTE_PRINTKV((" Delay Done.  IBLS = 0x%lx, most_rcnt_na = 0x%lx\n",
                                BTE_LNSTAT_LOAD(bte), *bte->most_rcnt_na));
 
-       if (*bte->most_rcnt_na & IBLS_ERROR) {
-               bte_status = *bte->most_rcnt_na & ~IBLS_ERROR;
+       if (transfer_stat & IBLS_ERROR) {
+               bte_status = transfer_stat & ~IBLS_ERROR;
                *bte->most_rcnt_na = 0L;
        } else {
                bte_status = BTE_SUCCESS;
index b0f720e..6bcf70e 100644 (file)
@@ -188,7 +188,7 @@ sn_irq_desc(unsigned int irq)
 }
 
 u8
-sn_irq_to_vector(u8 irq)
+sn_irq_to_vector(unsigned int irq)
 {
        return(irq);
 }
index 5ea3db6..367125a 100644 (file)
@@ -112,7 +112,6 @@ CONFIG_INET=y
 # CONFIG_LLC is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index d32e81c..803a6ec 100644 (file)
@@ -204,11 +204,12 @@ _060_real_cas2:
 _060_real_lock_page:
        move.l  %d2,-(%sp)
        | load sfc/dfc
-       moveq   #5,%d0
        tst.b   %d0
        jne     1f
        moveq   #1,%d0
-1:     movec.l %dfc,%d2
+       jra     2f
+1:     moveq   #5,%d0
+2:     movec.l %dfc,%d2
        movec.l %d0,%dfc
        movec.l %d0,%sfc
 
index 7680eab..1d2563e 100644 (file)
@@ -237,6 +237,18 @@ void __init setup_arch(char **cmdline_p)
        }
 #endif
 
+       if (CPU_IS_060) {
+               u32 pcr;
+
+               asm (".chip 68060; movec %%pcr,%0; .chip 68k"
+                    : "=d" (pcr));
+               if (((pcr >> 8) & 0xff) <= 5) {
+                       printk("Enabling workaround for errata I14\n");
+                       asm (".chip 68060; movec %0,%%pcr; .chip 68k"
+                            : : "d" (pcr | 0x20));
+               }
+       }
+
        init_mm.start_code = PAGE_OFFSET;
        init_mm.end_code = (unsigned long) &_etext;
        init_mm.end_data = (unsigned long) &_edata;
index 0953832..c37c4db 100644 (file)
@@ -349,7 +349,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp,
                /*
                 * user process trying to return with weird frame format
                 */
-#if DEBUG
+#ifdef DEBUG
                printk("user process returning with weird frame format\n");
 #endif
                goto badframe;
@@ -450,7 +450,7 @@ rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
                /*
                 * user process trying to return with weird frame format
                 */
-#if DEBUG
+#ifdef DEBUG
                printk("user process returning with weird frame format\n");
 #endif
                goto badframe;
@@ -829,7 +829,7 @@ adjust_stack:
        if (regs->stkadj) {
                struct pt_regs *tregs =
                        (struct pt_regs *)((ulong)regs + regs->stkadj);
-#if DEBUG
+#ifdef DEBUG
                printk("Performing stackadjust=%04x\n", regs->stkadj);
 #endif
                /* This must be copied with decreasing addresses to
@@ -912,7 +912,7 @@ adjust_stack:
        if (regs->stkadj) {
                struct pt_regs *tregs =
                        (struct pt_regs *)((ulong)regs + regs->stkadj);
-#if DEBUG
+#ifdef DEBUG
                printk("Performing stackadjust=%04x\n", regs->stkadj);
 #endif
                /* This must be copied with decreasing addresses to
index d3fc995..deb36e8 100644 (file)
@@ -541,7 +541,7 @@ static inline void bus_error030 (struct frame *fp)
        unsigned short ssw = fp->un.fmtb.ssw;
        extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
 
-#if DEBUG
+#ifdef DEBUG
        if (ssw & (FC | FB))
                printk ("Instruction fault at %#010lx\n",
                        ssw & FC ?
@@ -670,7 +670,7 @@ static inline void bus_error030 (struct frame *fp)
        unsigned short mmusr;
        unsigned long addr, errorcode;
        unsigned short ssw = fp->un.fmtb.ssw;
-#if DEBUG
+#ifdef DEBUG
        unsigned long desc;
 
        printk ("pid = %x  ", current->pid);
@@ -696,7 +696,7 @@ static inline void bus_error030 (struct frame *fp)
        if (ssw & DF) {
                addr = fp->un.fmtb.daddr;
 
-#if DEBUG
+#ifdef DEBUG
                asm volatile ("ptestr %3,%2@,#7,%0\n\t"
                              "pmove %%psr,%1@"
                              : "=a&" (desc)
@@ -708,7 +708,7 @@ static inline void bus_error030 (struct frame *fp)
 #endif
                mmusr = temp;
 
-#if DEBUG
+#ifdef DEBUG
                printk("mmusr is %#x for addr %#lx in task %p\n",
                       mmusr, addr, current);
                printk("descriptor address is %#lx, contents %#lx\n",
@@ -767,7 +767,7 @@ static inline void bus_error030 (struct frame *fp)
                                      : "a" (&tlong));
                        printk("tt1 is %#lx\n", tlong);
 #endif
-#if DEBUG
+#ifdef DEBUG
                        printk("Unknown SIGSEGV - 1\n");
 #endif
                        die_if_kernel("Oops",&fp->ptregs,mmusr);
@@ -812,7 +812,7 @@ static inline void bus_error030 (struct frame *fp)
                   should still create the ATC entry.  */
                goto create_atc_entry;
 
-#if DEBUG
+#ifdef DEBUG
        asm volatile ("ptestr #1,%2@,#7,%0\n\t"
                      "pmove %%psr,%1@"
                      : "=a&" (desc)
@@ -836,7 +836,7 @@ static inline void bus_error030 (struct frame *fp)
        else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
                printk ("invalid insn access at %#lx from pc %#lx\n",
                        addr, fp->ptregs.pc);
-#if DEBUG
+#ifdef DEBUG
                printk("Unknown SIGSEGV - 2\n");
 #endif
                die_if_kernel("Oops",&fp->ptregs,mmusr);
@@ -858,7 +858,7 @@ asmlinkage void buserr_c(struct frame *fp)
        if (user_mode(&fp->ptregs))
                current->thread.esp0 = (unsigned long) fp;
 
-#if DEBUG
+#ifdef DEBUG
        printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
 #endif
 
@@ -881,7 +881,7 @@ asmlinkage void buserr_c(struct frame *fp)
 #endif
        default:
          die_if_kernel("bad frame format",&fp->ptregs,0);
-#if DEBUG
+#ifdef DEBUG
          printk("Unknown SIGSEGV - 4\n");
 #endif
          force_sig(SIGSEGV, current);
@@ -990,7 +990,7 @@ void show_registers(struct pt_regs *regs)
        printk ("\n");
 }
 
-extern void show_stack(struct task_struct *task, unsigned long *stack)
+void show_stack(struct task_struct *task, unsigned long *stack)
 {
        unsigned long *endstack;
        int i;
index c50cdb6..1809601 100644 (file)
@@ -545,7 +545,8 @@ void mac_free_irq(unsigned int irq, void *dev_id)
 #endif
 
        if (irq < VIA1_SOURCE_BASE) {
-               return cpu_free_irq(irq, dev_id);
+               cpu_free_irq(irq, dev_id);
+               return;
        }
 
        if (irq >= NUM_MAC_SOURCES) {
index 411c06f..09985ae 100644 (file)
@@ -129,7 +129,7 @@ int free_pointer_table (pmd_t *ptable)
        return 0;
 }
 
-#if DEBUG_INVALID_PTOV
+#ifdef DEBUG_INVALID_PTOV
 int mm_inv_cnt = 5;
 #endif
 
@@ -179,7 +179,7 @@ unsigned long mm_ptov (unsigned long paddr)
                voff += m68k_memory[i].size;
        } while (++i < m68k_num_memory);
 
-#if DEBUG_INVALID_PTOV
+#ifdef DEBUG_INVALID_PTOV
        if (mm_inv_cnt > 0) {
                mm_inv_cnt--;
                printk("Invalid use of phys_to_virt(0x%lx) at 0x%p!\n",
index 58c3b9d..0fcf972 100644 (file)
@@ -69,7 +69,7 @@ int mvme147_parse_bootinfo(const struct bi_record *bi)
                return 1;
 }
 
-void mvme147_reset()
+void mvme147_reset(void)
 {
        printk ("\r\n\nCalled mvme147_reset\r\n");
        m147_pcc->watchdog = 0x0a;      /* Clear timer */
index 90d82d9..0b5730c 100644 (file)
@@ -122,7 +122,7 @@ static void q40_heartbeat(int on)
 }
 #endif
 
-void q40_reset()
+void q40_reset(void)
 {
         halted=1;
         printk ("\n\n*******************************************\n"
@@ -131,7 +131,7 @@ void q40_reset()
        Q40_LED_ON();
        while(1) ;
 }
-void q40_halt()
+void q40_halt(void)
 {
         halted=1;
         printk ("\n\n*******************\n"
@@ -295,7 +295,7 @@ int q40_hwclk(int op, struct rtc_time *t)
        return 0;
 }
 
-unsigned int q40_get_ss()
+unsigned int q40_get_ss(void)
 {
        return bcd2bin(Q40_RTC_SECS);
 }
index 3cccab2..9e0a5bc 100644 (file)
@@ -316,7 +316,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 369d8b0..5bc312a 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index fe6d0b6..b59e453 100644 (file)
@@ -278,7 +278,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 46f45c3..d47f67b 100644 (file)
@@ -266,7 +266,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 0755f48..62e748b 100644 (file)
@@ -288,7 +288,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 88c42a5..d6b544e 100644 (file)
@@ -286,7 +286,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index cbe2b1e..97a22cb 100644 (file)
@@ -368,7 +368,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 122f2a9..07803ef 100644 (file)
@@ -278,7 +278,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index fc23a6b..c09e58c 100644 (file)
@@ -246,7 +246,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 06cf55a..e7dc8ef 100644 (file)
@@ -272,7 +272,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 0d9c405..b771f90 100644 (file)
@@ -272,7 +272,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 2ae2e3d..5416290 100644 (file)
@@ -253,7 +253,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 927098b..eb13fd9 100644 (file)
@@ -247,7 +247,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 22f427c..8bc7792 100644 (file)
@@ -414,7 +414,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_NET_DIVERT=y
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 490f2bc..2962c1d 100644 (file)
@@ -321,7 +321,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 02c732a..7cfe80b 100644 (file)
@@ -317,7 +317,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 8bbe2b3..520acac 100644 (file)
@@ -323,7 +323,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index c809e09..8eace13 100644 (file)
@@ -273,7 +273,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 463fb5c..4580138 100644 (file)
@@ -245,7 +245,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 2fb26c7..3f9fb45 100644 (file)
@@ -361,7 +361,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index f5446e4..3259148 100644 (file)
@@ -259,7 +259,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 369d8b0..5bc312a 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 96735cb..2c3c1f0 100644 (file)
@@ -255,7 +255,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 369d8b0..5bc312a 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 167007d..3eafe9a 100644 (file)
@@ -246,7 +246,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index da60ba0..2f5c2d2 100644 (file)
@@ -245,7 +245,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 22387c2..1156491 100644 (file)
@@ -237,7 +237,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 369d8b0..5bc312a 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 369d8b0..5bc312a 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 0ca1885..aeecf85 100644 (file)
@@ -354,7 +354,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 147ebbd..519cd8f 100644 (file)
@@ -353,7 +353,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 5413cd0..2ec3932 100644 (file)
@@ -534,7 +534,6 @@ CONFIG_DECNET=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 02b8829..41d73cf 100644 (file)
@@ -313,7 +313,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index b5a0d15..d942862 100644 (file)
@@ -305,7 +305,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 77deb2b..cd08e3c 100644 (file)
@@ -265,7 +265,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 228a685..e0bc0d0 100644 (file)
@@ -272,7 +272,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index f28e04a..37fef7b 100644 (file)
@@ -268,7 +268,6 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 22f427c..8bc7792 100644 (file)
@@ -414,7 +414,6 @@ CONFIG_SCTP_HMAC_MD5=y
 CONFIG_NET_DIVERT=y
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 8364744..a53f315 100644 (file)
@@ -477,6 +477,9 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
                goto out;
        if (pos < 0)
                goto out;
+       ret = -ESPIPE;
+       if (!(file->f_mode & FMODE_PREAD))
+               goto out;
        ret = read(file, buf, count, &pos);
        if (ret > 0)
                dnotify_parent(file->f_dentry, DN_ACCESS);
@@ -511,6 +514,10 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
        if (pos < 0)
                goto out;
 
+       ret = -ESPIPE;
+       if (!(file->f_mode & FMODE_PWRITE))
+               goto out;
+
        ret = write(file, buf, count, &pos);
        if (ret > 0)
                dnotify_parent(file->f_dentry, DN_MODIFY);
index 4f19517..1c018a7 100644 (file)
@@ -136,6 +136,20 @@ config SMP
 
          If you don't know what to do here, say N.
 
+config HOTPLUG_CPU
+       bool
+       default y if SMP
+       select HOTPLUG
+
+config DISCONTIGMEM
+       bool "Discontiguous memory support (EXPERIMENTAL)"
+       depends on EXPERIMENTAL
+       help
+         Say Y to support efficient handling of discontiguous physical memory,
+         for architectures which are either NUMA (Non-Uniform Memory Access)
+         or have huge holes in the physical address space for other reasons.
+         See <file:Documentation/vm/numa> for more.
+
 config PREEMPT
        bool
 #      bool "Preemptible Kernel"
@@ -204,6 +218,24 @@ config MAGIC_SYSRQ
          keys are documented in <file:Documentation/sysrq.txt>. Don't say Y
          unless you really know what this hack does.
 
+config DEBUG_SPINLOCK
+        bool "Spinlock debugging"
+        depends on DEBUG_KERNEL
+        help
+          Say Y here and build SMP to catch missing spinlock initialization
+          and certain other kinds of spinlock errors commonly made.  This is
+          best used in conjunction with the NMI watchdog so that spinlock
+          deadlocks are also debuggable.
+
+config DEBUG_RWLOCK
+        bool "Read-write spinlock debugging"
+        depends on DEBUG_KERNEL && SMP
+        help
+          If you say Y here then read-write lock processing will count how many
+          times it has tried to get the lock and issue an error message after
+          too many attempts.  If you suspect a rwlock problem or a kernel
+          hacker asks for this option then say Y.  Otherwise say N.
+
 config FRAME_POINTER
        bool "Compile the kernel with frame pointers"
        help
index 7fe9781..276fc0d 100644 (file)
@@ -20,19 +20,23 @@ CONFIG_BROKEN_ON_SMP=y
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=16
 CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -51,11 +55,12 @@ CONFIG_KMOD=y
 # CONFIG_PA7000 is not set
 # CONFIG_PA7100LC is not set
 # CONFIG_PA7200 is not set
+# CONFIG_PA7300LC is not set
 CONFIG_PA8X00=y
 CONFIG_PA20=y
+CONFIG_PREFETCH=y
 CONFIG_PARISC64=y
 CONFIG_64BIT=y
-# CONFIG_PDC_NARROW is not set
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
 CONFIG_COMPAT=y
@@ -71,8 +76,8 @@ CONFIG_PCI_LBA=y
 CONFIG_IOSAPIC=y
 CONFIG_IOMMU_SBA=y
 # CONFIG_SUPERIO is not set
-CONFIG_CHASSIS_LCD_LED=y
-# CONFIG_PDC_CHASSIS is not set
+# CONFIG_CHASSIS_LCD_LED is not set
+CONFIG_PDC_CHASSIS=y
 
 #
 # PCMCIA/CardBus support
@@ -168,7 +173,7 @@ CONFIG_SCSI_REPORT_LUNS=y
 # SCSI Transport Attributes
 #
 CONFIG_SCSI_SPI_ATTRS=y
-# CONFIG_SCSI_FC_ATTRS is not set
+CONFIG_SCSI_FC_ATTRS=m
 
 #
 # SCSI low-level drivers
@@ -197,6 +202,7 @@ CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 CONFIG_SCSI_SYM53C8XX_IOMAPPED=y
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_PCI2000 is not set
 # CONFIG_SCSI_PCI2220I is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
@@ -219,6 +225,7 @@ CONFIG_SCSI_DEBUG=m
 #
 # CONFIG_PCMCIA_FDOMAIN is not set
 # CONFIG_PCMCIA_QLOGIC is not set
+# CONFIG_PCMCIA_SYM53C500 is not set
 
 #
 # Multi-device support (RAID and LVM)
@@ -249,6 +256,7 @@ CONFIG_FUSION_CTL=m
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Networking support
@@ -284,8 +292,6 @@ CONFIG_INET_ESP=m
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -345,6 +351,8 @@ CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
 # CONFIG_IP_NF_COMPAT_IPCHAINS is not set
 # CONFIG_IP_NF_COMPAT_IPFWADM is not set
+CONFIG_IP_NF_TARGET_NOTRACK=m
+CONFIG_IP_NF_RAW=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -353,7 +361,9 @@ CONFIG_XFRM_USER=m
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 CONFIG_LLC=m
 CONFIG_LLC2=m
 # CONFIG_IPX is not set
@@ -363,7 +373,6 @@ CONFIG_LLC2=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -375,18 +384,23 @@ CONFIG_LLC2=m
 # 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_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
 CONFIG_BONDING=m
 # CONFIG_EQUALIZER is not set
 CONFIG_TUN=m
 # CONFIG_ETHERTAP is not set
 
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
 #
 # Ethernet (10 or 100Mbit)
 #
@@ -433,7 +447,6 @@ CONFIG_8139TOO=m
 # CONFIG_8139TOO_TUNE_TWISTER is not set
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_8139_RXBUF_IDX=1
 # CONFIG_SIS900 is not set
 CONFIG_EPIC100=m
 # CONFIG_SUNDANCE is not set
@@ -452,7 +465,6 @@ CONFIG_E1000_NAPI=y
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 CONFIG_TIGON3=m
 
@@ -461,17 +473,13 @@ CONFIG_TIGON3=m
 #
 CONFIG_IXGB=m
 CONFIG_IXGB_NAPI=y
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
+CONFIG_S2IO=m
+CONFIG_S2IO_NAPI=y
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -513,19 +521,6 @@ CONFIG_AIRO_CS=m
 # CONFIG_PRISM54 is not set
 CONFIG_NET_WIRELESS=y
 
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
 #
 # PCMCIA network device support
 #
@@ -540,21 +535,23 @@ CONFIG_PCMCIA_XIRC2PS=m
 # CONFIG_PCMCIA_AXNET is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+# CONFIG_PPP_MULTILINK is not set
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+# CONFIG_PPPOE is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -751,6 +748,7 @@ CONFIG_VFAT_FS=m
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
@@ -799,7 +797,6 @@ CONFIG_SMB_NLS_REMOTE="cp437"
 CONFIG_CIFS=m
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -892,11 +889,13 @@ CONFIG_CRYPTO_CAST6=m
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
+CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
+CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=m
 CONFIG_ZLIB_DEFLATE=m
index 65f1863..b67d801 100644 (file)
@@ -21,16 +21,20 @@ CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=15
 # CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -45,8 +49,9 @@ CONFIG_OBSOLETE_MODPARM=y
 # Processor type and features
 #
 # CONFIG_PA7000 is not set
-# CONFIG_PA7100LC is not set
-CONFIG_PA7200=y
+CONFIG_PA7100LC=y
+# CONFIG_PA7200 is not set
+# CONFIG_PA7300LC is not set
 # CONFIG_PA8X00 is not set
 CONFIG_PA11=y
 # CONFIG_64BIT is not set
@@ -70,7 +75,7 @@ CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
 CONFIG_GSC_DINO=y
 # CONFIG_PCI_LBA is not set
-# CONFIG_CHASSIS_LCD_LED is not set
+CONFIG_CHASSIS_LCD_LED=y
 # CONFIG_PDC_CHASSIS is not set
 
 #
@@ -86,6 +91,7 @@ CONFIG_BINFMT_ELF=y
 #
 # Generic Driver Options
 #
+CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_DEBUG_DRIVER=y
 
 #
@@ -121,7 +127,7 @@ CONFIG_PARPORT_GSC=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_CRYPTOLOOP=y
 # CONFIG_BLK_DEV_NBD is not set
-CONFIG_BLK_DEV_CARMEL=y
+# CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_RAM is not set
 
 #
@@ -149,7 +155,6 @@ CONFIG_CHR_DEV_SG=y
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_REPORT_LUNS is not set
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 
@@ -163,6 +168,7 @@ CONFIG_SCSI_SPI_ATTRS=y
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_7000FASST is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AHA152X is not set
@@ -171,11 +177,10 @@ CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_ADVANSYS is not set
+# CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_IN2000 is not set
 # CONFIG_SCSI_MEGARAID is not set
 # CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_DTC3280 is not set
 # CONFIG_SCSI_EATA is not set
@@ -197,6 +202,7 @@ CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_ZALON is not set
 # CONFIG_SCSI_PAS16 is not set
 # CONFIG_SCSI_PSI240I is not set
@@ -278,10 +284,10 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -290,21 +296,27 @@ CONFIG_IP_PNP_BOOTP=y
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -351,15 +363,12 @@ CONFIG_TULIP=y
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_PLIP is not set
-CONFIG_PPP=y
-# CONFIG_PPP_FILTER is not set
-# CONFIG_PPP_ASYNC is not set
-# CONFIG_PPP_SYNC_TTY is not set
-# CONFIG_PPP_DEFLATE is not set
-# CONFIG_PPP_BSDCOMP is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
 
 #
 # Wireless LAN (non-hamradio)
@@ -384,33 +393,20 @@ CONFIG_NET_RADIO=y
 #
 CONFIG_NET_WIRELESS=y
 
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_FDDI is not set
+# CONFIG_PLIP is not set
+CONFIG_PPP=y
+# CONFIG_PPP_FILTER is not set
+# CONFIG_PPP_ASYNC is not set
+# CONFIG_PPP_SYNC_TTY is not set
+# CONFIG_PPP_DEFLATE is not set
+# CONFIG_PPP_BSDCOMP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
 
 #
 # ISDN subsystem
@@ -473,7 +469,6 @@ CONFIG_INPUT_MOUSE=y
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 CONFIG_INPUT_MISC=y
-# CONFIG_INPUT_PCSPKR is not set
 # CONFIG_INPUT_UINPUT is not set
 # CONFIG_HP_SDC_RTC is not set
 
@@ -542,6 +537,11 @@ CONFIG_GEN_RTC=y
 #
 # CONFIG_I2C is not set
 
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
 #
 # Misc devices
 #
@@ -560,8 +560,10 @@ CONFIG_GEN_RTC=y
 # Graphics support
 #
 CONFIG_FB=y
+# CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
+# CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 CONFIG_FB_STI=y
 # CONFIG_FB_RIVA is not set
@@ -587,7 +589,6 @@ CONFIG_DUMMY_CONSOLE_COLUMNS=160
 CONFIG_DUMMY_CONSOLE_ROWS=64
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
@@ -645,7 +646,8 @@ CONFIG_JOLIET=y
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -653,6 +655,7 @@ CONFIG_JOLIET=y
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
 # CONFIG_HUGETLB_PAGE is not set
@@ -662,6 +665,7 @@ CONFIG_RAMFS=y
 # Miscellaneous filesystems
 #
 # CONFIG_HFSPLUS_FS is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -676,6 +680,7 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
+CONFIG_NFSD_TCP=y
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
@@ -720,6 +725,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_ISO8859_8 is not set
 # CONFIG_NLS_CODEPAGE_1250 is not set
 # CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
 # CONFIG_NLS_ISO8859_1 is not set
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
@@ -741,6 +747,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SLAB is not set
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_DEBUG_SPINLOCK is not set
 CONFIG_FRAME_POINTER=y
 # CONFIG_DEBUG_INFO is not set
 
@@ -770,12 +777,16 @@ CONFIG_CRYPTO=y
 # CONFIG_CRYPTO_AES is not set
 # CONFIG_CRYPTO_CAST5 is not set
 # CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
index a0252de..087dfcd 100644 (file)
@@ -20,19 +20,23 @@ CONFIG_BROKEN_ON_SMP=y
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=16
 CONFIG_HOTPLUG=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
 CONFIG_IOSCHED_NOOP=y
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
@@ -51,8 +55,10 @@ CONFIG_KMOD=y
 # CONFIG_PA7000 is not set
 # CONFIG_PA7100LC is not set
 # CONFIG_PA7200 is not set
+# CONFIG_PA7300LC is not set
 CONFIG_PA8X00=y
 CONFIG_PA20=y
+CONFIG_PREFETCH=y
 # CONFIG_PARISC64 is not set
 # CONFIG_64BIT is not set
 # CONFIG_SMP is not set
@@ -70,7 +76,7 @@ CONFIG_PCI_LBA=y
 CONFIG_IOSAPIC=y
 CONFIG_IOMMU_SBA=y
 CONFIG_SUPERIO=y
-# CONFIG_CHASSIS_LCD_LED is not set
+CONFIG_CHASSIS_LCD_LED=y
 # CONFIG_PDC_CHASSIS is not set
 
 #
@@ -185,6 +191,7 @@ CONFIG_BLK_DEV_SIIMAGE=m
 # 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
@@ -218,7 +225,7 @@ CONFIG_SCSI_REPORT_LUNS=y
 # SCSI Transport Attributes
 #
 CONFIG_SCSI_SPI_ATTRS=y
-# CONFIG_SCSI_FC_ATTRS is not set
+CONFIG_SCSI_FC_ATTRS=m
 
 #
 # SCSI low-level drivers
@@ -236,7 +243,9 @@ CONFIG_SCSI_SATA=y
 # CONFIG_SCSI_SATA_SVW is not set
 CONFIG_SCSI_ATA_PIIX=m
 CONFIG_SCSI_SATA_PROMISE=m
+# CONFIG_SCSI_SATA_SX4 is not set
 CONFIG_SCSI_SATA_SIL=m
+# CONFIG_SCSI_SATA_SIS is not set
 CONFIG_SCSI_SATA_VIA=m
 # CONFIG_SCSI_SATA_VITESSE is not set
 # CONFIG_SCSI_BUSLOGIC is not set
@@ -254,6 +263,7 @@ CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+# CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_PCI2000 is not set
 # CONFIG_SCSI_PCI2220I is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
@@ -279,6 +289,7 @@ CONFIG_SCSI_DEBUG=m
 # CONFIG_PCMCIA_FDOMAIN is not set
 # CONFIG_PCMCIA_NINJA_SCSI is not set
 CONFIG_PCMCIA_QLOGIC=m
+# CONFIG_PCMCIA_SYM53C500 is not set
 
 #
 # Multi-device support (RAID and LVM)
@@ -346,8 +357,6 @@ CONFIG_INET_ESP=m
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 CONFIG_NETFILTER_DEBUG=y
 
@@ -407,6 +416,7 @@ CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
 CONFIG_IP_NF_COMPAT_IPCHAINS=m
 CONFIG_IP_NF_COMPAT_IPFWADM=m
+# CONFIG_IP_NF_RAW is not set
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -415,7 +425,9 @@ CONFIG_XFRM_USER=m
 #
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 CONFIG_LLC=m
 CONFIG_LLC2=m
 # CONFIG_IPX is not set
@@ -425,7 +437,6 @@ CONFIG_LLC2=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -437,18 +448,23 @@ CONFIG_LLC2=m
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 CONFIG_DUMMY=m
 CONFIG_BONDING=m
 # CONFIG_EQUALIZER is not set
 CONFIG_TUN=m
 # CONFIG_ETHERTAP is not set
 
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
 #
 # Ethernet (10 or 100Mbit)
 #
@@ -494,7 +510,6 @@ CONFIG_8139TOO=m
 # CONFIG_8139TOO_TUNE_TWISTER is not set
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_8139_RXBUF_IDX=1
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -513,7 +528,6 @@ CONFIG_E1000=m
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
 CONFIG_TIGON3=m
 
@@ -522,36 +536,17 @@ CONFIG_TIGON3=m
 #
 CONFIG_IXGB=y
 CONFIG_IXGB_NAPI=y
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
 
 #
-# Wan interfaces
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_WAN is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # PCMCIA network device support
@@ -567,21 +562,23 @@ CONFIG_PCMCIA_XIRC2PS=m
 CONFIG_PCMCIA_AXNET=m
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
-
-#
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+CONFIG_PPP=m
+# CONFIG_PPP_MULTILINK is not set
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -728,6 +725,7 @@ CONFIG_FB=y
 # CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
+# CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 CONFIG_FB_STI=y
 # CONFIG_FB_RIVA is not set
@@ -834,6 +832,7 @@ CONFIG_USB_WACOM=m
 CONFIG_USB_KBTAB=m
 # CONFIG_USB_POWERMATE is not set
 # CONFIG_USB_MTOUCH is not set
+# CONFIG_USB_EGALAX is not set
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
 
@@ -882,6 +881,8 @@ CONFIG_USB_HPUSBSCSI=m
 CONFIG_USB_LEGOTOWER=m
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETSERVO is not set
 # CONFIG_USB_TEST is not set
 
 #
@@ -932,6 +933,7 @@ CONFIG_VFAT_FS=m
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
@@ -977,7 +979,6 @@ CONFIG_SUNRPC=y
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -1070,11 +1071,13 @@ CONFIG_CRYPTO_CAST6=m
 # CONFIG_CRYPTO_ARC4 is not set
 CONFIG_CRYPTO_DEFLATE=m
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
+CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
 
 #
 # Library routines
 #
 CONFIG_CRC32=y
+CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=m
 CONFIG_ZLIB_DEFLATE=m
index 9fc0614..eadc88c 100644 (file)
@@ -69,7 +69,7 @@ update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
 {
        struct page *page = pte_page(pte);
 
-       if (VALID_PAGE(page) && page_mapping(page) &&
+       if (pfn_valid(page_to_pfn(page)) && page_mapping(page) &&
            test_bit(PG_dcache_dirty, &page->flags)) {
 
                flush_kernel_dcache_page(page_address(page));
@@ -82,10 +82,11 @@ show_cache_info(struct seq_file *m)
 {
        seq_printf(m, "I-cache\t\t: %ld KB\n", 
                cache_info.ic_size/1024 );
-       seq_printf(m, "D-cache\t\t: %ld KB (%s)%s\n", 
+       seq_printf(m, "D-cache\t\t: %ld KB (%s%s, %d-way associative)\n", 
                cache_info.dc_size/1024,
                (cache_info.dc_conf.cc_wt ? "WT":"WB"),
-               (cache_info.dc_conf.cc_sh ? " - shared I/D":"")
+               (cache_info.dc_conf.cc_sh ? ", shared I/D":""),
+               (cache_info.dc_conf.cc_assoc)
        );
 
        seq_printf(m, "ITLB entries\t: %ld\n" "DTLB entries\t: %ld%s\n",
@@ -123,51 +124,60 @@ parisc_cache_init(void)
                panic("parisc_cache_init: pdc_cache_info failed");
 
 #if 0
-       printk(KERN_DEBUG "ic_size %lx dc_size %lx it_size %lx pdc_cache_info %d*long pdc_cache_cf %d\n",
-           cache_info.ic_size,
-           cache_info.dc_size,
-           cache_info.it_size,
-           sizeof (struct pdc_cache_info) / sizeof (long),
-           sizeof (struct pdc_cache_cf)
-       );
-
-       printk(KERN_DEBUG "dc base %x dc stride %x dc count %x dc loop %d\n",
-           cache_info.dc_base,
-           cache_info.dc_stride,
-           cache_info.dc_count,
-           cache_info.dc_loop);
-
-       printk(KERN_DEBUG "dc conf: alias %d block %d line %d wt %d sh %d cst %d assoc %d\n",
-           cache_info.dc_conf.cc_alias,
-           cache_info.dc_conf.cc_block,
-           cache_info.dc_conf.cc_line,
-           cache_info.dc_conf.cc_wt,
-           cache_info.dc_conf.cc_sh,
-           cache_info.dc_conf.cc_cst,
-           cache_info.dc_conf.cc_assoc);
-
-       printk(KERN_DEBUG "ic conf: alias %d block %d line %d wt %d sh %d cst %d assoc %d\n",
-           cache_info.ic_conf.cc_alias,
-           cache_info.ic_conf.cc_block,
-           cache_info.ic_conf.cc_line,
-           cache_info.ic_conf.cc_wt,
-           cache_info.ic_conf.cc_sh,
-           cache_info.ic_conf.cc_cst,
-           cache_info.ic_conf.cc_assoc);
-
-       printk(KERN_DEBUG "dt conf: sh %d page %d cst %d aid %d pad1 %d \n",
-           cache_info.dt_conf.tc_sh,
-           cache_info.dt_conf.tc_page,
-           cache_info.dt_conf.tc_cst,
-           cache_info.dt_conf.tc_aid,
-           cache_info.dt_conf.tc_pad1);
-
-       printk(KERN_DEBUG "it conf: sh %d page %d cst %d aid %d pad1 %d \n",
-           cache_info.it_conf.tc_sh,
-           cache_info.it_conf.tc_page,
-           cache_info.it_conf.tc_cst,
-           cache_info.it_conf.tc_aid,
-           cache_info.it_conf.tc_pad1);
+       printk("ic_size %lx dc_size %lx it_size %lx\n",
+               cache_info.ic_size,
+               cache_info.dc_size,
+               cache_info.it_size);
+
+       printk("DC  base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx\n",
+               cache_info.dc_base,
+               cache_info.dc_stride,
+               cache_info.dc_count,
+               cache_info.dc_loop);
+
+       printk("dc_conf = 0x%lx  alias %d blk %d line %d shift %d\n",
+               *(unsigned long *) (&cache_info.dc_conf),
+               cache_info.dc_conf.cc_alias,
+               cache_info.dc_conf.cc_block,
+               cache_info.dc_conf.cc_line,
+               cache_info.dc_conf.cc_shift);
+       printk("        wt %d sh %d cst %d assoc %d\n",
+               cache_info.dc_conf.cc_wt,
+               cache_info.dc_conf.cc_sh,
+               cache_info.dc_conf.cc_cst,
+               cache_info.dc_conf.cc_assoc);
+
+       printk("IC  base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx\n",
+               cache_info.ic_base,
+               cache_info.ic_stride,
+               cache_info.ic_count,
+               cache_info.ic_loop);
+
+       printk("ic_conf = 0x%lx  alias %d blk %d line %d shift %d\n",
+               *(unsigned long *) (&cache_info.ic_conf),
+               cache_info.ic_conf.cc_alias,
+               cache_info.ic_conf.cc_block,
+               cache_info.ic_conf.cc_line,
+               cache_info.ic_conf.cc_shift);
+       printk("        wt %d sh %d cst %d assoc %d\n",
+               cache_info.ic_conf.cc_wt,
+               cache_info.ic_conf.cc_sh,
+               cache_info.ic_conf.cc_cst,
+               cache_info.ic_conf.cc_assoc);
+
+       printk("D-TLB conf: sh %d page %d cst %d aid %d pad1 %d \n",
+               cache_info.dt_conf.tc_sh,
+               cache_info.dt_conf.tc_page,
+               cache_info.dt_conf.tc_cst,
+               cache_info.dt_conf.tc_aid,
+               cache_info.dt_conf.tc_pad1);
+
+       printk("I-TLB conf: sh %d page %d cst %d aid %d pad1 %d \n",
+               cache_info.it_conf.tc_sh,
+               cache_info.it_conf.tc_page,
+               cache_info.it_conf.tc_cst,
+               cache_info.it_conf.tc_aid,
+               cache_info.it_conf.tc_pad1);
 #endif
 
        split_tlb = 0;
@@ -179,10 +189,14 @@ parisc_cache_init(void)
                split_tlb = 1;
        }
 
-       dcache_stride = (1 << (cache_info.dc_conf.cc_block + 3)) *
-                                               cache_info.dc_conf.cc_line;
-       icache_stride = (1 << (cache_info.ic_conf.cc_block + 3)) *
-                                               cache_info.ic_conf.cc_line;
+       /* "New and Improved" version from Jim Hull 
+        *      (1 << (cc_block-1)) * (cc_line << (4 + cnf.cc_shift))
+        */
+#define CAFL_STRIDE(cnf) (cnf.cc_line << (3 + cnf.cc_block + cnf.cc_shift))
+       dcache_stride = CAFL_STRIDE(cache_info.dc_conf);
+       icache_stride = CAFL_STRIDE(cache_info.ic_conf);
+#undef CAFL_STRIDE
+
 #ifndef CONFIG_PA20
        if (pdc_btlb_info(&btlb_info) < 0) {
                memset(&btlb_info, 0, sizeof btlb_info);
@@ -191,8 +205,8 @@ parisc_cache_init(void)
 
        if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) ==
                                                PDC_MODEL_NVA_UNSUPPORTED) {
-               printk(KERN_WARNING "Only equivalent aliasing supported\n");
-#ifndef CONFIG_SMP
+               printk(KERN_WARNING "parisc_cache_init: Only equivalent aliasing supported!\n");
+#if 0
                panic("SMP kernel required to avoid non-equivalent aliasing");
 #endif
        }
@@ -228,7 +242,7 @@ void disable_sr_hashing(void)
        disable_sr_hashing_asm(srhash_type);
 }
 
-void __flush_dcache_page(struct page *page)
+void flush_dcache_page(struct page *page)
 {
        struct address_space *mapping = page_mapping(page);
        struct vm_area_struct *mpnt = NULL;
@@ -236,6 +250,14 @@ void __flush_dcache_page(struct page *page)
        unsigned long offset;
        unsigned long addr;
        pgoff_t pgoff;
+       pte_t *pte;
+       unsigned long pfn = page_to_pfn(page);
+
+
+       if (mapping && !mapping_mapped(mapping)) {
+               set_bit(PG_dcache_dirty, &page->flags);
+               return;
+       }
 
        flush_kernel_dcache_page(page_address(page));
 
@@ -262,16 +284,23 @@ void __flush_dcache_page(struct page *page)
                 * isn't there, there's no point exciting the
                 * nadtlb handler into a nullification frenzy */
 
-               if (!translation_exists(mpnt, addr))
+
+               if(!(pte = translation_exists(mpnt, addr)))
                        continue;
 
+               /* make sure we really have this page: the private
+                * mappings may cover this area but have COW'd this
+                * particular page */
+               if(pte_pfn(*pte) != pfn)
+                       continue;
+
                __flush_cache_page(mpnt, addr);
 
                break;
        }
        flush_dcache_mmap_unlock(mapping);
 }
-EXPORT_SYMBOL(__flush_dcache_page);
+EXPORT_SYMBOL(flush_dcache_page);
 
 /* Defined in arch/parisc/kernel/pacache.S */
 EXPORT_SYMBOL(flush_kernel_dcache_range_asm);
index 9c28494..baee632 100644 (file)
        /* Look up a PTE in a 2-Level scheme (faulting at each
         * level if the entry isn't present 
         *
-        * NOTE: we use ldw even for LP64 because our pte
-        * and pmd are allocated <4GB */
+        * NOTE: we use ldw even for LP64, since the short pointers
+        * can address up to 1TB
+        */
        .macro          L2_ptep pmd,pte,index,va,fault
 #if PT_NLEVELS == 3
        EXTR            \va,31-ASM_PMD_SHIFT,ASM_BITS_PER_PMD,\index
 #else
        EXTR            \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index
 #endif
-       DEP             %r0,31,PAGE_SHIFT,\pmd  /* clear offset */
+       DEP             %r0,31,PAGE_SHIFT,\pmd  /* clear offset */
        copy            %r0,\pte
        ldw,s           \index(\pmd),\pmd
+       bb,>=,n         \pmd,_PxD_PRESENT_BIT,\fault
+       DEP             %r0,31,PxD_FLAG_SHIFT,\pmd /* clear flags */
+       copy            \pmd,%r9
+#ifdef __LP64__
+       shld            %r9,PxD_VALUE_SHIFT,\pmd
+#else
+       shlw            %r9,PxD_VALUE_SHIFT,\pmd
+#endif
        EXTR            \va,31-PAGE_SHIFT,ASM_BITS_PER_PTE,\index
-       bb,>=,n         \pmd,_PAGE_PRESENT_BIT,\fault
-       DEP             %r0,31,PAGE_SHIFT,\pmd  /* clear offset */
+       DEP             %r0,31,PAGE_SHIFT,\pmd  /* clear offset */
        shladd          \index,BITS_PER_PTE_ENTRY,\pmd,\pmd
        LDREG           %r0(\pmd),\pte          /* pmd is now pte */
        bb,>=,n         \pte,_PAGE_PRESENT_BIT,\fault
        copy            %r0,\pte
        extrd,u,*=      \va,31,32,%r0
        ldw,s           \index(\pgd),\pgd
+       extrd,u,*=      \va,31,32,%r0
+       bb,>=,n         \pgd,_PxD_PRESENT_BIT,\fault
+       extrd,u,*=      \va,31,32,%r0
+       shld            \pgd,PxD_VALUE_SHIFT,\index
+       extrd,u,*=      \va,31,32,%r0
+       copy            \index,\pgd
        extrd,u,*<>     \va,31,32,%r0
        ldo             ASM_PGD_PMD_OFFSET(\pgd),\pgd
-       extrd,u,*=      \va,31,32,%r0
-       bb,>=,n         \pgd,_PAGE_PRESENT_BIT,\fault
        L2_ptep         \pgd,\pte,\index,\va,\fault
        .endm
 
 
        /* Set the dirty bit (and accessed bit).  No need to be
         * clever, this is only used from the dirty fault */
-       .macro          update_dirty    ptep,pte,tmp,tmp1
+       .macro          update_dirty    ptep,pte,tmp
        ldi             _PAGE_ACCESSED|_PAGE_DIRTY,\tmp
        or              \tmp,\pte,\pte
        STREG           \pte,0(\ptep)
@@ -783,7 +795,7 @@ __kernel_thread:
 ret_from_kernel_thread:
 
        /* Call schedule_tail first though */
-       bl      schedule_tail, %r2
+       BL      schedule_tail, %r2
        nop
 
        LDREG   TI_TASK-THREAD_SZ_ALGN(%r30), %r1
@@ -1441,14 +1453,14 @@ nadtlb_emulate:
        and             %r9,%r16,%r17
        cmpb,<>,n       %r16,%r17,nadtlb_fault /* Not fdc,fic,pdc */
        bb,>=,n         %r9,26,nadtlb_nullify  /* m bit not set, just nullify */
-       b,l             get_register,%r25
+       BL              get_register,%r25
        extrw,u         %r9,15,5,%r8           /* Get index register # */
        CMPIB=,n        -1,%r1,nadtlb_fault    /* have to use slow path */
        copy            %r1,%r24
-       b,l             get_register,%r25
+       BL              get_register,%r25
        extrw,u         %r9,10,5,%r8           /* Get base register # */
        CMPIB=,n        -1,%r1,nadtlb_fault    /* have to use slow path */
-       b,l             set_register,%r25
+       BL              set_register,%r25
        add,l           %r1,%r24,%r1           /* doesn't affect c/b bits */
 
 nadtlb_nullify:
@@ -1548,7 +1560,7 @@ dbit_spin_20w:
 
 dbit_nolock_20w:
 #endif
-       update_dirty    ptp,pte,t0,t1
+       update_dirty    ptp,pte,t1
 
        make_insert_tlb spc,pte,prot
                
@@ -1585,7 +1597,7 @@ dbit_spin_11:
 
 dbit_nolock_11:
 #endif
-       update_dirty    ptp,pte,t0,t1
+       update_dirty    ptp,pte,t1
 
        make_insert_tlb_11      spc,pte,prot
 
@@ -1626,11 +1638,11 @@ dbit_spin_20:
 
 dbit_nolock_20:
 #endif
-       update_dirty    ptp,pte,t0,t1
+       update_dirty    ptp,pte,t1
 
        make_insert_tlb spc,pte,prot
 
-       f_extend        pte,t0
+       f_extend        pte,t1
        
         idtlbt          pte,prot
 
index 8127a70..6ab67aa 100644 (file)
@@ -65,6 +65,7 @@
 
 #include <asm/page.h>
 #include <asm/pdc.h>
+#include <asm/pdcpat.h>
 #include <asm/system.h>
 #include <asm/processor.h>     /* for boot_cpu_data */
 
@@ -176,7 +177,9 @@ void __init set_firmware_width(void)
  */
 void pdc_emergency_unlock(void)
 {
-        spin_unlock(&pdc_lock);
+       /* Spinlock DEBUG code freaks out if we unconditionally unlock */
+        if (spin_is_locked(&pdc_lock))
+               spin_unlock(&pdc_lock);
 }
 
 
@@ -234,11 +237,11 @@ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_inf
 #ifdef __LP64__
 int pdc_pat_chassis_send_log(unsigned long state, unsigned long data)
 {
+       int retval = 0;
+        
        if (!is_pdc_pat())
                return -1;
 
-       int retval = 0;
-
        spin_lock_irq(&pdc_lock);
        retval = mem_pdc_call(PDC_PAT_CHASSIS_LOG, PDC_PAT_CHASSIS_WRITE_LOG, __pa(&state), __pa(&data));
        spin_unlock_irq(&pdc_lock);
@@ -1146,6 +1149,49 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
 
        return retval;
 }
+
+/**
+ * pdc_pat_io_pci_cfg_read - Read PCI configuration space.
+ * @pci_addr: PCI configuration space address for which the read request is being made.
+ * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4. 
+ * @mem_addr: Pointer to return memory buffer.
+ *
+ */
+int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *mem_addr)
+{
+       int retval;
+       spin_lock_irq(&pdc_lock);
+       retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_READ,
+                                       __pa(pdc_result), pci_addr, pci_size);
+       switch(pci_size) {
+               case 1: *(u8 *) mem_addr =  (u8)  pdc_result[0];
+               case 2: *(u16 *)mem_addr =  (u16) pdc_result[0];
+               case 4: *(u32 *)mem_addr =  (u32) pdc_result[0];
+       }
+       spin_unlock_irq(&pdc_lock);
+
+       return retval;
+}
+
+/**
+ * pdc_pat_io_pci_cfg_write - Retrieve information about memory address ranges.
+ * @pci_addr: PCI configuration space address for which the write  request is being made.
+ * @pci_size: Size of write in bytes. Valid values are 1, 2, and 4. 
+ * @value: Pointer to 1, 2, or 4 byte value in low order end of argument to be 
+ *         written to PCI Config space.
+ *
+ */
+int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val)
+{
+       int retval;
+
+       spin_lock_irq(&pdc_lock);
+       retval = mem_pdc_call(PDC_PAT_IO, PDC_PAT_IO_PCI_CONFIG_WRITE,
+                               pci_addr, pci_size, val);
+       spin_unlock_irq(&pdc_lock);
+
+       return retval;
+}
 #endif /* __LP64__ */
 
 
@@ -1230,29 +1276,29 @@ struct wide_stack {
 long real64_call(unsigned long fn, ...)
 {
        va_list args;
-       extern struct wide_stack real_stack;
+       extern struct wide_stack real64_stack __attribute__ ((alias ("real_stack")));
        extern unsigned long real64_call_asm(unsigned long *,
                                             unsigned long *, 
                                             unsigned long);
     
        va_start(args, fn);
-       real_stack.arg0 = va_arg(args, unsigned long);
-       real_stack.arg1 = va_arg(args, unsigned long);
-       real_stack.arg2 = va_arg(args, unsigned long);
-       real_stack.arg3 = va_arg(args, unsigned long);
-       real_stack.arg4 = va_arg(args, unsigned long);
-       real_stack.arg5 = va_arg(args, unsigned long);
-       real_stack.arg6 = va_arg(args, unsigned long);
-       real_stack.arg7 = va_arg(args, unsigned long);
-       real_stack.arg8 = va_arg(args, unsigned long);
-       real_stack.arg9 = va_arg(args, unsigned long);
-       real_stack.arg10 = va_arg(args, unsigned long);
-       real_stack.arg11 = va_arg(args, unsigned long);
-       real_stack.arg12 = va_arg(args, unsigned long);
-       real_stack.arg13 = va_arg(args, unsigned long);
+       real64_stack.arg0 = va_arg(args, unsigned long);
+       real64_stack.arg1 = va_arg(args, unsigned long);
+       real64_stack.arg2 = va_arg(args, unsigned long);
+       real64_stack.arg3 = va_arg(args, unsigned long);
+       real64_stack.arg4 = va_arg(args, unsigned long);
+       real64_stack.arg5 = va_arg(args, unsigned long);
+       real64_stack.arg6 = va_arg(args, unsigned long);
+       real64_stack.arg7 = va_arg(args, unsigned long);
+       real64_stack.arg8 = va_arg(args, unsigned long);
+       real64_stack.arg9 = va_arg(args, unsigned long);
+       real64_stack.arg10 = va_arg(args, unsigned long);
+       real64_stack.arg11 = va_arg(args, unsigned long);
+       real64_stack.arg12 = va_arg(args, unsigned long);
+       real64_stack.arg13 = va_arg(args, unsigned long);
        va_end(args);
        
-       return real64_call_asm(&real_stack.sp, &real_stack.arg0, fn);
+       return real64_call_asm(&real64_stack.sp, &real64_stack.arg0, fn);
 }
 
 #endif /* __LP64__ */
index b423e7d..6b65bf4 100644 (file)
@@ -263,6 +263,17 @@ static struct hp_hardware hp_hardware_list[] __initdata = {
        {HPHW_NPROC,0x67E,0x4,0x81,"Hitachi Tiny 80"},
        {HPHW_NPROC,0x67F,0x4,0x81,"Hitachi Tiny 64"},
        {HPHW_NPROC,0x700,0x4,0x91,"NEC Aska Processor"},
+       {HPHW_NPROC,0x880,0x4,0x91,"Orca Mako"},
+       {HPHW_NPROC,0x881,0x4,0x91,"Everest Mako"},
+       {HPHW_NPROC,0x882,0x4,0x91,"Rainier/Medel Mako Slow"},
+       {HPHW_NPROC,0x883,0x4,0x91,"Rainier/Medel Mako Fast"},
+       {HPHW_NPROC,0x884,0x4,0x91,"Mt. Hamilton"},
+       {HPHW_NPROC,0x885,0x4,0x91,"Mt. Hamilton DC-"},
+       {HPHW_NPROC,0x886,0x4,0x91,"Storm Peak Slow DC-"},
+       {HPHW_NPROC,0x887,0x4,0x91,"Storm Peak Slow"},
+       {HPHW_NPROC,0x888,0x4,0x91,"Storm Peak Fast DC-"},
+       {HPHW_NPROC,0x889,0x4,0x91,"Storm Peak Fast"},
+       {HPHW_NPROC,0x88A,0x4,0x91,"Crestone Peak"},
        {HPHW_A_DIRECT, 0x004, 0x0000D, 0x00, "Arrakis MUX"}, 
        {HPHW_A_DIRECT, 0x005, 0x0000D, 0x00, "Dyun Kiuh MUX"}, 
        {HPHW_A_DIRECT, 0x006, 0x0000D, 0x00, "Baat Kiuh AP/MUX (40299B)"}, 
@@ -535,14 +546,17 @@ static struct hp_hardware hp_hardware_list[] __initdata = {
        {HPHW_BCPORT, 0x800, 0x0000C, 0x10, "DEW BC Merced Port"}, 
        {HPHW_BCPORT, 0x801, 0x0000C, 0x10, "SMC Bus Interface Merced Bus0"}, 
        {HPHW_BCPORT, 0x802, 0x0000C, 0x10, "SMC Bus INterface Merced Bus1"}, 
-       {HPHW_BCPORT, 0x803, 0x0000C, 0x10, "IKE I/O Bus Converter Merced Port"}, 
-       {HPHW_BCPORT, 0x781, 0x0000C, 0x00, "IKE I/O Bus Converter Ropes Port"}, 
-       {HPHW_BCPORT, 0x804, 0x0000C, 0x10, "REO I/O Bus Converter Merced Port"}, 
-       {HPHW_BCPORT, 0x782, 0x0000C, 0x00, "REO I/O Bus Converter Ropes Port"}, 
+       {HPHW_BCPORT, 0x803, 0x0000C, 0x10, "IKE I/O BC Merced Port"}, 
+       {HPHW_BCPORT, 0x781, 0x0000C, 0x00, "IKE I/O BC Ropes Port"}, 
+       {HPHW_BCPORT, 0x804, 0x0000C, 0x10, "REO I/O BC Merced Port"}, 
+       {HPHW_BCPORT, 0x782, 0x0000C, 0x00, "REO I/O BC Ropes Port"}, 
+       {HPHW_BCPORT, 0x784, 0x0000C, 0x00, "Pluto I/O BC Ropes Port"}, 
        {HPHW_BRIDGE, 0x680, 0x0000A, 0x00, "Dino PCI Bridge"}, 
        {HPHW_BRIDGE, 0x682, 0x0000A, 0x00, "Cujo PCI Bridge"}, 
        {HPHW_BRIDGE, 0x782, 0x0000A, 0x00, "Elroy PCI Bridge"}, 
        {HPHW_BRIDGE, 0x583, 0x000A5, 0x00, "Saga PCI Bridge"}, 
+       {HPHW_BRIDGE, 0x783, 0x0000A, 0x00, "Mercury PCI Bridge"}, 
+       {HPHW_BRIDGE, 0x784, 0x0000A, 0x00, "Quicksilver AGP Bridge"}, 
        {HPHW_B_DMA, 0x004, 0x00018, 0x00, "Parallel I/O"}, 
        {HPHW_B_DMA, 0x004, 0x00019, 0x00, "Parallel RDB"}, 
        {HPHW_B_DMA, 0x004, 0x00020, 0x80, "MID_BUS PSI"}, 
@@ -1181,15 +1195,18 @@ static struct hp_hardware hp_hardware_list[] __initdata = {
        {HPHW_IOA, 0x581, 0x0000B, 0x10, "Uturn-IOA BC Runway Port"},
        {HPHW_IOA, 0x582, 0x0000B, 0x10, "Astro BC Runway Port"},
        {HPHW_IOA, 0x700, 0x0000B, 0x00, "NEC-IOS BC System Bus Port"},
+       {HPHW_IOA, 0x880, 0x0000C, 0x10, "Pluto BC McKinley Port"},
        {HPHW_MEMORY, 0x002, 0x00008, 0x00, "MID_BUS"}, 
        {HPHW_MEMORY, 0x063, 0x00009, 0x00, "712/132 L2 Upgrade"}, 
        {HPHW_MEMORY, 0x064, 0x00009, 0x00, "712/160 L2 Upgrade"}, 
        {HPHW_MEMORY, 0x065, 0x00009, 0x00, "715/132 L2 Upgrade"}, 
        {HPHW_MEMORY, 0x066, 0x00009, 0x00, "715/160 L2 Upgrade"},
+       {HPHW_MEMORY, 0x0AF, 0x00009, 0x00, "Everest Mako Memory"},
        {HPHW_OTHER, 0x004, 0x00030, 0x00, "Master"}, 
        {HPHW_OTHER, 0x004, 0x00034, 0x00, "Slave"}, 
        {HPHW_OTHER, 0x004, 0x00038, 0x00, "EDU"}, 
        {HPHW_OTHER, 0x004, 0x00049, 0x00, "LGB Control"}, 
+       {HPHW_MC, 0x004, 0x000C0, 0x00, "BMC IPMI Mgmt Ctlr"}, 
        {HPHW_FAULTY, 0, }  /* Special Marker for last entry */
 };
 
@@ -1290,7 +1307,7 @@ char *cpu_name_version[][2] = {
        [pcxw]  { "PA8500 (PCX-W)",     "2.0" },
        [pcxw_] { "PA8600 (PCX-W+)",    "2.0" },
        [pcxw2] { "PA8700 (PCX-W2)",    "2.0" },
-       [mako]  { "PA8800 (MAKO)",      "2.0" }
+       [mako]  { "PA8800 (Mako)",      "2.0" }
 };
 
 const char * __init
index 0297d41..a3525f1 100644 (file)
@@ -76,7 +76,8 @@ $bss_loop:
        /* Initialize startup VM. Just map first 8 MB of memory */
        ldil            L%PA(pg0),%r1
        ldo             R%PA(pg0)(%r1),%r1
-       ldo             _PAGE_TABLE(%r1),%r3
+       shr             %r1,PxD_VALUE_SHIFT,%r3
+       ldo             (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3
 
        ldil            L%PA(swapper_pg_dir),%r4
        ldo             R%PA(swapper_pg_dir)(%r4),%r4
@@ -86,7 +87,7 @@ $bss_loop:
        ldo             ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4),%r4
 1:
        stw             %r3,0(%r4)
-       ldo             ASM_PAGE_SIZE(%r3),%r3
+       ldo             (ASM_PAGE_SIZE >> PxD_VALUE_SHIFT)(%r3),%r3
        addib,>         -1,%r1,1b
        ldo             ASM_PGD_ENTRY_SIZE(%r4),%r4
 
@@ -266,6 +267,8 @@ smp_slave_stext:
        ldil            L%PA(smp_init_current_idle_task),%sp
        ldo             R%PA(smp_init_current_idle_task)(%sp),%sp
        ldw             0(%sp),%sp      /* load task address */
+       tophys_r1       %sp
+       ldw             TASK_THREAD_INFO(%sp), %sp
        mtctl           %sp,%cr30       /* store in cr30 */
        addil           L%THREAD_SZ_ALGN,%sp    /* stack is above task */
        ldo             R%THREAD_SZ_ALGN(%r1),%sp
index 78d8bad..587a339 100644 (file)
@@ -80,7 +80,8 @@ $bss_loop:
 
        ldil            L%PA(pmd0),%r5
        ldo             R%PA(pmd0)(%r5),%r5
-       ldo             _PAGE_TABLE(%r5),%r3
+       shrd            %r5,PxD_VALUE_SHIFT,%r3
+       ldo             (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3
 
        ldil            L%PA(swapper_pg_dir),%r4
        ldo             R%PA(swapper_pg_dir)(%r4),%r4
@@ -90,16 +91,17 @@ $bss_loop:
 
        stw             %r3,ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4)
 
-       ldo             _PAGE_TABLE(%r1),%r3
+       shrd            %r1,PxD_VALUE_SHIFT,%r3
+       ldo             (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3
        ldo             ASM_PMD_ENTRY*ASM_PMD_ENTRY_SIZE(%r5),%r5
        ldi             ASM_PT_INITIAL,%r1
 1:
        stw             %r3,0(%r5)
-       ldo             ASM_PAGE_SIZE(%r3),%r3
+       ldo             (ASM_PAGE_SIZE >> PxD_VALUE_SHIFT)(%r3),%r3
        addib,>         -1,%r1,1b
        ldo             ASM_PMD_ENTRY_SIZE(%r5),%r5
 
-       ldo             _PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */
+       ldo             _PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */
        ldil            L%PA(pg0),%r1
        ldo             R%PA(pg0)(%r1),%r1
 
@@ -299,6 +301,7 @@ smp_slave_stext:
        /*  Initialize the SP - monarch sets up smp_init_current_idle_task */
        load32          PA(smp_init_current_idle_task),%sp
        ldd             0(%sp),%sp      /* load task address */
+       tophys_r1       %sp
        ldd             TASK_THREAD_INFO(%sp), %sp
        mtctl           %sp,%cr30       /* store in cr30 */
        ldo             THREAD_SZ_ALGN(%sp),%sp
index ca1acad..0073974 100644 (file)
@@ -121,12 +121,6 @@ struct irqaction cpu_irq_actions[IRQ_PER_REGION] = {
 #endif
 };
 
-struct irq_region_ops cpu_irq_ops = {
-       .disable_irq    = disable_cpu_irq,
-       .enable_irq     = enable_cpu_irq,
-       .mask_irq       = unmask_cpu_irq,
-       .unmask_irq     = unmask_cpu_irq
-};
 
 struct irq_region cpu0_irq_region = {
        .ops    = {
@@ -200,8 +194,8 @@ void enable_irq(int irq)
 {
        struct irq_region *region;
 
-       DBG_IRQ(irq, ("enable_irq(%d) %d+%d eiem 0x%lx\n", irq,
-                               IRQ_REGION(irq), IRQ_OFFSET(irq), cpu_eiem));
+       DBG_IRQ(irq, ("enable_irq(%d) %d+%d EIRR 0x%lx EIEM 0x%lx\n", irq,
+                               IRQ_REGION(irq), IRQ_OFFSET(irq), mfctl(23), mfctl(15)));
        irq = irq_canonicalize(irq);
        region = irq_region[IRQ_REGION(irq)];
 
@@ -221,8 +215,9 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_puts(p, "     ");
 #ifdef CONFIG_SMP
                for (i = 0; i < NR_CPUS; i++)
+                       if (cpu_online(i))
 #endif
-                       seq_printf(p, "      CPU%02d ", i);
+                               seq_printf(p, "      CPU%02d ", i);
 
 #ifdef PARISC_IRQ_CR16_COUNTS
                seq_printf(p, "[min/avg/max] (CPU cycle counts)");
@@ -250,6 +245,7 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_printf(p, "%3d: ", irq_no);
 #ifdef CONFIG_SMP
                for (; j < NR_CPUS; j++)
+                       if (cpu_online(j))
 #endif
                  seq_printf(p, "%10u ", kstat_cpu(j).irqs[irq_no]);
 
@@ -338,7 +334,8 @@ txn_alloc_addr(int virt_irq)
        next_cpu++; /* assign to "next" CPU we want this bugger on */
 
        /* validate entry */
-       while ((next_cpu < NR_CPUS) && !cpu_data[next_cpu].txn_addr)
+       while ((next_cpu < NR_CPUS) && (!cpu_data[next_cpu].txn_addr || 
+               !cpu_online(next_cpu)))
                next_cpu++;
 
        if (next_cpu >= NR_CPUS) 
@@ -390,7 +387,7 @@ void do_irq(struct irqaction *action, int irq, struct pt_regs * regs)
        irq_enter();
        ++kstat_cpu(cpu).irqs[irq];
 
-       DBG_IRQ(irq, ("do_irq(%d) %d+%d\n", irq, IRQ_REGION(irq), IRQ_OFFSET(irq)));
+       DBG_IRQ(irq, ("do_irq(%d) %d+%d eiem 0x%lx\n", irq, IRQ_REGION(irq), IRQ_OFFSET(irq), cpu_eiem));
 
        for (; action; action = action->next) {
 #ifdef PARISC_IRQ_CR16_COUNTS
@@ -460,7 +457,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
 
 #ifdef DEBUG_IRQ
                if (eirr_val != (1UL << MAX_CPU_IRQ))
-                       printk(KERN_DEBUG "do_cpu_irq_mask  %x\n", eirr_val);
+                       printk(KERN_DEBUG "do_cpu_irq_mask  0x%x & 0x%x\n", eirr_val, cpu_eiem);
 #endif
 
                /* Work our way from MSb to LSb...same order we alloc EIRs */
@@ -865,7 +862,7 @@ EXPORT_SYMBOL(probe_irq_mask);
 void __init init_IRQ(void)
 {
        local_irq_disable();    /* PARANOID - should already be disabled */
-       mtctl(-1L, 23);         /* EIRR : clear all pending external intr */
+       mtctl(~0UL, 23);        /* EIRR : clear all pending external intr */
 #ifdef CONFIG_SMP
        if (!cpu_eiem)
                cpu_eiem = EIEM_MASK(IPI_IRQ) | EIEM_MASK(TIMER_IRQ);
index 5595f3b..ebbcbf2 100644 (file)
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
 
+#ifdef DEBUG_PCI
+#undef ASSERT
+#define ASSERT(expr) \
+       if(!(expr)) { \
+               printk("\n%s:%d: Assertion " #expr " failed!\n", \
+                               __FILE__, __LINE__); \
+               panic(#expr); \
+       }
+#else
+#define ASSERT(expr)
+#endif
+
+
 static struct proc_dir_entry * proc_gsc_root = NULL;
 static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
 static unsigned long pcxl_used_bytes = 0;
index f04dea6..dd938ef 100644 (file)
@@ -380,18 +380,14 @@ get_wchan(struct task_struct *p)
        /*
         * These bracket the sleeping functions..
         */
-#      define first_sched      ((unsigned long) scheduling_functions_start_here)
-#      define last_sched       ((unsigned long) scheduling_functions_end_here)
 
        unwind_frame_init_from_blocked_task(&info, p);
        do {
                if (unwind_once(&info) < 0)
                        return 0;
                ip = info.ip;
-               if (ip < first_sched || ip >= last_sched)
+               if (!in_sched_functions(ip))
                        return ip;
        } while (count++ < 16);
        return 0;
-#      undef first_sched
-#      undef last_sched
 }
index dd7f239..b4931ad 100644 (file)
 #include <linux/module.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
+#include <linux/cpu.h>
 
 #include <asm/cache.h>
 #include <asm/hardware.h>      /* for register_parisc_driver() stuff */
 #include <asm/processor.h>
 #include <asm/page.h>
 #include <asm/pdc.h>
+#include <asm/pdcpat.h>
 #include <asm/irq.h>           /* for struct irq_region */
 #include <asm/parisc-device.h>
 
@@ -187,6 +189,17 @@ static int __init processor_probe(struct parisc_device *dev)
                cpu_irq_actions[cpuid] = actions;
        }
 #endif
+
+       /* 
+        * Bring this CPU up now! (ignore bootstrap cpuid == 0)
+        */
+#ifdef CONFIG_SMP
+       if (cpuid) {
+               cpu_set(cpuid, cpu_present_map);
+               cpu_up(cpuid);
+       }
+#endif
+
        return 0;
 }
 
index 899fd73..3637b0a 100644 (file)
 
        .section        .bss
        .export real_stack
+       .export real32_stack
+       .export real64_stack
        .align  64
 real_stack:
+real32_stack:
+real64_stack:
        .block  8192
 
 #ifdef __LP64__
index bcc9e37..37bd6a6 100644 (file)
@@ -51,6 +51,8 @@ char  command_line[COMMAND_LINE_SIZE];
 /* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
 struct proc_dir_entry * proc_runway_root = NULL;
 struct proc_dir_entry * proc_gsc_root = NULL;
+struct proc_dir_entry * proc_mckinley_root = NULL;
+
 
 void __init setup_cmdline(char **cmdline_p)
 {
@@ -206,12 +208,17 @@ static void __init parisc_proc_mkdir(void)
         case pcxw:
         case pcxw_:
         case pcxw2:
-       case mako:      /* XXX : this is really mckinley bus */
                 if (NULL == proc_runway_root)
                 {
                         proc_runway_root = proc_mkdir("bus/runway", 0);
                 }
                 break;
+       case mako:
+                if (NULL == proc_mckinley_root)
+                {
+                        proc_mckinley_root = proc_mkdir("bus/mckinley", 0);
+                }
+                break;
        default:
                /* FIXME: this was added to prevent the compiler 
                 * complaining about missing pcx, pcxs and pcxt
index 77be8d4..0f1daa5 100644 (file)
 
 #define kDEBUG 0
 
-spinlock_t pa_dbit_lock = SPIN_LOCK_UNLOCKED;
-
 spinlock_t smp_lock = SPIN_LOCK_UNLOCKED;
 
 volatile struct task_struct *smp_init_current_idle_task;
 
 static volatile int cpu_now_booting = 0;       /* track which CPU is booting */
-static int parisc_max_cpus = -1;               /* Command line */
 
 unsigned long cache_decay_ticks;       /* declared by include/linux/sched.h */
+
+static int parisc_max_cpus = 1;
+
+/* online cpus are ones that we've managed to bring up completely
+ * possible cpus are all valid cpu 
+ * present cpus are all detected cpu
+ *
+ * On startup we bring up the "possible" cpus. Since we discover
+ * CPUs later, we add them as hotplug, so the possible cpu mask is
+ * empty in the beginning.
+ */
+
 cpumask_t cpu_online_map = CPU_MASK_NONE;      /* Bitmap of online CPUs */
-cpumask_t cpu_possible_map = CPU_MASK_NONE;    /* Bitmap of Present CPUs */
+cpumask_t cpu_possible_map = CPU_MASK_ALL;     /* Bitmap of Present CPUs */
 
 EXPORT_SYMBOL(cpu_online_map);
 EXPORT_SYMBOL(cpu_possible_map);
@@ -289,7 +298,7 @@ send_IPI_allbutself(enum ipi_message_type op)
 {
        int i;
        
-       for (i = 0; i < parisc_max_cpus; i++) {
+       for (i = 0; i < NR_CPUS; i++) {
                if (cpu_online(i) && i != smp_processor_id())
                        send_IPI_single(i, op);
        }
@@ -325,6 +334,9 @@ smp_call_function (void (*func) (void *info), void *info, int retry, int wait)
        unsigned long timeout;
        static spinlock_t lock = SPIN_LOCK_UNLOCKED;
 
+       if (num_online_cpus() < 2)
+               return 0;
+
        /* Can deadlock when called with interrupts disabled */
        WARN_ON(irqs_disabled());
        
@@ -377,35 +389,6 @@ smp_call_function (void (*func) (void *info), void *info, int retry, int wait)
 
 EXPORT_SYMBOL(smp_call_function);
 
-
-
-/*
- *     Setup routine for controlling SMP activation
- *
- *     Command-line option of "nosmp" or "maxcpus=0" will disable SMP
- *     activation entirely (the MPS table probe still happens, though).
- *
- *     Command-line option of "maxcpus=<NUM>", where <NUM> is an integer
- *     greater than 0, limits the maximum number of CPUs activated in
- *     SMP mode to <NUM>.
- */
-
-static int __init nosmp(char *str)
-{
-       parisc_max_cpus = 0;
-       return 1;
-}
-
-__setup("nosmp", nosmp);
-
-static int __init maxcpus(char *str)
-{
-       get_option(&str, &parisc_max_cpus);
-       return 1;
-}
-
-__setup("maxcpus=", maxcpus);
-
 /*
  * Flush all other CPU's tlb and then mine.  Do this with on_each_cpu()
  * as we want to ensure all TLB's flushed before proceeding.
@@ -502,7 +485,6 @@ void __init smp_callin(void)
        panic("smp_callin() AAAAaaaaahhhh....\n");
 }
 
-#if 0
 /*
  * Create the idle task for a new Slave CPU.  DO NOT use kernel_thread()
  * because that could end up calling schedule(). If it did, the new idle
@@ -524,7 +506,7 @@ static struct task_struct *fork_by_hand(void)
 /*
  * Bring one cpu online.
  */
-int __init smp_boot_one_cpu(int cpuid, int cpunum)
+int __init smp_boot_one_cpu(int cpuid)
 {
        struct task_struct *idle;
        long timeout;
@@ -544,14 +526,14 @@ int __init smp_boot_one_cpu(int cpuid, int cpunum)
                panic("SMP: fork failed for CPU:%d", cpuid);
 
        wake_up_forked_process(idle);
-       init_idle(idle, cpunum);
+       init_idle(idle, cpuid);
        unhash_process(idle);
-       idle->thread_info->cpu = cpunum;
+       idle->thread_info->cpu = cpuid;
 
        /* Let _start know what logical CPU we're booting
        ** (offset into init_tasks[],cpu_data[])
        */
-       cpu_now_booting = cpunum;
+       cpu_now_booting = cpuid;
 
        /* 
        ** boot strap code needs to know the task address since
@@ -560,11 +542,18 @@ int __init smp_boot_one_cpu(int cpuid, int cpunum)
        smp_init_current_idle_task = idle ;
        mb();
 
+       printk("Releasing cpu %d now, hpa=%lx\n", cpuid, cpu_data[cpuid].hpa);
+
        /*
        ** This gets PDC to release the CPU from a very tight loop.
-       ** See MEM_RENDEZ comments in head.S.
+       **
+       ** From the PA-RISC 2.0 Firmware Architecture Reference Specification:
+       ** "The MEM_RENDEZ vector specifies the location of OS_RENDEZ which 
+       ** is executed after receiving the rendezvous signal (an interrupt to 
+       ** EIR{0}). MEM_RENDEZ is valid only when it is nonzero and the 
+       ** contents of memory are valid."
        */
-       __raw_writel(IRQ_OFFSET(TIMER_IRQ), cpu_data[cpunum].hpa);
+       __raw_writel(IRQ_OFFSET(TIMER_IRQ), cpu_data[cpuid].hpa);
        mb();
 
        /* 
@@ -573,7 +562,7 @@ int __init smp_boot_one_cpu(int cpuid, int cpunum)
         * Once the "monarch CPU" sees the bit change, it can move on.
         */
        for (timeout = 0; timeout < 10000; timeout++) {
-               if(cpu_online(cpunum)) {
+               if(cpu_online(cpuid)) {
                        /* Which implies Slave has started up */
                        cpu_now_booting = 0;
                        smp_init_current_idle_task = NULL;
@@ -592,16 +581,14 @@ int __init smp_boot_one_cpu(int cpuid, int cpunum)
 alive:
        /* Remember the Slave data */
 #if (kDEBUG>=100)
-       printk(KERN_DEBUG "SMP: CPU:%d (num %d) came alive after %ld _us\n",
-               cpuid,  cpunum, timeout * 100);
+       printk(KERN_DEBUG "SMP: CPU:%d came alive after %ld _us\n",
+               cpuid, timeout * 100);
 #endif /* kDEBUG */
 #ifdef ENTRY_SYS_CPUS
-       cpu_data[cpunum].state = STATE_RUNNING;
+       cpu_data[cpuid].state = STATE_RUNNING;
 #endif
        return 0;
 }
-#endif
-
 
 void __devinit smp_prepare_boot_cpu(void)
 {
@@ -612,15 +599,10 @@ void __devinit smp_prepare_boot_cpu(void)
 #endif
 
        /* Setup BSP mappings */
-       printk(KERN_DEBUG "SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
-       init_task.thread_info->cpu = bootstrap_processor; 
-       current->thread_info->cpu = bootstrap_processor;
+       printk("SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
 
        cpu_set(bootstrap_processor, cpu_online_map);
-       cpu_set(bootstrap_processor, cpu_possible_map);
-
-       /* Mark Boostrap processor as present */
-       current->active_mm = &init_mm;
+       cpu_set(bootstrap_processor, cpu_present_map);
 
        cache_decay_ticks = HZ/100;     /* FIXME very rough.  */
 }
@@ -633,15 +615,12 @@ void __devinit smp_prepare_boot_cpu(void)
 */
 void __init smp_prepare_cpus(unsigned int max_cpus)
 {
+       cpus_clear(cpu_present_map);
+       cpu_set(0, cpu_present_map);
 
-       if (max_cpus != -1) 
-               printk(KERN_INFO "SMP: Limited to %d CPUs\n", max_cpus);
-
-       printk(KERN_INFO "SMP: Monarch CPU activated (%lu.%02lu BogoMIPS)\n",
-              (cpu_data[0].loops_per_jiffy + 25) / 5000,
-              ((cpu_data[0].loops_per_jiffy + 25) / 50) % 100);
-
-       return;
+       parisc_max_cpus = max_cpus;
+       if (!max_cpus)
+               printk(KERN_INFO "SMP mode deactivated.\n");
 }
 
 
@@ -653,6 +632,9 @@ void smp_cpus_done(unsigned int cpu_max)
 
 int __devinit __cpu_up(unsigned int cpu)
 {
+       if (cpu != 0 && cpu < parisc_max_cpus)
+               smp_boot_one_cpu(cpu);
+
        return cpu_online(cpu) ? 0 : -ENOSYS;
 }
 
index cd320b2..74db7f6 100644 (file)
@@ -205,10 +205,11 @@ static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
 
 asmlinkage long sys32_time(compat_time_t *tloc)
 {
-    struct timeval tv;
+       struct timeval tv;
+       compat_time_t now32;
 
        do_gettimeofday(&tv);
-       compat_time_t now32 = tv.tv_sec;
+       now32 = tv.tv_sec;
 
        if (tloc)
                if (put_user(now32, tloc))
@@ -344,7 +345,7 @@ filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
        put_user(reclen, &dirent->d_reclen);
        copy_to_user(dirent->d_name, name, namlen);
        put_user(0, dirent->d_name + namlen);
-       ((char *) dirent) += reclen;
+       dirent = (struct linux32_dirent *)((char *)dirent + reclen);
        buf->current_dir = dirent;
        buf->count -= reclen;
        return 0;
index d481796..ff80b3c 100644 (file)
 #include <asm/smp.h>
 #include <asm/pdc.h>
 #include <asm/pdc_chassis.h>
+#include <asm/unwind.h>
 
 #include "../math-emu/math-emu.h"      /* for handle_fpe() */
 
 #define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
                          /*  dumped to the console via printk)          */
 
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
+spinlock_t pa_dbit_lock = SPIN_LOCK_UNLOCKED;
+#endif
+
 int printbinary(char *buf, unsigned long x, int nbits)
 {
        unsigned long mask = 1UL << (nbits - 1);
@@ -125,73 +130,37 @@ void show_regs(struct pt_regs *regs)
 
 void dump_stack(void)
 {
-       unsigned long stack;
-       show_trace(current, &stack);
+       show_stack(NULL, NULL);
 }
 
 EXPORT_SYMBOL(dump_stack);
 
-#ifndef __LP64__
-static int kstack_depth_to_print = 64 * 4;
-#else
-static int kstack_depth_to_print = 128 * 4;
-#endif
-
-void show_stack(struct task_struct *task, unsigned long *sp)
+void show_stack(struct task_struct *task, unsigned long *s)
 {
-       unsigned long *stack;
-       int i;
-
-       /*
-        * debugging aid: "show_stack(NULL);" prints the
-        * back trace for this cpu.
-        */
-       if (task==NULL)
-               sp = (unsigned long*)&sp;
-       else if(sp == NULL)
-               sp = (unsigned long*)task->thread.regs.ksp;
-
-       stack = sp;
-       printk("\n" KERN_CRIT "Stack Dump:\n");
-       printk(KERN_CRIT " " RFMT ":  ", (unsigned long) stack);
-       for (i=0; i < kstack_depth_to_print; i++) {
-               if (((long) stack & (THREAD_SIZE-1)) == 0)
-                       break;
-               if (i && ((i & 0x03) == 0))
-                       printk("\n" KERN_CRIT " " RFMT ":  ",
-                               (unsigned long) stack);
-               printk(RFMT " ", *stack--);
+       int i = 1;
+       struct unwind_frame_info info;
+
+       if (!task) {
+               unsigned long sp, ip, rp;
+
+HERE:
+               asm volatile ("copy %%r30, %0" : "=r"(sp));
+               ip = (unsigned long)&&HERE;
+               rp = (unsigned long)__builtin_return_address(0);
+               unwind_frame_init(&info, current, sp, ip, rp);
+       } else {
+               unwind_frame_init_from_blocked_task(&info, task);
        }
-       printk("\n" KERN_CRIT "\n");
-       show_trace(task, sp);
-}
 
+       printk("Backtrace:\n");
+       while (i <= 16) {
+               if (unwind_once(&info) < 0 || info.ip == 0)
+                       break;
 
-void show_trace(struct task_struct *task, unsigned long *stack)
-{
-       unsigned long *startstack;
-       unsigned long addr;
-       int i;
-
-       startstack = (unsigned long *)((unsigned long)stack & ~(THREAD_SIZE - 1));
-       i = 1;
-       stack = (long *)((long)(stack + 32) &~ (FRAME_SIZE-1)); /* Align */
-       printk("Kernel addresses on the stack:\n");
-       while (stack > startstack) {
-               stack -= 16;    /* Stack frames are a multiple of 16 words */
-               addr = stack[16 - RP_OFFSET / sizeof(long)];
-               /*
-                * If the address is either in the text segment of the
-                * kernel, or in the region which contains vmalloc'ed
-                * memory, it *may* be the address of a calling
-                * routine; if so, print it so that someone tracing
-                * down the cause of the crash will be able to figure
-                * out the call path that was taken.
-                */
-               if (__kernel_text_address(addr)) {
-                       printk(" [<" RFMT ">] ", addr);
+               if (__kernel_text_address(info.ip)) {
+                       printk(" [<" RFMT ">] ", info.ip);
 #ifdef CONFIG_KALLSYMS
-                       print_symbol("%s\n", addr);
+                       print_symbol("%s\n", info.ip);
 #else
                        if ((i & 0x03) == 0)
                                printk("\n");
index b7e171a..4c077fc 100644 (file)
@@ -34,26 +34,26 @@ unsigned long __xchg64(unsigned long x, unsigned long *ptr)
 unsigned long __xchg32(int x, int *ptr)
 {
        unsigned long flags;
-       unsigned long temp;
+       long temp;
 
        atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
-       (long) temp = (long) *ptr;      /* XXX - sign extension wanted? */
+       temp = (long) *ptr;     /* XXX - sign extension wanted? */
        *ptr = x;
        atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
-       return temp;
+       return (unsigned long)temp;
 }
 
 
 unsigned long __xchg8(char x, char *ptr)
 {
        unsigned long flags;
-       unsigned long temp;
+       long temp;
 
        atomic_spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
-       (long) temp = (long) *ptr;      /* XXX - sign extension wanted? */
+       temp = (long) *ptr;     /* XXX - sign extension wanted? */
        *ptr = x;
        atomic_spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
-       return temp;
+       return (unsigned long)temp;
 }
 
 
index 94f5d4e..871d7df 100644 (file)
@@ -5,6 +5,7 @@
  *  Copyright 1999 SuSE GmbH
  *    changed by Philipp Rumpf
  *  Copyright 1999 Philipp Rumpf (prumpf@tux.org)
+ *  Copyright 2004 Randolph Chung (tausq@debian.org)
  *
  */
 
@@ -23,6 +24,7 @@
 #include <asm/pgalloc.h>
 #include <asm/tlb.h>
 #include <asm/pdc_chassis.h>
+#include <asm/mmzone.h>
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
 
@@ -32,10 +34,9 @@ extern char _end;    /* end of BSS, defined by linker */
 extern char __init_begin, __init_end;
 
 #ifdef CONFIG_DISCONTIGMEM
-struct node_map_data node_data[MAX_PHYSMEM_RANGES];
-bootmem_data_t bmem_data[MAX_PHYSMEM_RANGES];
-unsigned char *chunkmap;
-unsigned int maxchunkmap;
+struct node_map_data node_data[MAX_NUMNODES];
+bootmem_data_t bmem_data[MAX_NUMNODES];
+unsigned char pfnnid_map[PFNNID_MAP_MAX];
 #endif
 
 static struct resource data_resource = {
@@ -119,21 +120,6 @@ static void __init setup_bootmem(void)
 
        disable_sr_hashing(); /* Turn off space register hashing */
 
-#ifdef CONFIG_DISCONTIGMEM
-       /*
-        * The below is still true as of 2.4.2. If this is ever fixed,
-        * we can remove this warning!
-        */
-
-       printk(KERN_WARNING "\n\n");
-       printk(KERN_WARNING "CONFIG_DISCONTIGMEM is enabled, which is probably a mistake. This\n");
-       printk(KERN_WARNING "option can lead to heavy swapping, even when there are gigabytes\n");
-       printk(KERN_WARNING "of free memory.\n\n");
-#endif
-
-#ifdef __LP64__
-
-#ifndef CONFIG_DISCONTIGMEM
        /*
         * Sort the ranges. Since the number of ranges is typically
         * small, and performance is not an issue here, just do
@@ -160,11 +146,10 @@ static void __init setup_bootmem(void)
                }
        }
 
+#ifndef CONFIG_DISCONTIGMEM
        /*
         * Throw out ranges that are too far apart (controlled by
-        * MAX_GAP). If CONFIG_DISCONTIGMEM wasn't implemented so
-        * poorly, we would recommend enabling that option, but,
-        * until it is fixed, this is the best way to go.
+        * MAX_GAP).
         */
 
        for (i = 1; i < npmem_ranges; i++) {
@@ -172,6 +157,11 @@ static void __init setup_bootmem(void)
                        (pmem_ranges[i-1].start_pfn +
                         pmem_ranges[i-1].pages) > MAX_GAP) {
                        npmem_ranges = i;
+                       printk("Large gap in memory detected (%ld pages). "
+                              "Consider turning on CONFIG_DISCONTIGMEM\n",
+                              pmem_ranges[i].start_pfn -
+                              (pmem_ranges[i-1].start_pfn +
+                               pmem_ranges[i-1].pages));
                        break;
                }
        }
@@ -194,8 +184,6 @@ static void __init setup_bootmem(void)
                }
        }
 
-#endif /* __LP64__ */
-
        sysram_resource_count = npmem_ranges;
        for (i = 0; i < sysram_resource_count; i++) {
                struct resource *res = &sysram_resources[i];
@@ -218,6 +206,7 @@ static void __init setup_bootmem(void)
        mem_limit_func();       /* check for "mem=" argument */
 
        mem_max = 0;
+       num_physpages = 0;
        for (i = 0; i < npmem_ranges; i++) {
                unsigned long rsize;
 
@@ -232,15 +221,16 @@ static void __init setup_bootmem(void)
                                npmem_ranges = i + 1;
                                mem_max = mem_limit;
                        }
+               num_physpages += pmem_ranges[i].pages;
                        break;
                }
+           num_physpages += pmem_ranges[i].pages;
                mem_max += rsize;
        }
 
        printk(KERN_INFO "Total Memory: %ld Mb\n",mem_max >> 20);
 
 #ifndef CONFIG_DISCONTIGMEM
-
        /* Merge the ranges, keeping track of the holes */
 
        {
@@ -272,9 +262,18 @@ static void __init setup_bootmem(void)
        bootmap_start_pfn = PAGE_ALIGN(__pa((unsigned long) &_end)) >> PAGE_SHIFT;
 
 #ifdef CONFIG_DISCONTIGMEM
+       for (i = 0; i < MAX_PHYSMEM_RANGES; i++) {
+               memset(NODE_DATA(i), 0, sizeof(pg_data_t));
+               NODE_DATA(i)->bdata = &bmem_data[i];
+       }
+       memset(pfnnid_map, 0xff, sizeof(pfnnid_map));
+
+       numnodes = npmem_ranges;
+
        for (i = 0; i < npmem_ranges; i++)
-               node_data[i].pg_data.bdata = &bmem_data[i];
+               node_set_online(i);
 #endif
+
        /*
         * Initialize and free the full range of memory in each range.
         * Note that the only writing these routines do are to the bootmap,
@@ -443,16 +442,20 @@ unsigned long pcxl_dma_start;
 
 void __init mem_init(void)
 {
-       int i;
-
        high_memory = __va((max_pfn << PAGE_SHIFT));
-       max_mapnr = (virt_to_page(high_memory - 1) - mem_map) + 1;
 
-       num_physpages = 0;
-       mem_map = zone_table[0]->zone_mem_map;
-       for (i = 0; i < npmem_ranges; i++)
-               num_physpages += free_all_bootmem_node(NODE_DATA(i));
-       totalram_pages = num_physpages;
+#ifndef CONFIG_DISCONTIGMEM
+       max_mapnr = page_to_pfn(virt_to_page(high_memory - 1)) + 1;
+       mem_map = zone_table[ZONE_DMA]->zone_mem_map;
+       totalram_pages += free_all_bootmem();
+#else
+       {
+               int i;
+
+               for (i = 0; i < npmem_ranges; i++)
+                       totalram_pages += free_all_bootmem_node(NODE_DATA(i));
+       }
+#endif
 
        printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10));
 
@@ -486,6 +489,7 @@ void show_mem(void)
        show_free_areas();
        printk(KERN_INFO "Free swap:     %6ldkB\n",
                                nr_swap_pages<<(PAGE_SHIFT-10));
+#ifndef CONFIG_DISCONTIGMEM
        i = max_mapnr;
        while (i-- > 0) {
                total++;
@@ -493,15 +497,55 @@ void show_mem(void)
                        reserved++;
                else if (PageSwapCache(mem_map+i))
                        cached++;
-               else if (!atomic_read(&mem_map[i].count))
+               else if (!page_count(&mem_map[i]))
                        free++;
                else
-                       shared += atomic_read(&mem_map[i].count) - 1;
+                       shared += page_count(&mem_map[i]) - 1;
+       }
+#else
+       for (i = 0; i < npmem_ranges; i++) {
+               int j;
+
+               for (j = node_start_pfn(i); j < node_end_pfn(i); j++) {
+                       struct page *p;
+
+                       p = node_mem_map(i) + j - node_start_pfn(i);
+
+                       total++;
+                       if (PageReserved(p))
+                               reserved++;
+                       else if (PageSwapCache(p))
+                               cached++;
+                       else if (!page_count(p))
+                               free++;
+                       else
+                               shared += page_count(p) - 1;
+               }
        }
+#endif
        printk(KERN_INFO "%d pages of RAM\n", total);
        printk(KERN_INFO "%d reserved pages\n", reserved);
        printk(KERN_INFO "%d pages shared\n", shared);
        printk(KERN_INFO "%d pages swap cached\n", cached);
+
+
+#ifdef CONFIG_DISCONTIGMEM
+       {
+               struct zonelist *zl;
+               int i, j, k;
+
+               for (i = 0; i < npmem_ranges; i++) {
+                       for (j = 0; j < MAX_NR_ZONES; j++) {
+                               zl = NODE_DATA(i)->node_zonelists + j;
+
+                               printk("Zone list for zone %d on node %d: ", j, i);
+                               for (k = 0; zl->zones[k] != NULL; k++) 
+                                       printk("[%d/%s] ", zl->zones[k]->zone_pgdat->node_id, zl->zones[k]->name);
+                               printk("\n");
+                       }
+               }
+       }
+#endif
 }
 
 
@@ -544,7 +588,7 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd
 #if PTRS_PER_PMD == 1
                pmd = (pmd_t *)__pa(pg_dir);
 #else
-               pmd = (pmd_t *) (PAGE_MASK & pgd_val(*pg_dir));
+               pmd = (pmd_t *)pgd_address(*pg_dir);
 
                /*
                 * pmd is physical at this point
@@ -555,7 +599,7 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd
                        pmd = (pmd_t *) __pa(pmd);
                }
 
-               pgd_val(*pg_dir) = _PAGE_TABLE | (unsigned long) pmd;
+               pgd_populate(NULL, pg_dir, __va(pmd));
 #endif
                pg_dir++;
 
@@ -568,15 +612,14 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd
                         * pg_table is physical at this point
                         */
 
-                       pg_table = (pte_t *) (PAGE_MASK & pmd_val(*pmd));
+                       pg_table = (pte_t *)pmd_address(*pmd);
                        if (!pg_table) {
                                pg_table = (pte_t *)
                                        alloc_bootmem_low_pages_node(NODE_DATA(0),PAGE_SIZE);
                                pg_table = (pte_t *) __pa(pg_table);
                        }
 
-                       pmd_val(*pmd) = _PAGE_TABLE |
-                                          (unsigned long) pg_table;
+                       pmd_populate_kernel(NULL, pmd, __va(pg_table));
 
                        /* now change pg_table to kernel virtual addresses */
 
@@ -584,8 +627,6 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd
                        for (tmp2 = start_pte; tmp2 < PTRS_PER_PTE; tmp2++,pg_table++) {
                                pte_t pte;
 
-#if !defined(CONFIG_STI_CONSOLE)
-#warning STI console should explicitly allocate executable pages but does not
                                /*
                                 * Map the fault vector writable so we can
                                 * write the HPMC checksum.
@@ -595,7 +636,6 @@ static void __init map_pages(unsigned long start_vaddr, unsigned long start_padd
                                                        && address != gw_addr)
                                    pte = __mk_pte(address, PAGE_KERNEL_RO);
                                else
-#endif
                                    pte = __mk_pte(address, pgprot);
 
                                if (address >= end_paddr)
@@ -758,61 +798,26 @@ void __init paging_init(void)
        flush_tlb_all_local();
 
        for (i = 0; i < npmem_ranges; i++) {
-               unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0, };
+               unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0 };
 
+               /* We have an IOMMU, so all memory can go into a single
+                  ZONE_DMA zone. */
                zones_size[ZONE_DMA] = pmem_ranges[i].pages;
+
                free_area_init_node(i,NODE_DATA(i),NULL,zones_size,
-                               (pmem_ranges[i].start_pfn << PAGE_SHIFT),0);
-       }
+                               pmem_ranges[i].start_pfn, 0);
 
 #ifdef CONFIG_DISCONTIGMEM
-       /*
-        * Initialize support for virt_to_page() macro.
-        *
-        * Note that MAX_ADDRESS is the largest virtual address that
-        * we can map. However, since we map all physical memory into
-        * the kernel address space, it also has an effect on the maximum
-        * physical address we can map (MAX_ADDRESS - PAGE_OFFSET).
-        */
-
-       maxchunkmap = MAX_ADDRESS >> CHUNKSHIFT;
-       chunkmap = (unsigned char *)alloc_bootmem(maxchunkmap);
-
-       for (i = 0; i < maxchunkmap; i++)
-           chunkmap[i] = BADCHUNK;
-
-       for (i = 0; i < npmem_ranges; i++) {
-
-               ADJ_NODE_MEM_MAP(i) = NODE_MEM_MAP(i) - pmem_ranges[i].start_pfn;
                {
-                       unsigned long chunk_paddr;
-                       unsigned long end_paddr;
-                       int chunknum;
-
-                       chunk_paddr = (pmem_ranges[i].start_pfn << PAGE_SHIFT);
-                       end_paddr = chunk_paddr + (pmem_ranges[i].pages << PAGE_SHIFT);
-                       chunk_paddr &= CHUNKMASK;
-
-                       chunknum = (int)CHUNKNUM(chunk_paddr);
-                       while (chunk_paddr < end_paddr) {
-                               if (chunknum >= maxchunkmap)
-                                       goto badchunkmap1;
-                               if (chunkmap[chunknum] != BADCHUNK)
-                                       goto badchunkmap2;
-                               chunkmap[chunknum] = (unsigned char)i;
-                               chunk_paddr += CHUNKSZ;
-                               chunknum++;
-                       }
+                   int j;
+                   for (j = (node_start_pfn(i) >> PFNNID_SHIFT);
+                        j <= (node_end_pfn(i) >> PFNNID_SHIFT);
+                        j++) {
+                       pfnnid_map[j] = i;
+                   }
                }
-       }
-
-       return;
-
-badchunkmap1:
-       panic("paging_init: Physical address exceeds maximum address space!\n");
-badchunkmap2:
-       panic("paging_init: Collision in chunk map array. CHUNKSZ needs to be smaller\n");
 #endif
+       }
 }
 
 #ifdef CONFIG_PA20
index 6df3811..3f8aa41 100644 (file)
@@ -613,7 +613,7 @@ static int __init scc_enet_init(void)
        struct net_device *dev;
        struct scc_enet_private *cep;
        int i, j, err;
-       void * dpaddr;
+       uint dp_offset;
        unsigned char   *eap;
        unsigned long   mem_addr;
        bd_t            *bd;
@@ -681,13 +681,13 @@ static int __init scc_enet_init(void)
         * These are relative offsets in the DP ram address space.
         * Initialize base addresses for the buffer descriptors.
         */
-       dpaddr = cpm2_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8);
-       ep->sen_genscc.scc_rbase = cpm2_dpram_offset(dpaddr);
-       cep->rx_bd_base = (cbd_t *)dpaddr;
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8);
+       ep->sen_genscc.scc_rbase = dp_offset;
+       cep->rx_bd_base = (cbd_t *)cpm_dpram_addr(dp_offset);
 
-       dpaddr = cpm2_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8);
-       ep->sen_genscc.scc_tbase = cpm2_dpram_offset(dpaddr);
-       cep->tx_bd_base = (cbd_t *)dpaddr;
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8);
+       ep->sen_genscc.scc_tbase = dp_offset;
+       cep->tx_bd_base = (cbd_t *)cpm_dpram_addr(dp_offset);
 
        cep->dirty_tx = cep->cur_tx = cep->tx_bd_base;
        cep->cur_rx = cep->rx_bd_base;
index c81ae84..2688504 100644 (file)
@@ -286,7 +286,7 @@ m8xx_cpm_hostalloc(uint size)
 #define BRG_UART_CLK_DIV16     (BRG_UART_CLK/16)
 
 void
-m8xx_cpm_setbrg(uint brg, uint rate)
+cpm_setbrg(uint brg, uint rate)
 {
        volatile uint   *bp;
 
@@ -336,8 +336,7 @@ void m8xx_cpm_dpinit(void)
         * with the processor and the microcode patches applied / activated.
         * But the following should be at least safe.
         */
-       rh_attach_region(&cpm_dpmem_info, cp->cp_dpmem + CPM_DATAONLY_BASE,
-                       CPM_DATAONLY_SIZE);
+       rh_attach_region(&cpm_dpmem_info, (void *)CPM_DATAONLY_BASE, CPM_DATAONLY_SIZE);
 }
 
 /*
@@ -346,59 +345,55 @@ void m8xx_cpm_dpinit(void)
  * Now it returns the actuall physical address of that area.
  * use m8xx_cpm_dpram_offset() to get the index
  */
-void *m8xx_cpm_dpalloc(int size)
+uint cpm_dpalloc(uint size, uint align)
 {
        void *start;
        unsigned long flags;
 
        spin_lock_irqsave(&cpm_dpmem_lock, flags);
+       cpm_dpmem_info.alignment = align;
        start = rh_alloc(&cpm_dpmem_info, size, "commproc");
        spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
 
-       return start;
+       return (uint)start;
 }
-EXPORT_SYMBOL(m8xx_cpm_dpalloc);
+EXPORT_SYMBOL(cpm_dpalloc);
 
-int m8xx_cpm_dpfree(void *addr)
+int cpm_dpfree(uint offset)
 {
        int ret;
        unsigned long flags;
 
        spin_lock_irqsave(&cpm_dpmem_lock, flags);
-       ret = rh_free(&cpm_dpmem_info, addr);
+       ret = rh_free(&cpm_dpmem_info, (void *)offset);
        spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
 
        return ret;
 }
-EXPORT_SYMBOL(m8xx_cpm_dpfree);
+EXPORT_SYMBOL(cpm_dpfree);
 
-void *m8xx_cpm_dpalloc_fixed(void *addr, int size)
+uint cpm_dpalloc_fixed(uint offset, uint size, uint align)
 {
        void *start;
        unsigned long flags;
 
        spin_lock_irqsave(&cpm_dpmem_lock, flags);
-       start = rh_alloc_fixed(&cpm_dpmem_info, addr, size, "commproc");
+       cpm_dpmem_info.alignment = align;
+       start = rh_alloc_fixed(&cpm_dpmem_info, (void *)offset, size, "commproc");
        spin_unlock_irqrestore(&cpm_dpmem_lock, flags);
 
-       return start;
+       return (uint)start;
 }
-EXPORT_SYMBOL(m8xx_cpm_dpalloc_fixed);
+EXPORT_SYMBOL(cpm_dpalloc_fixed);
 
-void m8xx_cpm_dpdump(void)
+void cpm_dpdump(void)
 {
        rh_dump(&cpm_dpmem_info);
 }
-EXPORT_SYMBOL(m8xx_cpm_dpdump);
+EXPORT_SYMBOL(cpm_dpdump);
 
-int m8xx_cpm_dpram_offset(void *addr)
-{
-       return (u_char *)addr - ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
-}
-EXPORT_SYMBOL(m8xx_cpm_dpram_offset);
-
-void *m8xx_cpm_dpram_addr(int offset)
+void *cpm_dpram_addr(uint offset)
 {
        return ((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem + offset;
 }
-EXPORT_SYMBOL(m8xx_cpm_dpram_addr);
+EXPORT_SYMBOL(cpm_dpram_addr);
index 8c7f28d..514e7de 100644 (file)
@@ -1619,7 +1619,7 @@ static ssize_t sound_copy_translate_read(const u_char *userPtr,
 static int mixer_open(struct inode *inode, struct file *file)
 {
        mixer.busy = 1;
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 
@@ -2105,7 +2105,7 @@ static int sq_open(struct inode *inode, struct file *file)
                sound_set_format(AFMT_MU_LAW);
        }
 
-       return 0;
+       return nonseekable_open(inode, file);
 
 err_out_nobusy:
        if (file->f_mode & FMODE_WRITE) {
@@ -2404,7 +2404,7 @@ static int state_open(struct inode *inode, struct file *file)
        len += sprintf(buffer+len, "\tsq.active = %d sq.syncing = %d\n",
                       sq.active, sq.syncing);
        state.len = len;
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 
@@ -2463,7 +2463,7 @@ static long long sound_lseek(struct file *file, long long offset, int orig)
 int __init tdm8xx_sound_init(void)
 {
        int i, has_sound;
-       uint                    dp_addr, dp_mem;
+       uint                    dp_offset;
        volatile uint           *sirp;
        volatile cbd_t          *bdp;
        volatile cpm8xx_t       *cp;
@@ -2525,15 +2525,14 @@ int __init tdm8xx_sound_init(void)
        /* We need to allocate a transmit and receive buffer
         * descriptors from dual port ram.
         */
-       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * numReadBufs);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
+       dp_addr = cpm_dpalloc(sizeof(cbd_t) * numReadBufs, 8);
 
        /* Set the physical address of the host memory
         * buffers in the buffer descriptors, and the
         * virtual address for us to work with.
         */
        bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
-       up->smc_rbase = dp_mem;
+       up->smc_rbase = dp_offset;
        rx_cur = rx_base = (cbd_t *)bdp;
 
        for (i=0; i<(numReadBufs-1); i++) {
@@ -2548,11 +2547,10 @@ int __init tdm8xx_sound_init(void)
 
        /* Now, do the same for the transmit buffers.
        */
-       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * numBufs);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * numBufs, 8);
 
        bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
-       up->smc_tbase = dp_mem;
+       up->smc_tbase = dp_offset;
        tx_cur = tx_base = (cbd_t *)bdp;
 
        for (i=0; i<(numBufs-1); i++) {
index a1ba89d..8ddef1c 100644 (file)
@@ -644,8 +644,7 @@ static int __init scc_enet_init(void)
        struct net_device *dev;
        struct scc_enet_private *cep;
        int i, j, k, err;
-       void *dp_mem;
-       unsigned int dp_addr;
+       uint dp_offset;
        unsigned char   *eap, *ba;
        dma_addr_t      mem_addr;
        bd_t            *bd;
@@ -740,15 +739,13 @@ static int __init scc_enet_init(void)
         * These are relative offsets in the DP ram address space.
         * Initialize base addresses for the buffer descriptors.
         */
-       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
-       ep->sen_genscc.scc_rbase = dp_mem;
-       cep->rx_bd_base = (cbd_t *)&cp->cp_dpmem[dp_addr];
-
-       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
-       ep->sen_genscc.scc_tbase = dp_mem;
-       cep->tx_bd_base = (cbd_t *)&cp->cp_dpmem[dp_addr];
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * RX_RING_SIZE, 8);
+       ep->sen_genscc.scc_rbase = dp_offset;
+       cep->rx_bd_base = cpm_dpram_addr(dp_offset);
+
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * TX_RING_SIZE, 8);
+       ep->sen_genscc.scc_tbase = dp_offset;
+       cep->tx_bd_base = cpm_dpram_addr(dp_offset);
 
        cep->dirty_tx = cep->cur_tx = cep->tx_bd_base;
        cep->cur_rx = cep->rx_bd_base;
index 6a12b49..171e5e9 100644 (file)
@@ -2491,7 +2491,7 @@ static int __init rs_8xx_init(void)
 {
        struct serial_state * state;
        ser_info_t      *info;
-       uint            mem_addr, dp_addr, dp_mem, iobits;
+       uint            mem_addr, iobits, dp_offset;
        int             i, j, idx;
        ushort          chan;
        volatile        cbd_t           *bdp;
@@ -2623,8 +2623,7 @@ static int __init rs_8xx_init(void)
                         * descriptors from dual port ram, and a character
                         * buffer area from host mem.
                         */
-                       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * RX_NUM_FIFO);
-                       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
+                       dp_offset = cpm_dpalloc(sizeof(cbd_t) * RX_NUM_FIFO, 8);
 
                        /* Allocate space for FIFOs in the host memory.
                        */
@@ -2635,7 +2634,7 @@ static int __init rs_8xx_init(void)
                         * buffers in the buffer descriptors, and the
                         * virtual address for us to work with.
                         */
-                       bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
+                       bdp = (cbd_t *)&cp->cp_dpmem[dp_offset];
                        info->rx_cur = info->rx_bd_base = (cbd_t *)bdp;
 
                        for (j=0; j<(RX_NUM_FIFO-1); j++) {
@@ -2651,16 +2650,15 @@ static int __init rs_8xx_init(void)
                        if (info->state->smc_scc_num & NUM_IS_SCC) {
                                scp = &cp->cp_scc[idx];
                                sup = (scc_uart_t *)&cp->cp_dparam[state->port];
-                               sup->scc_genscc.scc_rbase = dp_mem;
+                               sup->scc_genscc.scc_rbase = dp_offset;
                        }
                        else {
                                sp = &cp->cp_smc[idx];
                                up = (smc_uart_t *)&cp->cp_dparam[state->port];
-                               up->smc_rbase = dp_mem;
+                               up->smc_rbase = dp_offset;
                        }
 
-                       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * TX_NUM_FIFO);
-                       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
+                       dp_offset = cpm_dpalloc(sizeof(cbd_t) * TX_NUM_FIFO, 8);
 
                        /* Allocate space for FIFOs in the host memory.
                        */
@@ -2671,7 +2669,7 @@ static int __init rs_8xx_init(void)
                         * buffers in the buffer descriptors, and the
                         * virtual address for us to work with.
                         */
-                       bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
+                       bdp = (cbd_t *)&cp->cp_dpmem[dp_offset];
                        info->tx_cur = info->tx_bd_base = (cbd_t *)bdp;
 
                        for (j=0; j<(TX_NUM_FIFO-1); j++) {
@@ -2684,7 +2682,7 @@ static int __init rs_8xx_init(void)
                        bdp->cbd_sc = (BD_SC_WRAP | BD_SC_INTRPT);
 
                        if (info->state->smc_scc_num & NUM_IS_SCC) {
-                               sup->scc_genscc.scc_tbase = dp_mem;
+                               sup->scc_genscc.scc_tbase = dp_offset;
 
                                /* Set up the uart parameters in the
                                 * parameter ram.
@@ -2781,7 +2779,7 @@ static int __init rs_8xx_init(void)
                                cp->cp_simode &= ~(0xffff << (idx * 16));
                                cp->cp_simode |= (i << ((idx * 16) + 12));
 
-                               up->smc_tbase = dp_mem;
+                               up->smc_tbase = dp_offset;
 
                                /* Set up the uart parameters in the
                                 * parameter ram.
@@ -2845,7 +2843,7 @@ module_init(rs_8xx_init);
 static int __init serial_console_setup(struct console *co, char *options)
 {
        struct          serial_state *ser;
-       uint            mem_addr, dp_addr, dp_mem, bidx, idx;
+       uint            mem_addr, bidx, idx, dp_offset;
        ushort          chan;
        volatile        cbd_t           *bdp;
        volatile        cpm8xx_t        *cp;
@@ -2891,19 +2889,17 @@ static int __init serial_console_setup(struct console *co, char *options)
         * memory yet because vm allocator isn't initialized
         * during this early console init.
         */
-       dp_mem = m8xx_cpm_dpalloc(8);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
-       mem_addr = (uint)(&cpmp->cp_dpmem[dp_addr]);
+       dp_offset = cpm_dpalloc(8, 8);
+       mem_addr = (uint)(&cpmp->cp_dpmem[dp_offset]);
 
        /* Allocate space for two buffer descriptors in the DP ram.
        */
-       dp_mem = m8xx_cpm_dpalloc(sizeof(cbd_t) * 2);
-       dp_addr = m8xx_cpm_dpram_offset(dp_mem);
+       dp_offset = cpm_dpalloc(sizeof(cbd_t) * 2, 8);
 
        /* Set the physical address of the host memory buffers in
         * the buffer descriptors.
         */
-       bdp = (cbd_t *)&cp->cp_dpmem[dp_addr];
+       bdp = (cbd_t *)&cp->cp_dpmem[dp_offset];
        bdp->cbd_bufaddr = iopa(mem_addr);
        (bdp+1)->cbd_bufaddr = iopa(mem_addr+4);
 
@@ -2922,8 +2918,8 @@ static int __init serial_console_setup(struct console *co, char *options)
        */
        if (ser->smc_scc_num & NUM_IS_SCC) {
 
-               sup->scc_genscc.scc_rbase = dp_mem;
-               sup->scc_genscc.scc_tbase = dp_mem + sizeof(cbd_t);
+               sup->scc_genscc.scc_rbase = dp_offset;
+               sup->scc_genscc.scc_tbase = dp_offset + sizeof(cbd_t);
 
                /* Set up the uart parameters in the
                 * parameter ram.
@@ -2981,8 +2977,8 @@ static int __init serial_console_setup(struct console *co, char *options)
 
        }
        else {
-               up->smc_rbase = dp_mem; /* Base of receive buffer desc. */
-               up->smc_tbase = dp_mem+sizeof(cbd_t);   /* Base of xmt buffer desc. */
+               up->smc_rbase = dp_offset;      /* Base of receive buffer desc. */
+               up->smc_tbase = dp_offset+sizeof(cbd_t);        /* Base of xmt buffer desc. */
                up->smc_rfcr = SMC_EB;
                up->smc_tfcr = SMC_EB;
 
index b95d133..051832b 100644 (file)
@@ -44,18 +44,18 @@ choice
        default 6xx
 
 config 6xx
-       bool "6xx/7xx/74xx/8260"
+       bool "6xx/7xx/74xx/52xx/8260"
        help
          There are four types of PowerPC chips supported.  The more common
          types (601, 603, 604, 740, 750, 7400), the Motorola embedded
-         versions (821, 823, 850, 855, 860, 8260), the IBM embedded versions
-         (403 and 405) and the high end 64 bit Power processors (POWER 3,
-         POWER4, and IBM 970 also known as G5)
+         versions (821, 823, 850, 855, 860, 52xx, 8260), the IBM embedded
+         versions (403 and 405) and the high end 64 bit Power processors 
+         (POWER 3, POWER4, and IBM 970 also known as G5)
          Unless you are building a kernel for one of the embedded processor
          systems, 64 bit IBM RS/6000 or an Apple G5, choose 6xx.
          Note that the kernel runs in 32-bit mode even on 64-bit chips.
-         Also note that because the 82xx family has a 603e core, specific
-         support for that chipset is asked later on.
+         Also note that because the 52xx & 82xx family has a 603e core,
+         specific support for that chipset is asked later on.
 
 config 40x
        bool "40x"
@@ -191,7 +191,7 @@ config CPU_FREQ
          fly. This is a nice method to save battery power on notebooks,
          because the lower the clock speed, the less power the CPU consumes.
 
-         For more information, take a look at linux/Documentation/cpu-freq or
+         For more information, take a look at <file:Documentation/cpu-freq> or
          at <http://www.brodo.de/cpufreq/>
 
          If in doubt, say N.
@@ -507,12 +507,6 @@ config APUS
          More information is available at:
          <http://linux-apus.sourceforge.net/>.
 
-config KATANA
-       bool "Artesyn-Katana"
-
-config DMV182
-       bool "Dy-4 SVME/DMV-182"
-
 config WILLOW
        bool "Cogent-Willow"
 
@@ -523,10 +517,7 @@ config POWERPMC250
        bool "Force-PowerPMC250"
 
 config EV64260
-       bool "Marvell-EV64260BP"
-       help
-         Select EV64260 if configuring of a Marvell (formerly Galileo)
-         EV64260BP Evaluation platofm.
+       bool "Galileo-EV-64260-BP"
 
 config SPRUCE
        bool "IBM-Spruce"
@@ -592,7 +583,7 @@ config SBC82xx
 config SBS8260
        bool "SBS8260"
 
-config RPX6
+config RPX8260
        bool "RPXSUPER"
 
 config TQM8260
@@ -610,6 +601,15 @@ config TQM8260
 config ADS8272
        bool "ADS8272"
 
+config LITE5200
+       bool "Freescale LITE5200 / (IceCube)"
+       select PPC_MPC52xx
+       help
+         Support for the LITE5200 dev board for the MPC5200 from Freescale.
+         This is for the LITE5200 version 2.0 board. Don't know if it changes
+         much but it's only been tested on this board version. I think this
+         board is also known as IceCube.
+
 endchoice
 
 config PQ2ADS
@@ -626,11 +626,14 @@ config EMBEDDEDBOOT
        bool
        depends on 8xx || 8260
        default y
+       
+config PPC_MPC52xx
+       bool
 
 config 8260
        bool "CPM2 Support" if WILLOW
        depends on 6xx
-       default y if TQM8260 || RPXSUPER || EST8260 || SBS8260 || SBC82xx
+       default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx
        help
          The MPC8260 is a typical embedded CPU made by Motorola.  Selecting
          this option means that you wish to build a kernel for a machine with
@@ -647,7 +650,7 @@ config 8272
 
 config CPM2
        bool
-       depends on 8260
+       depends on 8260 || MPC8560
        default y
        help
          The CPM2 (Communications Processor Module) is a coprocessor on
@@ -680,29 +683,9 @@ config PPC_OF
        depends on PPC_PMAC || PPC_CHRP
        default y
 
-menu "Set bridge options"
-       depends on MV64X60
-
-config MV64X60_BASE
-       hex "Set bridge base used by firmware"
-       default "0xf1000000"
-       help
-         A firmware can leave the base address of the bridge's registers at
-         a non-standard location.  If so, set this value to reflect the
-         address of that non-standard location.
-
-config MV64X60_NEW_BASE
-       hex "Set bridge base used by kernel"
-       default "0xf1000000"
-       help
-         If the current base address of the bridge's registers is not where
-         you want it, set this value to the address that you want it moved to.
-
-endmenu
-
 config PPC_GEN550
        bool
-       depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || PRPMC750 || K2 || PRPMC800 || (EV64260 && !MV64X60_MPSC) || DMV182
+       depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || PRPMC750 || K2 || PRPMC800
        default y
 
 config FORCE
@@ -715,16 +698,6 @@ config GT64260
        depends on EV64260
        default y
 
-config MV64360
-       bool
-       depends on KATANA || DMV182
-       default y
-
-config MV64X60
-       bool
-       depends on (GT64260 || MV64360)
-       default y
-
 config NONMONARCH_SUPPORT
        bool "Enable Non-Monarch Support"
        depends on PRPMC800
@@ -746,7 +719,7 @@ config MPC10X_BRIDGE
 
 config FSL_OCP
        bool
-       depends on MPC10X_BRIDGE
+       depends on MPC10X_BRIDGE || PPC_MPC52xx
        default y
 
 config MPC10X_OPENPIC
@@ -783,6 +756,11 @@ config SERIAL_CONSOLE
        depends on 8xx
        default y
 
+config SERIAL_CONSOLE_BAUD
+       int
+       depends on EV64260
+       default "115200"
+
 config PPCBUG_NVRAM
        bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC
        default y if PPC_PREP
@@ -847,39 +825,6 @@ config PROC_DEVICETREE
          an image of the device tree that the kernel copies from Open
          Firmware. If unsure, say Y here.
 
-config PPC_RTAS
-       bool "Support for RTAS (RunTime Abstraction Services) in /proc"
-       depends on PPC_OF && PROC_FS
-       ---help---
-         When you use this option, you will be able to use RTAS from
-         userspace.
-
-         RTAS stands for RunTime Abstraction Services and should
-         provide a portable way to access and set system information. This is
-         commonly used on RS/6000 (pSeries) computers.
-
-         You can access RTAS via the special proc file system entry rtas.
-         Don't confuse this rtas entry with the one in /proc/device-tree/rtas
-         which is readonly.
-
-         If you don't know if you can use RTAS look into
-         /proc/device-tree/rtas. If there are some entries, it is very likely
-         that you will be able to use RTAS.
-
-         You can do cool things with rtas. To print out information about
-         various sensors in the system, just do a
-
-         $ cat /proc/rtas/sensors
-
-         or if you power off your machine at night but want it running when
-         you enter your office at 7:45 am, do a
-
-         # date -d 'tomorrow 7:30' +%s > /proc/rtas/poweron
-
-         and shutdown.
-
-         If unsure, say Y.
-
 config PREP_RESIDUAL
        bool "Support for PReP Residual Data"
        depends on PPC_PREP
@@ -1329,7 +1274,7 @@ config DEBUG_SPINLOCK_SLEEP
 
 config KGDB
        bool "Include kgdb kernel debugger"
-       depends on DEBUG_KERNEL
+       depends on DEBUG_KERNEL && (BROKEN || PPC_GEN550 || 4xx)
        select DEBUG_INFO
        help
          Include in-kernel hooks for kgdb, the Linux kernel source level
@@ -1397,11 +1342,11 @@ config BOOTX_TEXT
 
 config SERIAL_TEXT_DEBUG
        bool "Support for early boot texts over serial port"
-       depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || PPC_GEN550
+       depends on 4xx || GT64260 || LOPEC || PPLUS || PRPMC800 || PPC_GEN550 || PPC_MPC52xx
 
 config PPC_OCP
        bool
-       depends on IBM_OCP || FSL_OCP || MV64X60
+       depends on IBM_OCP || FSL_OCP
        default y
 
 endmenu
index 75607e9..6cf4405 100644 (file)
@@ -23,19 +23,24 @@ endif
 LDFLAGS_vmlinux        := -Ttext $(KERNELLOAD) -Bstatic
 CPPFLAGS       += -Iarch/$(ARCH)
 AFLAGS         += -Iarch/$(ARCH)
-cflags-y       += -Iarch/$(ARCH) -msoft-float -pipe \
+CFLAGS         += -Iarch/$(ARCH) -msoft-float -pipe \
                -ffixed-r2 -Wno-uninitialized -mmultiple
 CPP            = $(CC) -E $(CFLAGS)
 
+CHECK          := $(CHECK) -D__powerpc__=1
+
 ifndef CONFIG_E500
-cflags-y       += -mstring
+CFLAGS         += -mstring
 endif
 
-cflags-$(CONFIG_4xx)           += -Wa,-m405
-cflags-$(CONFIG_E500)          += -Wa,-me500
-cflags-$(CONFIG_PPC64BRIDGE)   += -Wa,-mppc64bridge
+cpu-as-$(CONFIG_PPC64BRIDGE)   += -Wa,-mppc64bridge
+cpu-as-$(CONFIG_4xx)           += -Wa,-m405
+cpu-as-$(CONFIG_6xx)           += -Wa,-maltivec
+cpu-as-$(CONFIG_POWER4)                += -Wa,-maltivec
+cpu-as-$(CONFIG_E500)          += -Wa,-me500
 
-CFLAGS += $(cflags-y)
+AFLAGS += $(cpu-as-y)
+CFLAGS += $(cpu-as-y)
 
 head-y                         := arch/ppc/kernel/head.o
 head-$(CONFIG_8xx)             := arch/ppc/kernel/head_8xx.o
@@ -107,17 +112,24 @@ GOODVER   := 2.12.1
 else
 NEW_AS := 0
 endif
+# gcc-3.4 and binutils-2.14 are a fatal combination.
+GCC_VERSION    := $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
+BAD_GCC_AS     := $(shell echo mftb 5 | $(AS) -mppc -many -o /dev/null >/dev/null 2>&1 && echo 0 || echo 1)
 
-ifneq ($(NEW_AS),0)
 checkbin:
+ifeq ($(GCC_VERSION)$(BAD_GCC_AS),03041)
+       @echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '
+       @echo 'correctly with gcc-3.4 and your version of binutils.'
+       @echo '*** Please upgrade your binutils or downgrade your gcc'
+       @false
+endif
+ifneq ($(NEW_AS),0)
        @echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '
        @echo 'correctly with old versions of binutils.'
        @echo '*** Please upgrade your binutils to ${GOODVER} or newer'
        @false
-else
-checkbin:
-       @true
 endif
+       @true
 
 CLEAN_FILES += include/asm-$(ARCH)/offsets.h \
                arch/$(ARCH)/kernel/asm-offsets.s
index 4404fe8..868fa81 100644 (file)
@@ -59,8 +59,8 @@ static int _cvt(unsigned long val, char *buf, long radix, char *digits);
 void _vprintk(void(*putc)(const char), const char *fmt0, va_list ap);
 unsigned char *ISA_io = NULL;
 
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || \
-       defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
+       || defined(CONFIG_SERIAL_MPC52xx_CONSOLE)
 extern unsigned long com_port;
 
 extern int serial_tstc(unsigned long com_port);
@@ -81,8 +81,8 @@ void exit(void)
 
 int tstc(void)
 {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || \
-       defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
+       || defined(CONFIG_SERIAL_MPC52xx_CONSOLE)
        if(keyb_present)
                return (CRT_tstc() || serial_tstc(com_port));
        else
@@ -95,8 +95,8 @@ int tstc(void)
 int getc(void)
 {
        while (1) {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || \
-       defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
+       || defined(CONFIG_SERIAL_MPC52xx_CONSOLE)
                if (serial_tstc(com_port))
                        return (serial_getc(com_port));
 #endif /* serial console */
@@ -111,8 +111,8 @@ putc(const char c)
 {
        int x,y;
 
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || \
-       defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
+       || defined(CONFIG_SERIAL_MPC52xx_CONSOLE)
        serial_putc(com_port, c);
        if ( c == '\n' )
                serial_putc(com_port, '\r');
@@ -159,8 +159,8 @@ void puts(const char *s)
        y = orig_y;
 
        while ( ( c = *s++ ) != '\0' ) {
-#if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) || \
-       defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#if defined(CONFIG_SERIAL_CPM_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) \
+       || defined(CONFIG_SERIAL_MPC52xx_CONSOLE)
                serial_putc(com_port, c);
                if ( c == '\n' ) serial_putc(com_port, '\r');
 #endif /* serial console */
index 2bae1ea..e31b7e4 100644 (file)
@@ -65,7 +65,7 @@ zimageinitrd-$(CONFIG_OCOTEA)         := zImage.initrd-TREE
          end-$(CONFIG_OCOTEA)          := ocotea
   entrypoint-$(CONFIG_OCOTEA)          := 0x01000000
 
-     extra.o-$(CONFIG_EV64260)         := misc-ev64260.o
+     extra.o-$(CONFIG_EV64260)         := direct.o misc-ev64260.o
          end-$(CONFIG_EV64260)         := ev64260
    cacheflag-$(CONFIG_EV64260)         := -include $(clear_L2_L3)
 
@@ -113,6 +113,12 @@ zimageinitrd-$(CONFIG_SPRUCE)              := zImage.initrd-TREE
   entrypoint-$(CONFIG_SPRUCE)          := 0x00800000
         misc-$(CONFIG_SPRUCE)          += misc-spruce.o
 
+      zimage-$(CONFIG_LITE5200)                := zImage-STRIPELF
+zimageinitrd-$(CONFIG_LITE5200)                := zImage.initrd-STRIPELF
+         end-$(CONFIG_LITE5200)                := lite5200
+   cacheflag-$(CONFIG_LITE5200)                := -include $(clear_L2_L3)
+
+
 # SMP images should have a '.smp' suffix.
          end-$(CONFIG_SMP)             := $(end-y).smp
 
@@ -136,16 +142,15 @@ boot-$(CONFIG_8xx)                += embed_config.o
 boot-$(CONFIG_8260)            += embed_config.o
 boot-$(CONFIG_BSEIP)           += iic.o
 boot-$(CONFIG_MBX)             += iic.o pci.o qspan_pci.o
-boot-$(CONFIG_MV64X60)         += misc-mv64x60.o
-boot-$(CONFIG_DMV182)          += mv64x60_stub.o
 boot-$(CONFIG_RPXCLASSIC)      += iic.o pci.o qspan_pci.o
 boot-$(CONFIG_RPXLITE)         += iic.o
 # Different boards need different serial implementations.
-ifeq ($(CONFIG_SERIAL_CONSOLE),y)
+ifeq ($(CONFIG_SERIAL_CPM_CONSOLE),y)
 boot-$(CONFIG_8xx)             += m8xx_tty.o
 boot-$(CONFIG_8260)            += m8260_tty.o
 endif
-boot-$(CONFIG_SERIAL_MPSC_CONSOLE)     += mv64x60_tty.o
+boot-$(CONFIG_SERIAL_MPC52xx_CONSOLE) += mpc52xx_tty.o
+boot-$(CONFIG_GT64260_CONSOLE) += gt64260_tty.o
 
 LIBS                           := $(common)/lib.a $(bootlib)/lib.a
 ifeq ($(CONFIG_PPC_PREP),y)
index 054e20b..be0b6ca 100644 (file)
@@ -97,7 +97,7 @@ embed_config(bd_t **bdp)
 #endif /* CONFIG_MBX */
 
 #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) || \
-       defined(CONFIG_RPX6) || defined(CONFIG_EP405)
+       defined(CONFIG_RPX8260) || defined(CONFIG_EP405)
 /* Helper functions for Embedded Planet boards.
 */
 /* Because I didn't find anything that would do this.......
@@ -147,7 +147,7 @@ rpx_eth(bd_t *bd, u_char *cp)
        }
 }
 
-#ifdef CONFIG_RPX6
+#ifdef CONFIG_RPX8260
 static uint
 rpx_baseten(u_char *cp)
 {
@@ -588,7 +588,7 @@ embed_config(bd_t **bdp)
 }
 #endif /* SBS8260 */
 
-#ifdef CONFIG_RPX6
+#ifdef CONFIG_RPX8260
 void
 embed_config(bd_t **bdp)
 {
diff --git a/arch/ppc/boot/simple/gt64260_tty.c b/arch/ppc/boot/simple/gt64260_tty.c
new file mode 100644 (file)
index 0000000..e5d1483
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * arch/ppc/boot/simple/gt64260_tty.c
+ *
+ * Bootloader version of the embedded MPSC/UART driver for the GT64260[A].
+ * Note: Due to 64260A errata, DMA will be used for UART input (via SDMA).
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+/* This code assumes that the data cache has been disabled (L1, L2, L3). */
+
+#include <linux/config.h>
+#include <linux/serialP.h>
+#include <linux/serial_reg.h>
+#include <asm/serial.h>
+#include <asm/gt64260_defs.h>
+
+extern void udelay(long);
+static void stop_dma(int chan);
+
+static u32     gt64260_base = EV64260_BRIDGE_REG_BASE; /* base addr of 64260 */
+
+inline unsigned
+gt64260_in_le32(volatile unsigned *addr)
+{
+       unsigned ret;
+
+       __asm__ __volatile__("lwbrx %0,0,%1; eieio" : "=r" (ret) :
+                                    "r" (addr), "m" (*addr));
+       return ret;
+}
+
+inline void
+gt64260_out_le32(volatile unsigned *addr, int val)
+{
+       __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
+                                    "r" (val), "r" (addr));
+}
+
+#define GT64260_REG_READ(offs)                                         \
+       (gt64260_in_le32((volatile uint *)(gt64260_base + (offs))))
+#define GT64260_REG_WRITE(offs, d)                                     \
+        (gt64260_out_le32((volatile uint *)(gt64260_base + (offs)), (int)(d)))
+
+
+static struct {
+       u32     sdc;
+       u32     sdcm;
+       u32     rx_desc;
+       u32     rx_buf_ptr;
+       u32     scrdp;
+       u32     tx_desc;
+       u32     sctdp;
+       u32     sftdp;
+} sdma_regs;
+
+#define        SDMA_REGS_INIT(chan) {                                          \
+       sdma_regs.sdc        = GT64260_SDMA_##chan##_SDC;               \
+       sdma_regs.sdcm       = GT64260_SDMA_##chan##_SDCM;              \
+       sdma_regs.rx_desc    = GT64260_SDMA_##chan##_RX_DESC;           \
+       sdma_regs.rx_buf_ptr = GT64260_SDMA_##chan##_RX_BUF_PTR;        \
+       sdma_regs.scrdp      = GT64260_SDMA_##chan##_SCRDP;             \
+       sdma_regs.tx_desc    = GT64260_SDMA_##chan##_TX_DESC;           \
+       sdma_regs.sctdp      = GT64260_SDMA_##chan##_SCTDP;             \
+       sdma_regs.sftdp      = GT64260_SDMA_##chan##_SFTDP;             \
+}
+
+typedef struct {
+       volatile u16 bufsize;
+       volatile u16 bytecnt;
+       volatile u32 cmd_stat;
+       volatile u32 next_desc_ptr;
+       volatile u32 buffer;
+} gt64260_rx_desc_t;
+
+typedef struct {
+       volatile u16 bytecnt;
+       volatile u16 shadow;
+       volatile u32 cmd_stat;
+       volatile u32 next_desc_ptr;
+       volatile u32 buffer;
+} gt64260_tx_desc_t;
+
+#define        MAX_RESET_WAIT  10000
+#define        MAX_TX_WAIT     10000
+
+#define        RX_NUM_DESC     2
+#define        TX_NUM_DESC     2
+
+#define        RX_BUF_SIZE     16
+#define        TX_BUF_SIZE     16
+
+static gt64260_rx_desc_t rd[RX_NUM_DESC] __attribute__ ((aligned(32)));
+static gt64260_tx_desc_t td[TX_NUM_DESC] __attribute__ ((aligned(32)));
+
+static char rx_buf[RX_NUM_DESC * RX_BUF_SIZE] __attribute__ ((aligned(32)));
+static char tx_buf[TX_NUM_DESC * TX_BUF_SIZE] __attribute__ ((aligned(32)));
+
+static int cur_rd = 0;
+static int cur_td = 0;
+
+
+#define        RX_INIT_RDP(rdp) {                                              \
+       (rdp)->bufsize = 2;                                             \
+       (rdp)->bytecnt = 0;                                             \
+       (rdp)->cmd_stat = GT64260_SDMA_DESC_CMDSTAT_L |                 \
+                         GT64260_SDMA_DESC_CMDSTAT_F |                 \
+                         GT64260_SDMA_DESC_CMDSTAT_O;                  \
+}
+
+unsigned long
+serial_init(int chan, void *ignored)
+{
+       u32     mpsc_adjust, sdma_adjust, brg_bcr;
+       int     i;
+
+       stop_dma(0);
+       stop_dma(1);
+
+       if (chan != 1) {
+               chan = 0;  /* default to chan 0 if anything but 1 */
+               mpsc_adjust = 0;
+               sdma_adjust = 0;
+               brg_bcr = GT64260_BRG_0_BCR;
+               SDMA_REGS_INIT(0);
+       }
+       else {
+               mpsc_adjust = 0x1000;
+               sdma_adjust = 0x2000;
+               brg_bcr = GT64260_BRG_1_BCR;
+               SDMA_REGS_INIT(1);
+       }
+
+       /* Set up ring buffers */
+       for (i=0; i<RX_NUM_DESC; i++) {
+               RX_INIT_RDP(&rd[i]);
+               rd[i].buffer = (u32)&rx_buf[i * RX_BUF_SIZE];
+               rd[i].next_desc_ptr = (u32)&rd[i+1];
+       }
+       rd[RX_NUM_DESC - 1].next_desc_ptr = (u32)&rd[0];
+
+       for (i=0; i<TX_NUM_DESC; i++) {
+               td[i].bytecnt = 0;
+               td[i].shadow = 0;
+               td[i].buffer = (u32)&tx_buf[i * TX_BUF_SIZE];
+               td[i].cmd_stat = GT64260_SDMA_DESC_CMDSTAT_F |
+                                GT64260_SDMA_DESC_CMDSTAT_L;
+               td[i].next_desc_ptr = (u32)&td[i+1];
+       }
+       td[TX_NUM_DESC - 1].next_desc_ptr = (u32)&td[0];
+
+       /* Set MPSC Routing */
+        GT64260_REG_WRITE(GT64260_MPSC_MRR, 0x3ffffe38);
+        GT64260_REG_WRITE(GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
+
+       /* MPSC 0/1 Rx & Tx get clocks BRG0/1 */
+        GT64260_REG_WRITE(GT64260_MPSC_RCRR, 0x00000100);
+        GT64260_REG_WRITE(GT64260_MPSC_TCRR, 0x00000100);
+
+       /* clear pending interrupts */
+        GT64260_REG_WRITE(GT64260_SDMA_INTR_MASK, 0);
+
+       GT64260_REG_WRITE(GT64260_SDMA_0_SCRDP + sdma_adjust, &rd[0]);
+       GT64260_REG_WRITE(GT64260_SDMA_0_SCTDP + sdma_adjust,
+               &td[TX_NUM_DESC - 1]);
+       GT64260_REG_WRITE(GT64260_SDMA_0_SFTDP + sdma_adjust,
+               &td[TX_NUM_DESC - 1]);
+
+       GT64260_REG_WRITE(GT64260_SDMA_0_SDC + sdma_adjust,
+                         GT64260_SDMA_SDC_RFT | GT64260_SDMA_SDC_SFM |
+                         GT64260_SDMA_SDC_BLMR | GT64260_SDMA_SDC_BLMT |
+                         (3 << 12));
+
+       /* Set BRG to generate proper baud rate */
+       GT64260_REG_WRITE(brg_bcr, ((8 << 18) | (1 << 16) | 36));
+
+       /* Put MPSC into UART mode, no null modem, 16x clock mode */
+       GT64260_REG_WRITE(GT64260_MPSC_0_MMCRL + mpsc_adjust, 0x000004c4);
+       GT64260_REG_WRITE(GT64260_MPSC_0_MMCRH + mpsc_adjust, 0x04400400);
+
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_1 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_9 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_10 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_3 + mpsc_adjust, 4);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_4 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_5 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_6 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_7 + mpsc_adjust, 0);
+        GT64260_REG_WRITE(GT64260_MPSC_0_CHR_8 + mpsc_adjust, 0);
+
+       /* 8 data bits, 1 stop bit */
+       GT64260_REG_WRITE(GT64260_MPSC_0_MPCR + mpsc_adjust, (3 << 12));
+
+       GT64260_REG_WRITE(GT64260_SDMA_0_SDCM + sdma_adjust,
+               GT64260_SDMA_SDCM_ERD);
+
+       GT64260_REG_WRITE(GT64260_MPSC_0_CHR_2 + sdma_adjust,
+               GT64260_MPSC_UART_CR_EH);
+
+       udelay(100);
+
+       return (ulong)chan;
+}
+
+static void
+stop_dma(int chan)
+{
+       u32     sdma_sdcm = GT64260_SDMA_0_SDCM;
+       int     i;
+
+       if (chan == 1) {
+               sdma_sdcm = GT64260_SDMA_1_SDCM;
+       }
+
+       /* Abort SDMA Rx, Tx */
+       GT64260_REG_WRITE(sdma_sdcm,
+               GT64260_SDMA_SDCM_AR | GT64260_SDMA_SDCM_STD);
+
+       for (i=0; i<MAX_RESET_WAIT; i++) {
+               if ((GT64260_REG_READ(sdma_sdcm) & (GT64260_SDMA_SDCM_AR |
+                                       GT64260_SDMA_SDCM_AT)) == 0) break;
+               udelay(100);
+       }
+
+       return;
+}
+
+static int
+wait_for_ownership(void)
+{
+       int     i;
+
+       for (i=0; i<MAX_TX_WAIT; i++) {
+               if ((GT64260_REG_READ(sdma_regs.sdcm) &
+                                       GT64260_SDMA_SDCM_TXD) == 0) break;
+               udelay(1000);
+       }
+
+       return (i < MAX_TX_WAIT);
+}
+
+void
+serial_putc(unsigned long com_port, unsigned char c)
+{
+       gt64260_tx_desc_t       *tdp;
+
+       if (wait_for_ownership() == 0) return;
+
+       tdp = &td[cur_td];
+       if (++cur_td >= TX_NUM_DESC) cur_td = 0;
+
+       *(unchar *)(tdp->buffer ^ 7) = c;
+       tdp->bytecnt = 1;
+       tdp->shadow = 1;
+       tdp->cmd_stat = GT64260_SDMA_DESC_CMDSTAT_L |
+               GT64260_SDMA_DESC_CMDSTAT_F | GT64260_SDMA_DESC_CMDSTAT_O;
+
+       GT64260_REG_WRITE(sdma_regs.sctdp, tdp);
+       GT64260_REG_WRITE(sdma_regs.sftdp, tdp);
+       GT64260_REG_WRITE(sdma_regs.sdcm,
+               GT64260_REG_READ(sdma_regs.sdcm) | GT64260_SDMA_SDCM_TXD);
+
+       return;
+}
+
+unsigned char
+serial_getc(unsigned long com_port)
+{
+       gt64260_rx_desc_t       *rdp;
+       unchar                  c = '\0';
+
+       rdp = &rd[cur_rd];
+
+       if ((rdp->cmd_stat & (GT64260_SDMA_DESC_CMDSTAT_O |
+                             GT64260_SDMA_DESC_CMDSTAT_ES)) == 0) {
+               c = *(unchar *)(rdp->buffer ^ 7);
+               RX_INIT_RDP(rdp);
+               if (++cur_rd >= RX_NUM_DESC) cur_rd = 0;
+       }
+
+       return c;
+}
+
+int
+serial_tstc(unsigned long com_port)
+{
+       gt64260_rx_desc_t       *rdp;
+       int                     loop_count = 0;
+       int                     rc = 0;
+
+       rdp = &rd[cur_rd];
+
+       /* Go thru rcv desc's until empty looking for one with data (no error)*/
+       while (((rdp->cmd_stat & GT64260_SDMA_DESC_CMDSTAT_O) == 0) &&
+              (loop_count++ < RX_NUM_DESC)) {
+
+               /* If there was an error, reinit the desc & continue */
+               if ((rdp->cmd_stat & GT64260_SDMA_DESC_CMDSTAT_ES) != 0) {
+                       RX_INIT_RDP(rdp);
+                       if (++cur_rd >= RX_NUM_DESC) cur_rd = 0;
+                       rdp = (gt64260_rx_desc_t *)rdp->next_desc_ptr;
+               }
+               else {
+                       rc = 1;
+                       break;
+               }
+       }
+
+       return rc;
+}
+
+void
+serial_close(unsigned long com_port)
+{
+       stop_dma(com_port);
+       return;
+}
index e80c7d8..fb58d4e 100644 (file)
@@ -57,7 +57,7 @@ start_:
        isync
 #endif
 
-#if defined(CONFIG_MBX) || defined(CONFIG_RPX6) || defined(CONFIG_PPC_PREP)
+#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
        mr      r29,r3  /* On the MBX860, r3 is the board info pointer.
                         * On the RPXSUPER, r3 points to the NVRAM
                         * configuration keys.
@@ -129,15 +129,15 @@ haveOF:
        mr      r3, r29
 #endif
 
-#if defined(CONFIG_MBX) || defined(CONFIG_RPX6) || defined(CONFIG_PPC_PREP)
+#if defined(CONFIG_MBX) || defined(CONFIG_RPX8260) || defined(CONFIG_PPC_PREP)
        mr      r4,r29  /* put the board info pointer where the relocate
                         * routine will find it
                         */
 #endif
 
-#ifdef CONFIG_MV64X60
-       /* mv64x60 specific hook to do things like moving register base, etc. */
-       bl      mv64x60_init
+#ifdef CONFIG_EV64260
+       /* Move 64260's base regs & CS window for external UART */
+       bl      ev64260_init
 #endif
 
        /* Get the load address.
index 8deccc5..c3e2c39 100644 (file)
@@ -15,19 +15,22 @@ static              int     cons_hold_cnt;
 /* If defined, enables serial console.  The value (1 through 4)
  * should designate which SCC is used, but this isn't complete.  Only
  * SCC1 is known to work at this time.
+ * We're only linked if SERIAL_CPM_CONSOLE=y, so we only need to test
+ * SERIAL_CPM_SCC1.
  */
-#ifdef CONFIG_SCC_CONSOLE
+#ifdef CONFIG_SERIAL_CPM_SCC1
 #define SCC_CONSOLE 1
 #endif
 
 unsigned long
 serial_init(int ignored, bd_t *bd)
 {
-       volatile smc_t          *sp;
-       volatile smc_uart_t     *up;
 #ifdef SCC_CONSOLE
        volatile scc_t          *sccp;
        volatile scc_uart_t     *sup;
+#else
+       volatile smc_t          *sp;
+       volatile smc_uart_t     *up;
 #endif
        volatile cbd_t  *tbdf, *rbdf;
        volatile cpm2_map_t     *ip;
@@ -222,8 +225,11 @@ serial_readbuf(u_char *cbuf)
 {
        volatile cbd_t          *rbdf;
        volatile char           *buf;
-       volatile smc_uart_t     *up;
+#ifdef SCC_CONSOLE
        volatile scc_uart_t     *sup;
+#else
+       volatile smc_uart_t     *up;
+#endif
        volatile cpm2_map_t     *ip;
        int     i, nc;
 
@@ -254,10 +260,12 @@ serial_putc(void *ignored, const char c)
 {
        volatile cbd_t          *tbdf;
        volatile char           *buf;
-       volatile smc_uart_t     *up;
+#ifdef SCC_CONSOLE
        volatile scc_uart_t     *sup;
+#else
+       volatile smc_uart_t     *up;
+#endif
        volatile cpm2_map_t     *ip;
-       extern bd_t             *board_info;
 
        ip = (cpm2_map_t *)CPM_MAP_ADDR;
 #ifdef SCC_CONSOLE
@@ -297,8 +305,11 @@ int
 serial_tstc(void *ignored)
 {
        volatile cbd_t          *rbdf;
-       volatile smc_uart_t     *up;
+#ifdef SCC_CONSOLE
        volatile scc_uart_t     *sup;
+#else
+       volatile smc_uart_t     *up;
+#endif
        volatile cpm2_map_t     *ip;
 
        ip = (cpm2_map_t *)CPM_MAP_ADDR;
index 957e0f6..7ce6815 100644 (file)
@@ -1,70 +1,60 @@
 /*
  * arch/ppc/boot/simple/misc-ev64260.S
- * 
+ *
  * Host bridge init code for the Marvell/Galileo EV-64260-BP evaluation board
  * with a GT64260 onboard.
  *
  * Author: Mark Greer <mgreer@mvista.com>
  *
- * Copyright 2001 MontaVista Software Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
  */
 
 #include <asm/ppc_asm.h>
-#include <asm/processor.h>
 #include <asm/cache.h>
-#include <asm/mv64x60_defs.h>
+#include <asm/gt64260_defs.h>
+
 #include <platforms/ev64260.h>
 
-       .globl  mv64x60_board_init
-mv64x60_board_init:
-       /* DINK doesn't enable 745x timebase, so enable here (Adrian Cox) */
-       mfspr   r25,PVR
-       srwi    r25,r25,16
-       cmplwi  r25,(PVR_7450 >> 16)
-       bne     1f
-       mfspr   r25,HID0
-       oris    r25,r25,(HID0_TBEN >> 16)
-       mtspr   HID0,r25
-1:
-#if (CONFIG_MV64X60_NEW_BASE != CONFIG_MV64X60_BASE)
+       .globl  ev64260_init
+ev64260_init:
+       li      r20,0
        li      r23,20
 
-       /*
-        * Change the CS2 window for the UART so that the bootloader
-        * can do I/O thru the UARTs.
-        */
-        addis  r25,0,CONFIG_MV64X60_NEW_BASE@h
-        ori    r25,r25,MV64x60_CPU2DEV_2_BASE             
+       /* Relocate galileo's regs */
+        addis  r25,0,GT64260_INTERNAL_SPACE_DEFAULT_ADDR@h
+        ori    r25,r25,GT64260_INTERNAL_SPACE_DECODE
+        lwbrx  r26,0,(r25)
+       lis     r24,0xffff
+       and     r26,r26,r24
+       addis   r24,0,EV64260_BRIDGE_REG_BASE@h
+       srw     r24,r24,r23
+       or      r26,r26,r24
+        stwbrx  r26,0,(r25)
+       sync
+
+       /* Wait for write to take effect */
+        addis  r25,0,EV64260_BRIDGE_REG_BASE@h
+       ori     r25,r25,GT64260_INTERNAL_SPACE_DECODE
+1:     lwbrx   r24,0,(r25)
+       cmpw    r24,r26
+       bne     1b
+
+        /* Change CS2 (UARTS on device module) window */
+        addis  r25,0,EV64260_BRIDGE_REG_BASE@h
+        ori    r25,r25,GT64260_CPU_CS_DECODE_2_BOT
        addis   r26,0,EV64260_UART_BASE@h
        srw     r26,r26,r23
         stwbrx  r26,0,(r25)
        sync
 
-        addis  r25,0,CONFIG_MV64X60_NEW_BASE@h
-        ori    r25,r25,MV64x60_CPU2DEV_2_SIZE
+        addis  r25,0,EV64260_BRIDGE_REG_BASE@h
+        ori    r25,r25,GT64260_CPU_CS_DECODE_2_TOP
        addis   r26,0,EV64260_UART_END@h
        srw     r26,r26,r23
         stwbrx  r26,0,(r25)
        sync
-#endif
-        blr
-
-#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
-.data
-       .globl  mv64x60_console_baud
-mv64x60_console_baud:
-.long  EV64260_DEFAULT_BAUD
 
-       .globl  mv64x60_mpsc_clk_src
-mv64x60_mpsc_clk_src:
-.long  EV64260_MPSC_CLK_SRC
-
-       .globl  mv64x60_mpsc_clk_freq
-mv64x60_mpsc_clk_freq:
-.long  EV64260_MPSC_CLK_FREQ
-#endif
+        blr
diff --git a/arch/ppc/boot/simple/misc-mv64x60.S b/arch/ppc/boot/simple/misc-mv64x60.S
deleted file mode 100644 (file)
index 9c809c8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * arch/ppc/boot/simple/misc-mv64x60.S
- * 
- * Code to change the base address of the host bridges and call board specific
- * init routine.
- *
- * Author: Mark Greer <mgreer@mvista.com>
- *
- * 2002 (c) MontaVista, Software, Inc.  This file is licensed under the terms
- * of the GNU General Public License version 2.  This program is licensed
- * "as is" without any warranty of any kind, whether express or implied.
- */
-
-#include <linux/config.h>
-#include <asm/ppc_asm.h>
-#include <asm/processor.h>
-#include <asm/cache.h>
-#include <asm/mv64x60_defs.h>
-
-       .globl  mv64x60_init
-mv64x60_init:
-       mflr    r27
-
-#if (CONFIG_MV64X60_NEW_BASE != CONFIG_MV64X60_BASE)
-       bl      move_base
-#endif
-       bl      mv64x60_board_init
-
-       mtlr    r27
-       blr
-
-#if (CONFIG_MV64X60_NEW_BASE != CONFIG_MV64X60_BASE)
-move_base:
-       li      r20,0
-       li      r23,20
-
-       /* Relocate bridge's regs */
-        addis  r25,0,CONFIG_MV64X60_BASE@h
-        ori    r25,r25,MV64x60_INTERNAL_SPACE_DECODE             
-        lwbrx  r26,0,(r25)
-       lis     r24,0xffff
-       and     r26,r26,r24
-       addis   r24,0,CONFIG_MV64X60_NEW_BASE@h
-       srw     r24,r24,r23
-       or      r26,r26,r24
-        stwbrx  r26,0,(r25)
-       sync
-
-       /* Wait for write to take effect */
-        addis  r25,0,CONFIG_MV64X60_NEW_BASE@h
-       ori     r25,r25,MV64x60_INTERNAL_SPACE_DECODE
-1:     lwbrx   r24,0,(r25)
-       cmpw    r24,r26
-       bne     1b
-
-       blr
-#endif
index 4126588..f09af4f 100644 (file)
@@ -50,7 +50,7 @@
  * user to edit the cmdline or not.
  */
 #if (defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_VGA_CONSOLE)) \
-       && !defined(CONFIG_GEMINI) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+       && !defined(CONFIG_GEMINI)
 #define INTERACTIVE_CONSOLE    1
 #endif
 
@@ -98,7 +98,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
        unsigned long initrd_loc, TotalMemory = 0;
 
        serial_fixups();
-#if defined(CONFIG_SERIAL_8250_CONSOLE) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
+#ifdef CONFIG_SERIAL_8250_CONSOLE
        com_port = serial_init(0, NULL);
 #endif
 
@@ -221,7 +221,7 @@ decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum)
        puts("\n");
 
        puts("Uncompressing Linux...");
-       gunzip(0, 0x400000, zimage_start, &zimage_size);
+       gunzip(NULL, 0x400000, zimage_start, &zimage_size);
        puts("done.\n");
 
        /* get the bi_rec address */
diff --git a/arch/ppc/boot/simple/mv64x60_stub.c b/arch/ppc/boot/simple/mv64x60_stub.c
deleted file mode 100644 (file)
index 46d9924..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * arch/ppc/boot/simple/mv64x60_stub.c
- *
- * Stub for board_init() routine called from mv64x60_init().
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2002 (c) MontaVista, Software, Inc.  This file is licensed under the terms
- * of the GNU General Public License version 2.  This program is licensed
- * "as is" without any warranty of any kind, whether express or implied.
- */
-
-long   mv64x60_console_baud = 9600;            /* Default baud: 9600 */
-long   mv64x60_mpsc_clk_src = 8;               /* Default clk src: TCLK */
-long   mv64x60_mpsc_clk_freq = 100000000;      /* Default clk freq: 100 MHz */
-
-void
-mv64x60_board_init(void)
-{
-}
diff --git a/arch/ppc/boot/simple/mv64x60_tty.c b/arch/ppc/boot/simple/mv64x60_tty.c
deleted file mode 100644 (file)
index b1cb21a..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * arch/ppc/boot/simple/mv64x60_tty.c
- * 
- * Bootloader version of the embedded MPSC/UART driver for the Marvell 64x60.
- * Note: Due to a GT64260A erratum, DMA will be used for UART input (via SDMA).
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * Copyright 2001 MontaVista Software Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-/* This code assumes that the data cache has been disabled (L1, L2, L3). */
-
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/serial_reg.h>
-#include <asm/serial.h>
-#include <asm/mv64x60_defs.h>
-#include "../../../../drivers/serial/mpsc/mpsc_defs.h"
-
-extern void udelay(long);
-static void stop_dma(int chan);
-
-static u32     mv64x60_base = CONFIG_MV64X60_NEW_BASE;
-
-inline unsigned
-mv64x60_in_le32(volatile unsigned *addr)
-{
-       unsigned ret;
-
-       __asm__ __volatile__("lwbrx %0,0,%1; eieio" : "=r" (ret) :
-                                    "r" (addr), "m" (*addr));
-       return ret;
-}
-
-inline void
-mv64x60_out_le32(volatile unsigned *addr, int val)
-{
-       __asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
-                                    "r" (val), "r" (addr));
-}
-
-#define MV64x60_REG_READ(offs)                                         \
-       (mv64x60_in_le32((volatile uint *)(mv64x60_base + (offs))))
-#define MV64x60_REG_WRITE(offs, d)                                     \
-        (mv64x60_out_le32((volatile uint *)(mv64x60_base + (offs)), (int)(d)))
-
-
-typedef struct {
-       u32     sdc;
-       u32     sdcm;
-       u32     rx_desc;
-       u32     rx_buf_ptr;
-       u32     scrdp;
-       u32     tx_desc;
-       u32     sctdp;
-       u32     sftdp;
-} sdma_regs_t;
-
-static sdma_regs_t  sdma_regs[2];
-
-#define        SDMA_REGS_INIT(s, reg_base) {                   \
-       (s)->sdc        = (reg_base) + SDMA_SDC;        \
-       (s)->sdcm       = (reg_base) + SDMA_SDCM;       \
-       (s)->rx_desc    = (reg_base) + SDMA_RX_DESC;    \
-       (s)->rx_buf_ptr = (reg_base) + SDMA_RX_BUF_PTR; \
-       (s)->scrdp      = (reg_base) + SDMA_SCRDP;      \
-       (s)->tx_desc    = (reg_base) + SDMA_TX_DESC;    \
-       (s)->sctdp      = (reg_base) + SDMA_SCTDP;      \
-       (s)->sftdp      = (reg_base) + SDMA_SFTDP;      \
-}
-
-typedef struct {
-       volatile u16 bufsize;
-       volatile u16 bytecnt;
-       volatile u32 cmd_stat;
-       volatile u32 next_desc_ptr;
-       volatile u32 buffer;
-} mv64x60_rx_desc_t;
-
-typedef struct {
-       volatile u16 bytecnt;
-       volatile u16 shadow;
-       volatile u32 cmd_stat;
-       volatile u32 next_desc_ptr;
-       volatile u32 buffer;
-} mv64x60_tx_desc_t;
-
-#define        MAX_RESET_WAIT  10000
-#define        MAX_TX_WAIT     10000
-
-#define        RX_NUM_DESC     2
-#define        TX_NUM_DESC     2
-
-#define        RX_BUF_SIZE     16
-#define        TX_BUF_SIZE     16
-
-static mv64x60_rx_desc_t rd[2][RX_NUM_DESC] __attribute__ ((aligned(32)));
-static mv64x60_tx_desc_t td[2][TX_NUM_DESC] __attribute__ ((aligned(32)));
-
-static char rx_buf[2][RX_NUM_DESC * RX_BUF_SIZE] __attribute__ ((aligned(32)));
-static char tx_buf[2][TX_NUM_DESC * TX_BUF_SIZE] __attribute__ ((aligned(32)));
-
-static int cur_rd[2] = { 0, 0 };
-static int cur_td[2] = { 0, 0 };
-
-static char chan_initialized[2] = { 0, 0 };
-
-
-#define        RX_INIT_RDP(rdp) {                      \
-       (rdp)->bufsize = 2;                     \
-       (rdp)->bytecnt = 0;                     \
-       (rdp)->cmd_stat = SDMA_DESC_CMDSTAT_L | \
-                         SDMA_DESC_CMDSTAT_F | \
-                         SDMA_DESC_CMDSTAT_O;  \
-}
-
-unsigned long
-serial_init(int chan, void *ignored)
-{
-       u32             mpsc_base, mpsc_routing_base, sdma_base, brg_bcr, cdv;
-       int             i;
-       extern long     mv64x60_console_baud;
-       extern long     mv64x60_mpsc_clk_src;
-       extern long     mv64x60_mpsc_clk_freq;
-
-       chan = (chan == 1);  /* default to chan 0 if anything but 1 */
-
-       if (chan_initialized[chan]) return chan;
-
-       chan_initialized[chan] = 1;
-
-       if (chan == 0) {
-               mpsc_base = MV64x60_MPSC_0_OFFSET;
-               sdma_base = MV64x60_SDMA_0_OFFSET;
-               brg_bcr = MV64x60_BRG_0_OFFSET + BRG_BCR;
-               SDMA_REGS_INIT(&sdma_regs[0], MV64x60_SDMA_0_OFFSET);
-       }
-       else {
-               mpsc_base = MV64x60_MPSC_1_OFFSET;
-               sdma_base = MV64x60_SDMA_1_OFFSET;
-               brg_bcr = MV64x60_BRG_1_OFFSET + BRG_BCR;
-               SDMA_REGS_INIT(&sdma_regs[0], MV64x60_SDMA_1_OFFSET);
-       }
-
-       mpsc_routing_base = MV64x60_MPSC_ROUTING_OFFSET;
-
-       stop_dma(chan);
-
-       /* Set up ring buffers */
-       for (i=0; i<RX_NUM_DESC; i++) {
-               RX_INIT_RDP(&rd[chan][i]);
-               rd[chan][i].buffer = (u32)&rx_buf[chan][i * RX_BUF_SIZE];
-               rd[chan][i].next_desc_ptr = (u32)&rd[chan][i+1];
-       }
-       rd[chan][RX_NUM_DESC - 1].next_desc_ptr = (u32)&rd[chan][0];
-
-       for (i=0; i<TX_NUM_DESC; i++) {
-               td[chan][i].bytecnt = 0;
-               td[chan][i].shadow = 0;
-               td[chan][i].buffer = (u32)&tx_buf[chan][i * TX_BUF_SIZE];
-               td[chan][i].cmd_stat = SDMA_DESC_CMDSTAT_F|SDMA_DESC_CMDSTAT_L;
-               td[chan][i].next_desc_ptr = (u32)&td[chan][i+1];
-       }
-       td[chan][TX_NUM_DESC - 1].next_desc_ptr = (u32)&td[chan][0];
-
-       /* Set MPSC Routing */
-        MV64x60_REG_WRITE(mpsc_routing_base + MPSC_MRR, 0x3ffffe38);
-
-/* XXXX Not for 64360 XXXX*/
-        MV64x60_REG_WRITE(GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
-
-       /* MPSC 0/1 Rx & Tx get clocks BRG0/1 */
-        MV64x60_REG_WRITE(mpsc_routing_base + MPSC_RCRR, 0x00000100);
-        MV64x60_REG_WRITE(mpsc_routing_base + MPSC_TCRR, 0x00000100);
-
-       /* clear pending interrupts */
-        MV64x60_REG_WRITE(MV64x60_SDMA_INTR_OFFSET + SDMA_INTR_MASK, 0);
-
-       MV64x60_REG_WRITE(SDMA_SCRDP + sdma_base, &rd[chan][0]);
-       MV64x60_REG_WRITE(SDMA_SCTDP + sdma_base, &td[chan][TX_NUM_DESC - 1]);
-       MV64x60_REG_WRITE(SDMA_SFTDP + sdma_base, &td[chan][TX_NUM_DESC - 1]);
-
-       MV64x60_REG_WRITE(SDMA_SDC + sdma_base,
-                 SDMA_SDC_RFT | SDMA_SDC_SFM | SDMA_SDC_BLMR | SDMA_SDC_BLMT |
-                 (3 << 12));
-
-       cdv = ((mv64x60_mpsc_clk_freq/(32*mv64x60_console_baud))-1);
-       MV64x60_REG_WRITE(brg_bcr,
-               ((mv64x60_mpsc_clk_src << 18) | (1 << 16) | cdv));
-
-       /* Put MPSC into UART mode, no null modem, 16x clock mode */
-       MV64x60_REG_WRITE(MPSC_MMCRL + mpsc_base, 0x000004c4);
-       MV64x60_REG_WRITE(MPSC_MMCRH + mpsc_base, 0x04400400);
-
-        MV64x60_REG_WRITE(MPSC_CHR_1 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_9 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_10 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_3 + mpsc_base, 4);
-        MV64x60_REG_WRITE(MPSC_CHR_4 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_5 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_6 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_7 + mpsc_base, 0);
-        MV64x60_REG_WRITE(MPSC_CHR_8 + mpsc_base, 0);
-
-       /* 8 data bits, 1 stop bit */
-       MV64x60_REG_WRITE(MPSC_MPCR + mpsc_base, (3 << 12));
-       MV64x60_REG_WRITE(SDMA_SDCM + sdma_base, SDMA_SDCM_ERD);
-       MV64x60_REG_WRITE(MPSC_CHR_2 + mpsc_base, MPSC_CHR_2_EH);
-
-       udelay(100);
-
-       return chan;
-}
-
-static void
-stop_dma(int chan)
-{
-       int     i;
-
-       /* Abort SDMA Rx, Tx */
-       MV64x60_REG_WRITE(sdma_regs[chan].sdcm, SDMA_SDCM_AR | SDMA_SDCM_STD);
-
-       for (i=0; i<MAX_RESET_WAIT; i++) {
-               if ((MV64x60_REG_READ(sdma_regs[chan].sdcm) &
-                       (SDMA_SDCM_AR | SDMA_SDCM_AT)) == 0) {
-                       break;
-               }
-               udelay(100);
-       }
-
-       return;
-}
-
-static int
-wait_for_ownership(int chan)
-{
-       int     i;
-
-       for (i=0; i<MAX_TX_WAIT; i++) {
-               if ((MV64x60_REG_READ(sdma_regs[chan].sdcm) &
-                                       SDMA_SDCM_TXD) == 0)
-                       break;
-               udelay(1000);
-       }
-
-       return (i < MAX_TX_WAIT);
-}
-
-void
-serial_putc(unsigned long com_port, unsigned char c)
-{
-       mv64x60_tx_desc_t       *tdp;
-
-       if (wait_for_ownership(com_port) == 0) return;
-
-       tdp = &td[com_port][cur_td[com_port]];
-       if (++cur_td[com_port] >= TX_NUM_DESC) cur_td[com_port] = 0;
-
-       *(unchar *)(tdp->buffer ^ 7) = c;
-       tdp->bytecnt = 1;
-       tdp->shadow = 1;
-       tdp->cmd_stat = SDMA_DESC_CMDSTAT_L | SDMA_DESC_CMDSTAT_F |
-               SDMA_DESC_CMDSTAT_O;
-
-       MV64x60_REG_WRITE(sdma_regs[com_port].sctdp, tdp);
-       MV64x60_REG_WRITE(sdma_regs[com_port].sftdp, tdp);
-       MV64x60_REG_WRITE(sdma_regs[com_port].sdcm,
-               MV64x60_REG_READ(sdma_regs[com_port].sdcm) | SDMA_SDCM_TXD);
-
-       return;
-}
-
-unsigned char
-serial_getc(unsigned long com_port)
-{
-       mv64x60_rx_desc_t       *rdp;
-       unchar                  c = '\0';
-
-       rdp = &rd[com_port][cur_rd[com_port]];
-
-       if ((rdp->cmd_stat & (SDMA_DESC_CMDSTAT_O|SDMA_DESC_CMDSTAT_ES)) == 0) {
-               c = *(unchar *)(rdp->buffer ^ 7);
-               RX_INIT_RDP(rdp);
-               if (++cur_rd[com_port] >= RX_NUM_DESC) cur_rd[com_port] = 0;
-       }
-
-       return c;
-}
-
-int
-serial_tstc(unsigned long com_port)
-{
-       mv64x60_rx_desc_t       *rdp;
-       int                     loop_count = 0;
-       int                     rc = 0;
-
-       rdp = &rd[com_port][cur_rd[com_port]];
-
-       /* Go thru rcv desc's until empty looking for one with data (no error)*/
-       while (((rdp->cmd_stat & SDMA_DESC_CMDSTAT_O) == 0) &&
-              (loop_count++ < RX_NUM_DESC)) {
-
-               /* If there was an error, reinit the desc & continue */
-               if ((rdp->cmd_stat & SDMA_DESC_CMDSTAT_ES) != 0) {
-                       RX_INIT_RDP(rdp);
-                       if (++cur_rd[com_port] >= RX_NUM_DESC) {
-                               cur_rd[com_port] = 0;
-                       }
-                       rdp = (mv64x60_rx_desc_t *)rdp->next_desc_ptr;
-               }
-               else {
-                       rc = 1;
-                       break;
-               }
-       }
-
-       return rc;
-}
-
-void
-serial_close(unsigned long com_port)
-{
-       stop_dma(com_port);
-       return;
-}
index b2d8e1c..c4a73cc 100644 (file)
@@ -235,7 +235,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 15ecefd..1e331f7 100644 (file)
@@ -489,7 +489,6 @@ CONFIG_IP_NF_RAW=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 1fc50f5..a336ffa 100644 (file)
@@ -255,7 +255,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 2c1334a..c8deca3 100644 (file)
@@ -245,7 +245,6 @@ CONFIG_NETFILTER=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -385,7 +384,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
+# CONFIG_SERIAL_8250_MANY_PORTS is not set
 CONFIG_SERIAL_8250_SHARE_IRQ=y
 # CONFIG_SERIAL_8250_DETECT_IRQ is not set
 # CONFIG_SERIAL_8250_MULTIPORT is not set
index 6f8b1e7..880b5f8 100644 (file)
@@ -238,7 +238,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index b0f304c..aa6b0ca 100644 (file)
@@ -4,39 +4,23 @@
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_HAVE_DEC_LOCK=y
-CONFIG_PPC=y
-CONFIG_PPC32=y
-CONFIG_GENERIC_NVRAM=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_HOTPLUG is not set
-# CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 
 #
 # Loadable module support
@@ -49,26 +33,24 @@ CONFIG_OBSOLETE_MODPARM=y
 CONFIG_KMOD=y
 
 #
-# Processor
+# Platform support
 #
+CONFIG_PPC=y
+CONFIG_PPC32=y
 CONFIG_6xx=y
 # CONFIG_40x is not set
-# CONFIG_44x is not set
 # CONFIG_POWER3 is not set
-# CONFIG_POWER4 is not set
 # CONFIG_8xx is not set
-CONFIG_ALTIVEC=y
-# CONFIG_TAU is not set
-# CONFIG_CPU_FREQ is not set
-CONFIG_PPC_STD_MMU=y
 
 #
-# Platform options
+# IBM 4xx options
 #
+# CONFIG_8260 is not set
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_PPC_STD_MMU=y
 # CONFIG_PPC_MULTIPLATFORM is not set
 # CONFIG_APUS is not set
-# CONFIG_KATANA is not set
-# CONFIG_WILLOW is not set
+# CONFIG_WILLOW_2 is not set
 # CONFIG_PCORE is not set
 # CONFIG_POWERPMC250 is not set
 CONFIG_EV64260=y
@@ -84,37 +66,37 @@ CONFIG_EV64260=y
 # CONFIG_K2 is not set
 # CONFIG_PAL4 is not set
 # CONFIG_GEMINI is not set
-# CONFIG_EST8260 is not set
-# CONFIG_SBS8260 is not set
-# CONFIG_RPX6 is not set
-# CONFIG_TQM8260 is not set
-
-#
-# Set bridge base address
-#
-CONFIG_MV64X60_BASE=0xf1000000
-CONFIG_MV64X60_NEW_BASE=0xfbe00000
-CONFIG_PPC_GEN550=y
 CONFIG_GT64260=y
-CONFIG_MV64X60=y
 CONFIG_SERIAL_CONSOLE_BAUD=115200
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
-# CONFIG_HIGHMEM is not set
-CONFIG_KERNEL_ELF=y
-CONFIG_BINFMT_ELF=y
-CONFIG_BINFMT_MISC=y
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyS0,115200 ip=on"
+CONFIG_ALTIVEC=y
+CONFIG_TAU=y
+# CONFIG_TAU_INT is not set
+# CONFIG_TAU_AVERAGE is not set
+# CONFIG_CPU_FREQ is not set
 
 #
-# Bus options
+# General setup
 #
-CONFIG_GENERIC_ISA_DMA=y
+# CONFIG_HIGHMEM is not set
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
+CONFIG_KCORE_ELF=y
+CONFIG_BINFMT_ELF=y
+CONFIG_KERNEL_ELF=y
+CONFIG_BINFMT_MISC=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
+# CONFIG_HOTPLUG is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+# CONFIG_PPC601_SYNC_FIX is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyS0,115200 ip=on"
 
 #
 # Advanced setup
@@ -130,27 +112,15 @@ CONFIG_KERNEL_START=0xc0000000
 CONFIG_TASK_SIZE=0x80000000
 CONFIG_BOOT_LOAD=0x00800000
 
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-
 #
 # Memory Technology Devices (MTD)
 #
 # CONFIG_MTD is not set
 
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
 #
 # Plug and Play support
 #
+# CONFIG_PNP is not set
 
 #
 # Block devices
@@ -161,35 +131,32 @@ CONFIG_BOOT_LOAD=0x00800000
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM 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_CARMEL is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
-# CONFIG_LBD is not set
 
 #
-# ATA/ATAPI/MFM/RLL support
+# Multi-device support (RAID and LVM)
 #
-# CONFIG_IDE is not set
+# CONFIG_MD is not set
 
 #
-# SCSI device support
+# ATA/IDE/MFM/RLL support
 #
-# CONFIG_SCSI is not set
+# CONFIG_IDE is not set
 
 #
-# Multi-device support (RAID and LVM)
+# SCSI support
 #
-# CONFIG_MD is not set
+# CONFIG_SCSI is not set
 
 #
 # Fusion MPT device support
 #
 
 #
-# IEEE 1394 (FireWire) support
+# IEEE 1394 (FireWire) support (EXPERIMENTAL)
 #
 # CONFIG_IEEE1394 is not set
 
@@ -198,10 +165,6 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # CONFIG_I2O is not set
 
-#
-# Macintosh device drivers
-#
-
 #
 # Networking support
 #
@@ -213,6 +176,8 @@ CONFIG_NET=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 # CONFIG_NETLINK_DEV is not set
+CONFIG_NETFILTER=y
+# CONFIG_NETFILTER_DEBUG is not set
 CONFIG_UNIX=y
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
@@ -226,30 +191,39 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
+# CONFIG_INET_ECN is not set
 CONFIG_SYN_COOKIES=y
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+
+#
+# IP: Netfilter Configuration
+#
+# CONFIG_IP_NF_CONNTRACK is not set
+# CONFIG_IP_NF_QUEUE is not set
+# CONFIG_IP_NF_IPTABLES is not set
+# CONFIG_IP_NF_ARPTABLES is not set
+# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
+# CONFIG_IP_NF_COMPAT_IPFWADM is not set
 # CONFIG_IPV6 is not set
-# CONFIG_NETFILTER is not set
+# CONFIG_XFRM_USER is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
+CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_LLC is not set
 # CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -261,27 +235,23 @@ CONFIG_SYN_COOKIES=y
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_ETHERTAP is not set
 
 #
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
-CONFIG_MII=y
+# CONFIG_MII is not set
 # CONFIG_OAKNET is not set
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
@@ -290,22 +260,13 @@ CONFIG_MII=y
 #
 # Tulip family network device support
 #
-CONFIG_NET_TULIP=y
-# CONFIG_DE2104X is not set
-CONFIG_TULIP=y
-# CONFIG_TULIP_MWI is not set
-# CONFIG_TULIP_MMIO is not set
-# CONFIG_TULIP_NAPI is not set
-# CONFIG_DE4X5 is not set
-# CONFIG_WINBOND_840 is not set
-# CONFIG_DM9102 is not set
+# CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
-# CONFIG_FORCEDETH is not set
 # CONFIG_DGRS is not set
 CONFIG_EEPRO100=y
 # CONFIG_EEPRO100_PIO is not set
@@ -338,55 +299,60 @@ CONFIG_EEPRO100=y
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
 
 #
-# Token Ring devices
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_TR is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices (depends on LLC=y)
 #
-# CONFIG_NET_RADIO is not set
+# CONFIG_RCPCI is not set
+# CONFIG_SHAPER is not set
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
+
+#
+# Amateur Radio support
+#
+# CONFIG_HAMRADIO is not set
+
+#
+# IrDA (infrared) support
+#
+# CONFIG_IRDA is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN is not set
+# CONFIG_ISDN_BOOL is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
 
 #
-# Telephony Support
+# Old CD-ROM drivers (not SCSI, not IDE)
 #
-# CONFIG_PHONE is not set
+# CONFIG_CD_NO_IDESCSI is not set
 
 #
 # Input device support
 #
-CONFIG_INPUT=y
+# CONFIG_INPUT is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
 
 #
 # Input I/O drivers
@@ -394,23 +360,18 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_GAMEPORT is not set
 CONFIG_SOUND_GAMEPORT=y
 # CONFIG_SERIO is not set
-# CONFIG_SERIO_I8042 is not set
 
 #
 # Input Device Drivers
 #
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
+
+#
+# Macintosh device drivers
+#
 
 #
 # Character devices
 #
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -418,18 +379,50 @@ CONFIG_HW_CONSOLE=y
 #
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
 #
 # Non-8250 serial port support
 #
-# CONFIG_SERIAL_MPSC is not set
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_UNIX98_PTY_COUNT=256
+
+#
+# I2C support
+#
+CONFIG_I2C=m
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+CONFIG_I2C_CHARDEV=m
+
+#
+# I2C Hardware Sensors Mainboard support
+#
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIAPRO is not set
+
+#
+# I2C Hardware Sensors Chip support
+#
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_I2C_SENSOR is not set
+
+#
+# Mice
+#
+# CONFIG_BUSMOUSE is not set
 # CONFIG_QIC02_TAPE is not set
 
 #
@@ -455,15 +448,7 @@ CONFIG_GEN_RTC=y
 # CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# Misc devices
-#
+# CONFIG_HANGCHECK_TIMER is not set
 
 #
 # Multimedia devices
@@ -475,33 +460,6 @@ CONFIG_GEN_RTC=y
 #
 # CONFIG_DVB is not set
 
-#
-# Graphics support
-#
-# CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
 #
 # File systems
 #
@@ -534,14 +492,12 @@ CONFIG_EXT2_FS=y
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
 CONFIG_DEVFS_FS=y
 # CONFIG_DEVFS_MOUNT is not set
 # CONFIG_DEVFS_DEBUG is not set
+CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
-# CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
 #
@@ -550,7 +506,6 @@ CONFIG_RAMFS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -567,18 +522,18 @@ CONFIG_RAMFS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # 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_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_SUNRPC_GSS is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
+# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -588,22 +543,32 @@ CONFIG_SUNRPC=y
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Native Language Support
+# Sound
 #
-# CONFIG_NLS is not set
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# Bluetooth support
+#
+# CONFIG_BT is not set
 
 #
 # Library routines
 #
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
+# CONFIG_CRC32 is not set
 
 #
 # Kernel hacking
 #
 # CONFIG_DEBUG_KERNEL is not set
+# CONFIG_KALLSYMS is not set
 # CONFIG_SERIAL_TEXT_DEBUG is not set
-CONFIG_PPC_OCP=y
 
 #
 # Security options
index 1661b99..a3b6ec0 100644 (file)
@@ -401,7 +401,6 @@ CONFIG_IP_NF_RAW=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 09f1bae..85ea06b 100644 (file)
@@ -368,7 +368,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 893d7a6..9dcf575 100644 (file)
@@ -247,7 +247,6 @@ CONFIG_NETFILTER=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -399,7 +398,7 @@ CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=4
 CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
+# CONFIG_SERIAL_8250_MANY_PORTS is not set
 CONFIG_SERIAL_8250_SHARE_IRQ=y
 # CONFIG_SERIAL_8250_DETECT_IRQ is not set
 # CONFIG_SERIAL_8250_MULTIPORT is not set
index 05842e7..ce48056 100644 (file)
@@ -513,7 +513,6 @@ CONFIG_IP_NF_RAW=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index bd7beeb..93da595 100644 (file)
@@ -360,7 +360,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 4af5a3c..4c5486d 100644 (file)
@@ -247,7 +247,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index cc3f76c..5752845 100644 (file)
@@ -225,7 +225,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 739b095..0f4393a 100644 (file)
@@ -270,7 +270,6 @@ CONFIG_IP_PNP_BOOTP=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index ce3417b..430dd9c 100644 (file)
@@ -236,7 +236,6 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 246bb2c..758114c 100644 (file)
@@ -234,7 +234,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 4641fd7..bf9721a 100644 (file)
@@ -237,7 +237,6 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 41c3524..86b2164 100644 (file)
@@ -498,7 +498,6 @@ CONFIG_IP_NF_RAW=m
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
@@ -689,7 +688,7 @@ CONFIG_SERIO_SERPORT=y
 # Input Device Drivers
 #
 CONFIG_INPUT_KEYBOARD=y
-# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_SUNKBD is not set
 # CONFIG_KEYBOARD_LKKBD is not set
 # CONFIG_KEYBOARD_XTKBD is not set
@@ -724,8 +723,8 @@ CONFIG_SERIAL_8250_NR_UARTS=4
 #
 # Non-8250 serial port support
 #
-# CONFIG_SERIAL_CORE is not set
-# CONFIG_SERIAL_PMACZILOG is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_PMACZILOG=y
 # CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
index c3b03b6..2531070 100644 (file)
@@ -2,16 +2,6 @@
 # Makefile for the linux kernel.
 #
 
-ifdef CONFIG_PPC64BRIDGE
-EXTRA_AFLAGS           := -Wa,-mppc64bridge
-endif
-ifdef CONFIG_4xx
-EXTRA_AFLAGS           := -Wa,-m405
-endif
-ifdef CONFIG_E500
-EXTRA_AFLAGS           := -Wa,-me500
-endif
-
 extra-$(CONFIG_PPC_STD_MMU)    := head.o
 extra-$(CONFIG_40x)            := head_4xx.o
 extra-$(CONFIG_44x)            := head_44x.o
index 4f560f5..b60fa99 100644 (file)
@@ -55,7 +55,8 @@ extern void __setup_cpu_generic(unsigned long offset, int cpu_nr, struct cpu_spe
 #endif
 
 /* We need to mark all pages as being coherent if we're SMP or we
- * have a 754x and an MPC107 host bridge. */
+ * have a 754x and an MPC107 host bridge.
+ */
 #if defined(CONFIG_SMP) || defined(CONFIG_MPC10X_BRIDGE)
 #define CPU_FTR_COMMON                  CPU_FTR_NEED_COHERENT
 #else
@@ -263,7 +264,7 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_COMMON |
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
-       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450,
+       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -274,7 +275,7 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
        CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
-       CPU_FTR_L3_DISABLE_NAP,
+       CPU_FTR_L3_DISABLE_NAP | CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -284,7 +285,8 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_COMMON |
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
-       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR,
+       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
+       CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -294,7 +296,8 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_COMMON |
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
-       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS,
+       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_HAS_HIGH_BATS |
+       CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -305,7 +308,7 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
        CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
-       CPU_FTR_L3_DISABLE_NAP | CPU_FTR_HAS_HIGH_BATS,
+       CPU_FTR_L3_DISABLE_NAP | CPU_FTR_NEED_COHERENT | CPU_FTR_HAS_HIGH_BATS,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -316,18 +319,40 @@ struct cpu_spec   cpu_specs[] = {
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
        CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
-       CPU_FTR_HAS_HIGH_BATS,
+       CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT,
+       COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
+       32, 32,
+       __setup_cpu_745x
+    },
+    {  /* 7447/7457 Rev 1.0 */
+       0xffffffff, 0x80020100, "7447/7457",
+       CPU_FTR_COMMON |
+       CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
+       CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
+       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
+       CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC,
+       COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
+       32, 32,
+       __setup_cpu_745x
+    },
+    {  /* 7447/7457 Rev 1.1 */
+       0xffffffff, 0x80020101, "7447/7457",
+       CPU_FTR_COMMON |
+       CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
+       CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
+       CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
+       CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT | CPU_FTR_NO_BTIC,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
     },
-    {  /* 7457 */
-       0xffff0000, 0x80020000, "7457",
+    {  /* 7447/7457 Rev 1.2 and later */
+       0xffff0000, 0x80020000, "7447/7457",
        CPU_FTR_COMMON |
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP | CPU_FTR_L3CR |
        CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
-       CPU_FTR_HAS_HIGH_BATS,
+       CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -338,7 +363,7 @@ struct cpu_spec     cpu_specs[] = {
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_CAN_NAP |
        CPU_FTR_L2CR | CPU_FTR_ALTIVEC_COMP |
        CPU_FTR_HPTE_TABLE | CPU_FTR_SPEC7450 | CPU_FTR_NAP_DISABLE_L2_PR |
-       CPU_FTR_HAS_HIGH_BATS,
+       CPU_FTR_HAS_HIGH_BATS | CPU_FTR_NEED_COHERENT,
        COMMON_PPC | PPC_FEATURE_ALTIVEC_COMP,
        32, 32,
        __setup_cpu_745x
@@ -351,8 +376,8 @@ struct cpu_spec     cpu_specs[] = {
        32, 32,
        __setup_cpu_603
     },
-    {  /* 8280 is a G2_LE (603e core, plus some) */
-       0x7fff0000, 0x00820000, "8280",
+    {  /* All G2_LE (603e core, plus some) have the same pvr */
+       0x7fff0000, 0x00820000, "G2_LE",
        CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_CAN_DOZE | CPU_FTR_USE_TB |
        CPU_FTR_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
        COMMON_PPC,
index a7bb502..121978c 100644 (file)
@@ -552,7 +552,7 @@ InstructionTLBMiss:
        rlwimi  r3,r3,32-1,31,31        /* _PAGE_USER -> PP lsb */
        ori     r1,r1,0xe14             /* clear out reserved bits and M */
        andc    r1,r3,r1                /* PP = user? (rw&dirty? 2: 3): 0 */
-       mtspr   RPA,r1
+       mtspr   SPRN_RPA,r1
        mfspr   r3,IMISS
        tlbli   r3
        mfspr   r3,SRR1         /* Need to restore CR0 */
@@ -626,7 +626,7 @@ DataLoadTLBMiss:
        rlwimi  r3,r3,32-1,31,31        /* _PAGE_USER -> PP lsb */
        ori     r1,r1,0xe14             /* clear out reserved bits and M */
        andc    r1,r3,r1                /* PP = user? (rw&dirty? 2: 3): 0 */
-       mtspr   RPA,r1
+       mtspr   SPRN_RPA,r1
        mfspr   r3,DMISS
        tlbld   r3
        mfspr   r3,SRR1         /* Need to restore CR0 */
@@ -694,7 +694,7 @@ DataStoreTLBMiss:
        rlwimi  r3,r3,32-1,30,30        /* _PAGE_USER -> PP msb */
        li      r1,0xe15                /* clear out reserved bits and M */
        andc    r1,r3,r1                /* PP = user? 2: 0 */
-       mtspr   RPA,r1
+       mtspr   SPRN_RPA,r1
        mfspr   r3,DMISS
        tlbld   r3
        mfspr   r3,SRR1         /* Need to restore CR0 */
index 6c7a984..f883dc2 100644 (file)
@@ -209,14 +209,6 @@ skpinv:    addi    r4,r4,1                         /* Increment */
        tlbwe   r4,r0,PPC44x_TLB_XLAT   /* Load the translation fields */
        tlbwe   r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
 
-       ori     r3,r3,PPC44x_TLB_TS     /* Translation state 1 */
-
-        li      r0,1                   /* TLB slot 1 */
-
-       tlbwe   r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */
-       tlbwe   r4,r0,PPC44x_TLB_XLAT   /* Load the translation fields */
-       tlbwe   r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
-
        /* Force context change */
        isync
 #endif /* CONFIG_SERIAL_TEXT_DEBUG */
index 6da0929..2ac2e4b 100644 (file)
@@ -106,7 +106,7 @@ void *irq_kmalloc(size_t size, int pri)
                        cache_bitmask |= (1<<i);
                        return (void *)(&malloc_cache[i]);
                }
-       return 0;
+       return NULL;
 }
 
 void irq_kfree(void *ptr)
@@ -171,7 +171,12 @@ setup_irq(unsigned int irq, struct irqaction * new)
        if (!shared) {
                desc->depth = 0;
                desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING);
-               unmask_irq(irq);
+               if (desc->handler) {
+                       if (desc->handler->startup)
+                               desc->handler->startup(irq);
+                       else if (desc->handler->enable)
+                               desc->handler->enable(irq);
+               }
        }
        spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -676,7 +681,7 @@ void init_irq_proc (void)
        int i;
 
        /* create /proc/irq */
-       root_irq_dir = proc_mkdir("irq", 0);
+       root_irq_dir = proc_mkdir("irq", NULL);
 
        /* create /proc/irq/prof_cpu_mask */
        entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
diff --git a/arch/ppc/kernel/pci-dma.c b/arch/ppc/kernel/pci-dma.c
deleted file mode 100644 (file)
index 63354f6..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2000   Ani Joshi <ajoshi@unixbox.com>
- *
- *
- * Dynamic DMA mapping support.
- *
- * swiped from i386
- *
- */
-
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/pci.h>
-#include <asm/io.h>
-
-void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
-                          dma_addr_t *dma_handle)
-{
-       void *ret;
-       int gfp = GFP_ATOMIC;
-
-       if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
-               gfp |= GFP_DMA;
-
-#ifdef CONFIG_NOT_COHERENT_CACHE
-       ret = consistent_alloc(gfp, size, dma_handle);
-#else
-       ret = (void *)__get_free_pages(gfp, get_order(size));
-#endif
-
-       if (ret != NULL) {
-               memset(ret, 0, size);
-#ifndef CONFIG_NOT_COHERENT_CACHE
-               *dma_handle = virt_to_bus(ret);
-#endif
-       }
-       return ret;
-}
-
-void pci_free_consistent(struct pci_dev *hwdev, size_t size,
-                        void *vaddr, dma_addr_t dma_handle)
-{
-#ifdef CONFIG_NOT_COHERENT_CACHE
-       consistent_free(vaddr);
-#else
-       free_pages((unsigned long)vaddr, get_order(size));
-#endif
-}
index c357475..a869750 100644 (file)
@@ -234,7 +234,7 @@ mem2hex(const char *mem, char *buf, int count)
        } else {
                /* error condition */
        }
-       debugger_fault_handler = 0;
+       debugger_fault_handler = NULL;
        *buf = 0;
        return buf;
 }
@@ -300,7 +300,7 @@ hex2mem(char *buf, char *mem, int count)
        } else {
                /* error condition */
        }
-       debugger_fault_handler = 0;
+       debugger_fault_handler = NULL;
        return mem;
 }
 
@@ -331,7 +331,7 @@ hexToInt(char **ptr, int *intValue)
        } else {
                /* error condition */
        }
-       debugger_fault_handler = 0;
+       debugger_fault_handler = NULL;
 
        return (numChars);
 }
index f6d8cd3..2ea5053 100644 (file)
@@ -479,9 +479,9 @@ void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
        regs->gpr[1] = sp;
        regs->msr = MSR_USER;
        if (last_task_used_math == current)
-               last_task_used_math = 0;
+               last_task_used_math = NULL;
        if (last_task_used_altivec == current)
-               last_task_used_altivec = 0;
+               last_task_used_altivec = NULL;
        memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
        current->thread.fpscr = 0;
 #ifdef CONFIG_ALTIVEC
@@ -544,7 +544,7 @@ int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
 #endif
        else
                val = __unpack_fe01(tsk->thread.fpexc_mode);
-       return put_user(val, (unsigned int *) adr);
+       return put_user(val, (unsigned int __user *) adr);
 }
 
 int sys_clone(unsigned long clone_flags, unsigned long usp,
index b3df454..c243674 100644 (file)
@@ -77,7 +77,7 @@ static inline int put_reg(struct task_struct *task, int regno,
 /*
  * Get contents of AltiVec register state in task TASK
  */
-static inline int get_vrregs(unsigned long *data, struct task_struct *task)
+static inline int get_vrregs(unsigned long __user *data, struct task_struct *task)
 {
        int i, j;
 
@@ -105,7 +105,7 @@ static inline int get_vrregs(unsigned long *data, struct task_struct *task)
 /*
  * Write contents of AltiVec register state into task TASK.
  */
-static inline int set_vrregs(struct task_struct *task, unsigned long *data)
+static inline int set_vrregs(struct task_struct *task, unsigned long __user *data)
 {
        int i, j;
 
@@ -288,7 +288,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                ret = -EIO;
                if (copied != sizeof(tmp))
                        break;
-               ret = put_user(tmp,(unsigned long *) data);
+               ret = put_user(tmp,(unsigned long __user *) data);
                break;
        }
 
@@ -314,7 +314,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                        preempt_enable();
                        tmp = ((unsigned long *)child->thread.fpr)[index - PT_FPR0];
                }
-               ret = put_user(tmp,(unsigned long *) data);
+               ret = put_user(tmp,(unsigned long __user *) data);
                break;
        }
 
@@ -412,7 +412,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                if (child->thread.regs->msr & MSR_VEC)
                        giveup_altivec(child);
                preempt_enable();
-               ret = get_vrregs((unsigned long *)data, child);
+               ret = get_vrregs((unsigned long __user *)data, child);
                break;
 
        case PTRACE_SETVRREGS:
@@ -423,7 +423,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                if (child->thread.regs->msr & MSR_VEC)
                        giveup_altivec(child);
                preempt_enable();
-               ret = set_vrregs(child, (unsigned long *)data);
+               ret = set_vrregs(child, (unsigned long __user *)data);
                break;
 #endif
 #ifdef CONFIG_SPE
@@ -431,7 +431,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                /* Get the child spe register state. */
                if (child->thread.regs->msr & MSR_SPE)
                        giveup_spe(child);
-               ret = get_evrregs((unsigned long *)data, child);
+               ret = get_evrregs((unsigned long __user *)data, child);
                break;
 
        case PTRACE_SETEVRREGS:
@@ -440,7 +440,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                 * of register state from memory */
                if (child->thread.regs->msr & MSR_SPE)
                        giveup_spe(child);
-               ret = set_evrregs(child, (unsigned long *)data);
+               ret = set_evrregs(child, (unsigned long __user *)data);
                break;
 #endif
 
index e2f7503..376f736 100644 (file)
@@ -622,7 +622,7 @@ int __init ppc_setup_l2cr(char *str)
 }
 __setup("l2cr=", ppc_setup_l2cr);
 
-#ifdef CONFIG_NVRAM
+#ifdef CONFIG_GENERIC_NVRAM
 
 /* Generic nvram hooks used by drivers/char/gen_nvram.c */
 unsigned char nvram_read_byte(int addr)
@@ -693,7 +693,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_XMON
        xmon_map_scc();
        if (strstr(cmd_line, "xmon"))
-               xmon(0);
+               xmon(NULL);
 #endif /* CONFIG_XMON */
        if ( ppc_md.progress ) ppc_md.progress("setup_arch: enter", 0x3eab);
 
index 82f6cf8..20b6446 100644 (file)
@@ -187,7 +187,7 @@ struct rt_sigframe
  * altivec/spe instructions at some point.
  */
 static int
-save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret)
+save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, int sigret)
 {
        /* save general and floating-point registers */
        CHECK_FULL_REGS(regs);
@@ -229,7 +229,7 @@ save_user_regs(struct pt_regs *regs, struct mcontext *frame, int sigret)
         * significant bits of a vector, we "cheat" and stuff VRSAVE in the
         * most significant bits of that same vector. --BenH
         */
-       if (__put_user(current->thread.vrsave, (u32 *)&frame->mc_vregs[32]))
+       if (__put_user(current->thread.vrsave, (u32 __user *)&frame->mc_vregs[32]))
                return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -308,7 +308,7 @@ restore_user_regs(struct pt_regs *regs, struct mcontext __user *sr, int sig)
                memset(&current->thread.vr, 0, ELF_NVRREG * sizeof(vector128));
 
        /* Always get VRSAVE back */
-       if (__get_user(current->thread.vrsave, (u32 *)&sr->mc_vregs[32]))
+       if (__get_user(current->thread.vrsave, (u32 __user *)&sr->mc_vregs[32]))
                return 1;
 #endif /* CONFIG_ALTIVEC */
 
@@ -412,7 +412,7 @@ badframe:
 static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int sig)
 {
        sigset_t set;
-       struct mcontext *mcp;
+       struct mcontext __user *mcp;
 
        if (__copy_from_user(&set, &ucp->uc_sigmask, sizeof(set))
            || __get_user(mcp, &ucp->uc_regs))
@@ -447,8 +447,8 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
        if (new_ctx == NULL)
                return 0;
        if (verify_area(VERIFY_READ, new_ctx, sizeof(*new_ctx))
-           || __get_user(tmp, (u8 *) new_ctx)
-           || __get_user(tmp, (u8 *) (new_ctx + 1) - 1))
+           || __get_user(tmp, (u8 __user *) new_ctx)
+           || __get_user(tmp, (u8 __user *) (new_ctx + 1) - 1))
                return -EFAULT;
 
        /*
@@ -524,7 +524,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
        /* create a stack frame for the caller of the handler */
        newsp -= __SIGNAL_FRAMESIZE;
 
-       if (verify_area(VERIFY_WRITE, (void *) newsp, origsp - newsp))
+       if (verify_area(VERIFY_WRITE, (void __user *) newsp, origsp - newsp))
                goto badframe;
 
 #if _NSIG != 64
@@ -583,7 +583,7 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
        set.sig[1] = sigctx._unused[3];
        restore_sigmask(&set);
 
-       sr = (struct mcontext *) sigctx.regs;
+       sr = (struct mcontext __user *) sigctx.regs;
        if (verify_area(VERIFY_READ, sr, sizeof(*sr))
            || restore_user_regs(regs, sr, 1))
                goto badframe;
index cbc9596..7e1dad4 100644 (file)
@@ -68,7 +68,7 @@ sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fif
                break;
        case SEMTIMEDOP:
                ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
-                                     second, (const struct timespec *) fifth);
+                                     second, (const struct timespec __user *) fifth);
                break;
        case SEMGET:
                ret = sys_semget (first, second, third);
@@ -79,7 +79,7 @@ sys_ipc (uint call, int first, int second, int third, void __user *ptr, long fif
                if (!ptr)
                        break;
                if ((ret = verify_area (VERIFY_READ, ptr, sizeof(long)))
-                   || (ret = get_user(fourth.__pad, (void *__user *)ptr)))
+                   || (ret = get_user(fourth.__pad, (void __user *__user *)ptr)))
                        break;
                ret = sys_semctl (first, second, third, fourth);
                break;
@@ -209,17 +209,17 @@ out:
  * sys_select() with the appropriate args. -- Cort
  */
 int
-ppc_select(int n, fd_set *inp, fd_set *outp, fd_set *exp, struct timeval *tvp)
+ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
 {
        if ( (unsigned long)n >= 4096 )
        {
                unsigned long __user *buffer = (unsigned long __user *)n;
                if (verify_area(VERIFY_READ, buffer, 5*sizeof(unsigned long))
                    || __get_user(n, buffer)
-                   || __get_user(inp, ((fd_set **)(buffer+1)))
-                   || __get_user(outp, ((fd_set **)(buffer+2)))
-                   || __get_user(exp, ((fd_set **)(buffer+3)))
-                   || __get_user(tvp, ((struct timeval **)(buffer+4))))
+                   || __get_user(inp, ((fd_set __user * __user *)(buffer+1)))
+                   || __get_user(outp, ((fd_set  __user * __user *)(buffer+2)))
+                   || __get_user(exp, ((fd_set  __user * __user *)(buffer+3)))
+                   || __get_user(tvp, ((struct timeval  __user * __user *)(buffer+4))))
                        return -EFAULT;
        }
        return sys_select(n, inp, outp, exp, tvp);
index d72c350..544ea9f 100644 (file)
@@ -114,7 +114,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
        info.si_signo = signr;
        info.si_errno = 0;
        info.si_code = code;
-       info.si_addr = (void *) addr;
+       info.si_addr = (void __user *) addr;
        force_sig_info(signr, &info, current);
 }
 
index 458e671..cd3eae1 100644 (file)
@@ -2,10 +2,6 @@
 # Makefile for the linux ppc-specific parts of the memory manager.
 #
 
-ifdef CONFIG_PPC64BRIDGE
-EXTRA_AFLAGS           := -Wa,-mppc64bridge
-endif
-
 obj-y                          := fault.o init.o mem_pieces.o \
                                        mmu_context.o pgtable.o
 
index 2a4029c..57d9930 100644 (file)
@@ -59,7 +59,7 @@ static int store_updates_sp(struct pt_regs *regs)
 {
        unsigned int inst;
 
-       if (get_user(inst, (unsigned int *)regs->nip))
+       if (get_user(inst, (unsigned int __user *)regs->nip))
                return 0;
        /* check for 1 in the rA field */
        if (((inst >> 16) & 0x1f) != 1)
@@ -281,7 +281,7 @@ bad_area:
                info.si_signo = SIGSEGV;
                info.si_errno = 0;
                info.si_code = code;
-               info.si_addr = (void *) address;
+               info.si_addr = (void __user *) address;
                force_sig_info(SIGSEGV, &info, current);
                return 0;
        }
@@ -309,7 +309,7 @@ do_sigbus:
        info.si_signo = SIGBUS;
        info.si_errno = 0;
        info.si_code = BUS_ADRERR;
-       info.si_addr = (void *)address;
+       info.si_addr = (void __user *)address;
        force_sig_info (SIGBUS, &info, current);
        if (!user_mode(regs))
                return SIGBUS;
index b439b15..578b0ac 100644 (file)
@@ -175,6 +175,15 @@ config IBM_OPENBIOS
        depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT
        default y
 
+config PPC4xx_DMA
+       bool "PPC4xx DMA controller support"
+       depends on 4xx
+
+config PPC4xx_EDMA
+       bool
+       depends on !STB03xxx && PPC4xx_DMA
+       default y
+
 config PM
        bool "Power Management support (EXPERIMENTAL)"
        depends on 4xx && EXPERIMENTAL
index 749fff9..c4352e6 100755 (executable)
@@ -64,7 +64,8 @@
 #define UART0_IO_BASE  (u8 *) 0xE0000200
 #define UART1_IO_BASE  (u8 *) 0xE0000300
 
-#define BASE_BAUD      33000000/3/16
+/* external Epson SG-615P */
+#define BASE_BAUD      691200
 
 #define STD_UART_OP(num)                                       \
        { 0, BASE_BAUD, 0, UART##num##_INT,                     \
index 3a1c3c0..c59d487 100644 (file)
@@ -2,13 +2,6 @@
 # Makefile for the linux kernel.
 #
 
-ifdef CONFIG_PPC64BRIDGE
-EXTRA_AFLAGS           := -Wa,-mppc64bridge
-endif
-ifdef CONFIG_40x
-EXTRA_AFLAGS           := -Wa,-m405
-endif
-
 # Extra CFLAGS so we don't have to do relative includes
 CFLAGS_pmac_setup.o    += -Iarch/$(ARCH)/mm
 
@@ -26,14 +19,12 @@ obj-$(CONFIG_NVRAM)         += pmac_nvram.o
 obj-$(CONFIG_CPU_FREQ_PMAC)    += pmac_cpufreq.o
 endif
 obj-$(CONFIG_PMAC_BACKLIGHT)   += pmac_backlight.o
-obj-$(CONFIG_PPC_RTAS)         += error_log.o proc_rtas.o
 obj-$(CONFIG_PREP_RESIDUAL)    += residual.o
 obj-$(CONFIG_ADIR)             += adir_setup.o adir_pic.o adir_pci.o
 obj-$(CONFIG_EST8260)          += est8260_setup.o
 obj-$(CONFIG_PQ2ADS)           += pq2ads_setup.o
 obj-$(CONFIG_TQM8260)          += tqm8260_setup.o
-obj-$(CONFIG_EV64260)          += ev64260.o
-obj-$(CONFIG_DMV182)           += dmv182.o
+obj-$(CONFIG_EV64260)          += ev64260_setup.o
 obj-$(CONFIG_GEMINI)           += gemini_pci.o gemini_setup.o gemini_prom.o
 obj-$(CONFIG_K2)               += k2.o
 obj-$(CONFIG_LOPEC)            += lopec_setup.o lopec_pci.o
@@ -46,9 +37,11 @@ obj-$(CONFIG_POWERPMC250)    += powerpmc250.o
 obj-$(CONFIG_PPLUS)            += pplus.o
 obj-$(CONFIG_PRPMC750)         += prpmc750.o
 obj-$(CONFIG_PRPMC800)         += prpmc800.o
+obj-$(CONFIG_RPX8260)          += rpx8260.o
 obj-$(CONFIG_SANDPOINT)                += sandpoint.o
 obj-$(CONFIG_SBC82xx)          += sbc82xx.o
 obj-$(CONFIG_SPRUCE)           += spruce.o
+obj-$(CONFIG_LITE5200)         += lite5200.o mpc5200.o
 
 ifeq ($(CONFIG_SMP),y)
 obj-$(CONFIG_PPC_PMAC)         += pmac_smp.o
diff --git a/arch/ppc/platforms/dmv182.c b/arch/ppc/platforms/dmv182.c
deleted file mode 100644 (file)
index dd57e16..0000000
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * arch/ppc/platforms/dmv182p.c
- * Setup code for the Dy-4 SVME/DMV-182
- *
- * Copyright (C) 2004 TimeSys Corporation
- * Copyright (C) 2004 Red Hat, Inc.
- *
- * Original 2.4 port by Scott Wood <scott.wood@timesys.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/config.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-#include <linux/initrd.h>
-#include <linux/root_dev.h>
-#include <linux/delay.h>
-
-#include <asm/serial.h>
-#include <asm/bootinfo.h>
-#include <asm/machdep.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/mv64x60.h>
-#include <asm/processor.h>
-#include <asm/time.h>
-#include <asm/atomic.h>
-#include <asm/bitops.h>
-#include <asm/todc.h>
-#include <linux/tty.h>  /* for linux/serial_core.h */
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-
-#include "dmv182.h"
-
-extern int mv64360_get_irq(struct pt_regs *regs);
-extern void mv64360_init_irq(void);
-
-extern void gen550_progress(char *s, unsigned short hex);
-extern void gen550_init(int, struct uart_port *);
-
-static void __init dmv182_setup_peripherals(void);
-static void __init dmv182_setup_bridge(void);
-
-static struct mv64x60_handle bh;
-
-TODC_ALLOC();
-
-static void __init dmv182_map_io(void)
-{
-       io_block_mapping((unsigned long)dmv182_board_io_virt,
-                        dmv182_board_io_phys, 0x10000000, _PAGE_IO);
-}
-
-// This sets up BAT3 to cover the serial port and Discovery chip.
-
-static void __init dmv182_setup_bats(void)
-{
-       int tmp1, tmp2;
-
-       asm volatile("lis %0, 0xe000;"
-                    "ori %0, %0, 0x002a;"
-                    "lis %1, 0xf000;"
-                    "ori %1, %1, 0x1ffe;"
-                    "mtspr %2, %0;"
-                    "mtspr %3, %1"
-                  : "=r" (tmp1), "=r" (tmp2)
-                  : "i" (DBAT3L), "i" (DBAT3U)
-                  : "memory");
-}
-
-static u8 *const irqstat = dmv182_fpga_io + 0x80;
-static u8 *const irqmask = dmv182_fpga_io + 0x81;
-
-// These two functions transform an IRQ number into
-// byte and bit indices into the above arrays.
-
-static inline int irqreg(unsigned int irq)
-{
-       return ((irq - 96) >> 3) * 3;
-}
-
-static inline int irqbit(unsigned int irq)
-{
-       return (irq - 96) & 7;
-}
-
-// FIXME: CPU1 and affinity support
-// The Marvell code doesn't appear to support anything
-// other than doorbells on CPU1 at the moment.
-
-static void dmv182_mask_irq(unsigned int irq)
-{
-       irqmask[irqreg(irq)] &= ~(1 << irqbit(irq));
-}
-
-static void dmv182_unmask_irq(unsigned int irq)
-{
-       irqmask[irqreg(irq)] |= 1 << irqbit(irq);
-}
-
-static unsigned int dmv182_startup_irq(unsigned int irq)
-{
-       dmv182_unmask_irq(irq);
-       return 0;
-}
-
-struct hw_interrupt_type dmv182_pic = {
-       .typename     = " DMV182_PIC ",
-       .startup      = dmv182_startup_irq,
-       .shutdown     = dmv182_mask_irq,
-       .enable       = dmv182_unmask_irq,
-       .disable      = dmv182_mask_irq,
-       .ack          = dmv182_mask_irq,
-       .end          = dmv182_unmask_irq,
-       .set_affinity = NULL
-};
-
-atomic_t spurious_interrupts;
-
-static irqreturn_t dmv182_cascade(int irq, void *dev_id, struct pt_regs *regs)
-{
-       int i, j;
-       int cpu = smp_processor_id();
-       int irqs;
-
-       for (i = 0, j = 96; i < 24; i += 3, j += 8) {
-               irqs = irqstat[i] & irqmask[i + cpu];
-               
-               if (irqs)
-                       break;
-       }
-       
-       if (i < 24) {
-               ppc_irq_dispatch_handler(regs, j + ffs(irqs) - 1);
-               return IRQ_HANDLED;
-       }
-
-       atomic_inc(&spurious_interrupts);
-       return IRQ_NONE;
-}
-
-#ifdef CONFIG_SMP
-static irqreturn_t dmv182_doorbell(int irq, void *dev_id, struct pt_regs *regs);
-#endif
-
-static void __init dmv182_init_irq(void)
-{
-       int i;
-
-       if (ppc_md.progress)
-               ppc_md.progress("dmv182_init_irq", 0x1821);
-       
-       for (i = 96; i < 160; i++) {
-               dmv182_mask_irq(i);
-               irqmask[irqreg(i) + 1] &= ~(1 << irqbit(i));
-               irq_desc[i].handler = &dmv182_pic;
-               irq_desc[i].status = IRQ_LEVEL | IRQ_DISABLED;
-       }
-       
-       mv64360_init_irq();
-       
-       if (request_irq(94, dmv182_cascade, SA_INTERRUPT,
-                       "DMV182 CPU0 cascade", NULL) < 0)
-       {
-               panic("Could not request CPU0 cascade IRQ\n");
-       }
-
-#ifdef CONFIG_SMP
-#if 0
-       if (request_irq(95, dmv182_cascade, SA_INTERRUPT,
-                       "DMV182 CPU1 cascade", NULL) < 0)
-       {
-               panic("Could not request CPU1 cascade IRQ\n");
-       }
-#endif
-
-       if (request_irq(60, dmv182_doorbell, SA_INTERRUPT,
-                       "CPU0 doorbell", NULL) < 0)
-       {
-               panic("Could not request CPU1 doorbell IRQ\n");
-       }
-
-       if (request_irq(28, dmv182_doorbell, SA_INTERRUPT,
-                       "CPU1 doorbell", NULL) < 0)
-       {
-               panic("Could not request CPU1 doorbell IRQ\n");
-       }
-       
-       // Clear and unmask all doorbell interrupts.
-       
-       mv64x60_write(&bh, MV64360_CPU0_DOORBELL_CLR, 0xff);
-       mv64x60_write(&bh, MV64360_CPU1_DOORBELL_CLR, 0xff);
-       mv64x60_write(&bh, MV64360_CPU0_DOORBELL_MASK, 0xff);
-       mv64x60_write(&bh, MV64360_CPU1_DOORBELL_MASK, 0xff);
-#endif
-}
-
-// It's really device numbers, not idsels, but we have
-// to call it that so the PCI_IRQ_TABLE_LOOKUP will work.
-
-static int __init dmv182_map_irq(struct pci_dev *dev,
-                                  unsigned char idsel,
-                                  unsigned char pin)
-{
-       struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
-
-#if 0
-       printk("map irq: hose %d, bus %d, slot %d, first %d\n", hose->index,
-              dev->bus->number, idsel, hose->first_busno);
-#endif
-
-       if (hose->index != 0 && hose->index != 1) {
-               printk(KERN_ERR "map_irq: unknown hose %d\n", hose->index);
-               return 0;
-       }
-       
-       // Some of this is guesswork...
-       // In particular, I don't know if the ABCD mappings are right,
-       // and I don't know which IPM goes with which slot (the manual
-       // merely says "IPM" for both).
-
-       if (hose->index == 0) {
-               static u8 pci_irq_table[][4] = 
-               /*
-                * PCI IDSEL/INTPIN->INTLINE
-                *  A   B   C   D
-                */
-               {
-                       { DMV182_IRQ_PMC1A, DMV182_IRQ_PMC1B,
-                         DMV182_IRQ_PMC1C, DMV182_IRQ_PMC1D }, // PMC Slot 1 A
-                       { DMV182_IRQ_PMC1A, DMV182_IRQ_PMC1B,
-                         DMV182_IRQ_PMC1C, DMV182_IRQ_PMC1D }, // PMC Slot 1 B
-               };
-               
-               const int min_idsel = 4, max_idsel = 5, irqs_per_slot = 4;
-               return PCI_IRQ_TABLE_LOOKUP;
-       } else if (dev->bus->parent && dev->bus->primary == hose->first_busno &&
-                  dev->bus->self->devfn == 0x10) {
-               static u8 pci_irq_table[][4] = 
-               /*
-                * PCI IDSEL/INTPIN->INTLINE
-                *  A   B   C   D
-                */
-               {
-                       { DMV182_IRQ_IPM0, DMV182_IRQ_IPM0,
-                         DMV182_IRQ_IPM0, DMV182_IRQ_IPM0 }, // IPM... 0?
-                       { DMV182_IRQ_IPM1, DMV182_IRQ_IPM1,
-                         DMV182_IRQ_IPM1, DMV182_IRQ_IPM1 }, // IPM... 1?
-                       { DMV182_IRQ_USB_A, DMV182_IRQ_USB_B,
-                         DMV182_IRQ_USB_C, DMV182_IRQ_USB_SMI }, // USB
-                       { DMV182_IRQ_VME_CPU0, DMV182_IRQ_VME_CPU1, 0, 0 }, // VME
-               };
-               
-               const int min_idsel = 1, max_idsel = 4, irqs_per_slot = 4;
-               return PCI_IRQ_TABLE_LOOKUP;
-       } else {
-               static u8 pci_irq_table[][4] = 
-               /*
-                * PCI IDSEL/INTPIN->INTLINE
-                *  A   B   C   D
-                */
-               {
-                       { DMV182_IRQ_PMC2A, DMV182_IRQ_PMC2B,
-                         DMV182_IRQ_PMC2C, DMV182_IRQ_PMC2D }, // PMC Slot 2 A
-                       { DMV182_IRQ_PMC2A, DMV182_IRQ_PMC2B,
-                         DMV182_IRQ_PMC2C, DMV182_IRQ_PMC2D }, // PMC Slot 2 B
-               };
-               
-               const int min_idsel = 4, max_idsel = 5, irqs_per_slot = 4;
-               return PCI_IRQ_TABLE_LOOKUP;
-       }
-}
-
-static unsigned char dmv182_pci_swizzle(struct pci_dev *dev,
-                                         unsigned char *pinp)
-{
-       struct pci_controller *hose = dev->sysdata;
-
-       // The devices under this particular bridge have their IRQs
-       // directly routed to the PIC, rather than through the parent
-       // bus.  Thus, don't swizzle them.  The bus is determined by
-       // the devfn of the parent, rather than its own bus number,
-       // in case a PMC card is added that has its own bridge(s),
-       // causing the numbering to change.
-       
-       if (hose->index == 1 && dev->bus->parent &&
-           dev->bus->primary == hose->first_busno &&
-           dev->bus->self->devfn == 0x10)
-               return PCI_SLOT(dev->devfn);
-       
-       return common_swizzle(dev, pinp);
-}
-
-static unsigned long __init
-dmv182_pci_bridge_reserve_space(struct pci_controller *hose,
-                                 unsigned char bus, unsigned char devfn)
-{
-       // Reserve 768 MiB for the bus containing VME.  This
-       // will allow one to map the entire RAM of a 512 MiB
-       // card over VME, while still allowing space for other
-       // stuff on the bridge.
-       if (hose->first_busno == bus && devfn == 0x10)
-               return 0x30000000;
-       
-       return 0;
-}
-
-static void __init dmv182_setup_caches(void)
-{
-#if 0 // This actually causes the TimeSys 2.4 port to blow up too, for me 
-
-       // Why can't L2CR be set by generic 745x code?
-       // And what's with the underscore?
-       _set_L2CR(0xc0000000);
-
-       _set_L3CR(0x9e8a0180);
-#endif
-}
-
-#ifdef CONFIG_SERIAL_8250
-static void __init dmv182_early_serial_map(void)
-{
-        struct uart_port uart_req;
-       void *membase = ioremap(0xe0010000, PAGE_SIZE);
-
-        /* Setup serial port access */
-        memset(&uart_req, 0, sizeof (uart_req));
-        uart_req.irq = DMV182_IRQ_SERIAL_CH1;
-        uart_req.flags = 0;
-       uart_req.type = PORT_16550;
-        uart_req.uartclk = BASE_BAUD * 16;
-        uart_req.iotype = SERIAL_IO_MEM;
-        uart_req.mapbase = (unsigned long)dmv182_fpga_io + 0x18;
-        uart_req.membase = membase + 0x18;
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-        gen550_init(0, &uart_req);
-#endif
-
-        if (early_serial_setup(&uart_req) != 0)
-                printk("Early serial init of port 0 failed\n");
-
-        /* Assume early_serial_setup() doesn't modify uart_req */
-        uart_req.line = 1;
-        uart_req.mapbase = (unsigned long)dmv182_fpga_io + 0x20;
-        uart_req.membase = membase + 0x20;
-        uart_req.irq = DMV182_IRQ_SERIAL_CH2;
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-        gen550_init(1, &uart_req);
-#endif
-
-        if (early_serial_setup(&uart_req) != 0)
-                printk("Early serial init of port 1 failed\n");
-}
-#endif
-
-static void __init dmv182_setup_arch(void)
-{
-       if (ppc_md.progress)
-               ppc_md.progress("dmv182_setup_arch", 0x1820);
-
-       ppc_md.pci_swizzle = dmv182_pci_swizzle;
-
-       dmv182_setup_caches();
-
-       // Enable snooping.
-//     MV_SET_REG_BITS(MV64360_CPU_MASTER_CONTROL, (1 << 12) | (1 << 13));
-
-       // Set up the RTC.
-       dmv182_setup_bridge();
-       dmv182_setup_peripherals();
-
-#ifdef CONFIG_SERIAL_8250
-       dmv182_early_serial_map();
-#endif
-       if (ppc_md.progress)
-               ppc_md.progress("dmv182_setup_arch end", 0x182f);
-}
-
-static void __init dmv182_calibrate_decr(void)
-{
-       if (ppc_md.progress)
-               ppc_md.progress("dmv182_calibrate_decr", 0x1822);
-       
-       tb_ticks_per_jiffy = 25000000 / HZ;
-       tb_to_us = mulhwu_scale_factor(25000000, 1000000);
-}
-
-static void dmv182_halt(void)
-{
-       local_irq_disable();
-       for(;;);
-}
-
-static void dmv182_restart(char *cmd)
-{
-       unsigned long reg;
-       volatile unsigned long *ptr = NULL;
-       struct pci_dev *dev;
-
-       local_irq_disable();
-
-       /* 
-        * The best way to reset the board is through the Universe VME. 
-        * Since the VME driver may or may not be loaded, we can't rely
-        * on that, so the best way I can think of in resetting the board
-        * is to search all the PCI devices looking for the Universe chip 
-        * and write to its command register to reset the board.
-        */
-       dev = pci_find_device(PCI_VENDOR_ID_TUNDRA, 0, NULL);
-       if (dev) {
-               printk("Found VME device %s\n",dev->slot_name);
-
-               for (reg = 0; reg < 6; reg++) {
-                       struct resource *res = dev->resource + reg;
-                       if ((res->flags & PCI_BASE_ADDRESS_SPACE) ==
-                           PCI_BASE_ADDRESS_SPACE_MEMORY) {
-                               ptr = ioremap(res->start + 0x404, sizeof(ptr)); /* CTRL_REG */
-                               break;
-                       }
-               }
-       }
-
-       if (!ptr) {
-               printk("No VME device found to reset board\n");
-               return;
-       }
-
-       printk("**** resetting board through VME ****\n");
-       mdelay(10);
-
-       reg = *ptr;
-       reg |= 0x8000; /* reset only the board and not the entire chassis. */
-       *ptr = reg;
-
-       for(;;);
-}
-
-void board_get_mac(int port, u8 *addr)
-{
-       if (port < 1 || port > 2) {
-               printk(KERN_ERR "Unknown port %d in board_get_mac()...\n", port);
-               return;
-       }
-       
-       memcpy(addr, (u8 *)dmv182_nvram + 8 + (2 - port) * 6, 6);
-       printk(KERN_NOTICE "Ethernet port %d MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
-              port, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
-}
-
-#ifdef CONFIG_SMP
-
-static int dmv182_smp_probe(void)
-{
-       return 2;
-}
-
-void __secondary_start(void);
-
-static void dmv182_kick_cpu(int cpu)
-{
-       BUG_ON(cpu != 1);
-
-       *(u32 *)(PAGE_OFFSET + 4) = (u32)__secondary_start - PAGE_OFFSET;
-       wmb();
-       *(u32 *)(PAGE_OFFSET + 0) = 0x38a3fd19;
-       wmb();
-
-       /* Set MaskBR1 to allow CPU1 to get access to the bus. */
-       mv64x60_modify(&bh, MV64x60_CPU_MASTER_CNTL, 0, 1<<9);
-}
-
-static void dmv182_setup_cpu(int cpu)
-{
-       int whoami = mv64x60_read(&bh, MV64360_WHO_AM_I);
-       
-       if (cpu != whoami) {
-               printk("CPU %d whoami %d\n", cpu, whoami);
-               BUG();
-       }
-
-       // Enable broadcasting of synchronization and cache/tlb
-       // flushing/invalidation instructions
-       
-       mtspr(SPRN_HID1, mfspr(SPRN_HID1) | HID1_ABE | HID1_SYNCBE);
-       asm volatile("sync; isync" : : : "memory");
-
-       if (cpu == 1)
-               dmv182_setup_caches();
-}
-
-static void dmv182_message_pass(int target, int msg, ulong data, int wait)
-{
-       int i;
-       int reg;
-       
-       if (unlikely(msg < 0 || msg > 7)) {
-               printk(KERN_ERR "dmv182_message_pass: bad message %x\n", msg);
-               return;
-       }
-       
-       for_each_online_cpu(i) {
-               reg = MV64360_CPUx_DOORBELL(i);
-
-               if (target == MSG_ALL ||
-                   (target == MSG_ALL_BUT_SELF && i != smp_processor_id()) ||
-                   target == i)
-                       mv64x60_modify(&bh, reg, 1 << msg, 1 << msg);
-       }
-}
-
-static irqreturn_t dmv182_doorbell(int irq, void *dev_id, struct pt_regs *regs)
-{
-       u32 bits = mv64x60_read(&bh, MV64360_CPUx_DOORBELL(smp_processor_id()));
-
-       bits &= 0xff;
-
-       mv64x60_write(&bh, MV64360_CPU0_DOORBELL_CLR +
-                     smp_processor_id() * 0x10, bits);
-
-       while (bits) {
-               int msg = __ilog2(bits);;
-               smp_message_recv(msg, regs);
-               bits &= ~(1 << msg);
-       }
-       return IRQ_HANDLED;
-}
-
-static struct smp_ops_t dmv182_smp_ops = {
-       .probe        = dmv182_smp_probe,
-       .kick_cpu     = dmv182_kick_cpu,
-       .setup_cpu    = dmv182_setup_cpu,
-       .message_pass = dmv182_message_pass,
-       .give_timebase = smp_generic_give_timebase,
-       .take_timebase = smp_generic_take_timebase,
-};
-
-#endif
-
-static void __init dmv182_setup_bridge(void)
-{
-       mv64x60_setup_info_t si;
-
-       memset(&si, 0, sizeof(si));
-
-       si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
-       si.map_irq = dmv182_map_irq;
-
-       si.pci_0.enable_bus = 1;
-       si.pci_0.enumerate_bus = 1;
-       si.pci_0.pci_io.cpu_base = 0xa0000000;
-       si.pci_0.pci_io.pci_base_hi = 0;
-       si.pci_0.pci_io.pci_base_lo = 0;
-       si.pci_0.pci_io.size = 0x01000000;
-       si.pci_0.pci_io.swap = 0x01000000; /* XXXX No swapping */
-       si.pci_0.pci_mem[0].cpu_base = 0x80000000;
-       si.pci_0.pci_mem[0].pci_base_hi = 0;
-       si.pci_0.pci_mem[0].pci_base_lo = 0x80000000;
-       si.pci_0.pci_mem[0].size = 0x10000000;
-       si.pci_0.pci_mem[0].swap = 0x01000000; /* XXXX No swapping */
-       si.pci_0.pci_mem[1].cpu_base = 0;
-       si.pci_0.pci_mem[1].pci_base_hi = 0;
-       si.pci_0.pci_mem[1].pci_base_lo = 0;
-       si.pci_0.pci_mem[1].size = 0;   /* Don't use this window */
-       si.pci_0.pci_mem[1].swap = 0;
-       si.pci_0.pci_mem[2].cpu_base = 0;
-       si.pci_0.pci_mem[2].pci_base_hi = 0;
-       si.pci_0.pci_mem[2].pci_base_lo = 0;
-       si.pci_0.pci_mem[2].size = 0;   /* Don't use this window */
-       si.pci_0.pci_mem[1].swap = 0;
-       si.pci_0.pci_cmd_bits = 0;
-       si.pci_0.latency_timer = 0x8;
-
-       si.pci_1.enable_bus = 1;
-       si.pci_1.enumerate_bus = 1;
-       si.pci_1.pci_io.cpu_base = 0xa1000000;
-       si.pci_1.pci_io.pci_base_hi = 0;
-       si.pci_1.pci_io.pci_base_lo = 0x01000000;
-       si.pci_1.pci_io.size = 0x01000000;
-       si.pci_1.pci_io.swap = 0x01000000; /* XXXX No swapping */
-       si.pci_1.pci_mem[0].cpu_base = 0x90000000;
-       si.pci_1.pci_mem[0].pci_base_hi = 0;
-       si.pci_1.pci_mem[0].pci_base_lo = 0x90000000;
-       si.pci_1.pci_mem[0].size = 0x10000000;
-       si.pci_1.pci_mem[0].swap = 0x01000000; /* XXXX No swapping */
-       si.pci_1.pci_mem[1].cpu_base = 0;
-       si.pci_1.pci_mem[1].pci_base_hi = 0;
-       si.pci_1.pci_mem[1].pci_base_lo = 0;
-       si.pci_1.pci_mem[1].size = 0;   /* Don't use this window */
-       si.pci_1.pci_mem[1].swap = 0;
-       si.pci_1.pci_mem[2].cpu_base = 0;
-       si.pci_1.pci_mem[2].pci_base_hi = 0;
-       si.pci_1.pci_mem[2].pci_base_lo = 0;
-       si.pci_1.pci_mem[2].size = 0;   /* Don't use this window */
-       si.pci_1.pci_mem[1].swap = 0;
-       si.pci_1.pci_cmd_bits = 0;
-       si.pci_1.latency_timer = 0x8;
-       si.pci_1.pci_cmd_bits = 0;
-       si.pci_1.latency_timer = 0x8;
-
-       si.window_preserve_mask_32 = 0x1f0;
-#if 0
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               si.cpu_prot_options[i] = 0;
-//             si.cpu_snoop_options[i] = GT64260_CPU_SNOOP_WB;
-               si.pci_0.acc_cntl_options[i] =
-                       /* Breaks PCI (especially slot 4)
-                       GT64260_PCI_ACC_CNTL_PREFETCHEN |
-                       */
-                       GT64260_PCI_ACC_CNTL_DREADEN |
-                       GT64260_PCI_ACC_CNTL_RDPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
-                       GT64260_PCI_ACC_CNTL_SWAP_NONE |
-                       GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
-               si.pci_0.snoop_options[i] = GT64260_PCI_SNOOP_WB;
-               si.pci_1.acc_cntl_options[i] =
-                       /* Breaks PCI (especially slot 4)
-                       GT64260_PCI_ACC_CNTL_PREFETCHEN |
-                       */
-                       GT64260_PCI_ACC_CNTL_DREADEN |
-                       GT64260_PCI_ACC_CNTL_RDPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
-                       GT64260_PCI_ACC_CNTL_SWAP_NONE |
-                       GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
-//             si.pci_1.snoop_options[i] = GT64260_PCI_SNOOP_WB;
-       }
-#endif
-
-       mv64x60_pci_exclude_bridge = 0;
-
-        /* Lookup PCI host bridges */
-        if (mv64x60_init(&bh, &si)) {
-                printk("Bridge initialization failed.\n");
-        }
-
-       return;
-}
-
-static void __init dmv182_setup_peripherals(void)
-{
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
-                                0xf0000000, 0x08000000, 0); // FLASH
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
-                                0xe0010000, 0x10000, 0); // I/O FPGA
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
-                                0xe0000000, 0x10000, 0); // EPLD
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
-                                0xe0020000, 0x10000, 0); // RTC
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
-                                0xe0030000, 0x10000, 0); // NVRAM
-
-       TODC_INIT(TODC_TYPE_DS1501, 0, 0, dmv182_rtc, 8);
-}
-
-unsigned long __init dmv182_find_end_of_memory(void)
-{
-#if 0
-       return mv64x60_get_mem_size(0xfff00000 /*CONFIG_MV64X60_NEW_BASE*/,
-                                                 MV64x60_TYPE_MV64360);
-#endif
-       /* But it dies if we enable more than 512MiB. Debug later... */
-       return 0x20000000;
-}
-
-void __init platform_init(unsigned long r3, unsigned long r4,
-                          unsigned long r5, unsigned long r6,
-                          unsigned long r7)
-{
-       parse_bootinfo(find_bootinfo());
-       
-       dmv182_setup_bats();
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG)
-       ppc_md.progress = gen550_progress;
-#endif
-       ppc_md.setup_io_mappings = dmv182_map_io;
-       ppc_md.find_end_of_memory = dmv182_find_end_of_memory;
-       ppc_md.setup_arch = dmv182_setup_arch;
-       ppc_md.init_IRQ = dmv182_init_irq;
-       ppc_md.get_irq = mv64360_get_irq;
-       ppc_md.calibrate_decr = dmv182_calibrate_decr;
-//     ppc_md.pci_bridge_reserve_space = dmv182_pci_bridge_reserve_space;
-       
-       ppc_md.halt = dmv182_halt;
-       ppc_md.power_off = dmv182_halt;
-       ppc_md.restart = dmv182_restart;
-#ifdef CONFIG_SMP
-       ppc_md.smp_ops = &dmv182_smp_ops;
-#endif
-#ifdef CONFIG_GEN_RTC
-       ppc_md.time_init = todc_time_init;
-       ppc_md.set_rtc_time = todc_set_rtc_time;
-       ppc_md.get_rtc_time = todc_get_rtc_time;
-
-       ppc_md.nvram_read_val = todc_direct_read_val;
-       ppc_md.nvram_write_val = todc_direct_write_val;
-#endif
-}
diff --git a/arch/ppc/platforms/dmv182.h b/arch/ppc/platforms/dmv182.h
deleted file mode 100644 (file)
index fde6ba7..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef __DMV182_H
-#define __DMV182_H
-
-#include <linux/config.h>
-#include <linux/types.h>
-
-#define dmv182_board_io_phys 0xe0000000
-#define dmv182_board_io_size 0x00040000
-
-#ifdef __BOOTER__
-#define dmv182_board_io_virt ((u8 *)dmv182_board_io_phys)
-#else
-#define dmv182_board_io_virt ((u8 *)0xf0000000)
-#endif
-
-#define dmv182_fpga_io (dmv182_board_io_virt + 0x10000)
-#define dmv182_rtc     (dmv182_board_io_virt + 0x20000)
-#define dmv182_nvram   (dmv182_board_io_virt + 0x30000)
-
-// This has to go above the mv64360 interrupts, as even though
-// the mv64360 code can handle relocating its interrupt range,
-// the device drivers themselves are oblivious to this.
-
-#define DMV182_IRQ_TEMPA        96
-#define DMV182_IRQ_TEMPB        97
-#define DMV182_IRQ_TEMPC        98
-#define DMV182_IRQ_TEMPD        99
-#define DMV182_IRQ_PMC1A       100
-#define DMV182_IRQ_PMC1B       101
-#define DMV182_IRQ_PMC1C       102
-#define DMV182_IRQ_PMC1D       103
-#define DMV182_IRQ_PMC2A       104
-#define DMV182_IRQ_PMC2B       105
-#define DMV182_IRQ_PMC2C       106
-#define DMV182_IRQ_PMC2D       107
-#define DMV182_IRQ_ENET_PHY2   108
-#define DMV182_IRQ_ENET_PHY1   109
-#define DMV182_IRQ_IPM0        110
-#define DMV182_IRQ_IPM1        111
-#define DMV182_IRQ_USB_A       112
-#define DMV182_IRQ_USB_B       113
-#define DMV182_IRQ_USB_C       114
-#define DMV182_IRQ_USB_SMI     115
-#define DMV182_IRQ_RTC         116
-#define DMV182_IRQ_WDOG_CPU0   117
-#define DMV182_IRQ_WDOG_CPU1   118
-#define DMV182_IRQ_TIMER0_CPU0 120
-#define DMV182_IRQ_TIMER1_CPU0 121
-#define DMV182_IRQ_TIMER2_CPU0 122
-#define DMV182_IRQ_TIMER0_CPU1 123
-#define DMV182_IRQ_TIMER1_CPU1 124
-#define DMV182_IRQ_TIMER2_CPU1 125
-#define DMV182_IRQ_SERIAL_CH1  126
-#define DMV182_IRQ_SERIAL_CH2  127
-#define DMV182_IRQ_VME_CPU0    128
-#define DMV182_IRQ_VME_CPU1    129
-
-// 28 FPGA interrupts starting from here
-#define DMV182_IRQ_FPGA        132
-
-#endif
diff --git a/arch/ppc/platforms/dmv182_serial.h b/arch/ppc/platforms/dmv182_serial.h
deleted file mode 100644 (file)
index b1dbb2d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef __DMV182_SERIAL_H
-#define __DMV182_SERIAL_H
-
-#include <linux/serial.h>
-#include <platforms/dmv182.h>
-
-#define BASE_BAUD (36864000 / 16)
-#define RS_TABLE_SIZE 2
-
-#define STD_UART_OP(num) \
-       { .baud_base = BASE_BAUD, \
-         .irq = DMV182_IRQ_SERIAL_CH##num, \
-         .flags = ASYNC_SKIP_TEST | ASYNC_BUGGY_UART, \
-         .iomem_base = dmv182_fpga_io + 0x18 + 8 * (num - 1), \
-         .io_type = SERIAL_IO_MEM },
-
-#define SERIAL_PORT_DFNS STD_UART_OP(1) STD_UART_OP(2)
-
-#endif
diff --git a/arch/ppc/platforms/error_log.c b/arch/ppc/platforms/error_log.c
deleted file mode 100644 (file)
index 4a71e18..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *  arch/ppc/kernel/error_log.c
- *
- *  Copyright (c) 2000 Tilmann Bitterberg
- *  (tilmann@bitterberg.de)
- *
- *  Error processing of errors found by rtas even-scan routine
- *  which is done with every heartbeat. (chrp_setup.c)
- */
-
-#include <linux/sched.h>
-
-#include <asm/prom.h>
-
-#include "error_log.h"
-
-/* ****************************************************************** */
-/*
- * EVENT-SCAN
- * The whole stuff below here doesn't take any action when it found
- * an error, it just prints as much information as possible and
- * then its up to the user to decide what to do.
- *
- * Returns 0 if no errors were found
- * Returns 1 if there may be more errors
- */
-int ppc_rtas_errorlog_scan(void)
-{
-const char *_errlog_severity[] = {
-#ifdef VERBOSE_ERRORS
-       "No Error\n\t\
-Should require no further information",
-       "Event\n\t\
-This is not really an error, it is an event. I use events\n\t\
-to communicate with RTAS back and forth.",
-       "Warning\n\t\
-Indicates a non-state-losing error, either fully recovered\n\t\
-by RTAS or not needing recovery. Ignore it.",
-       "Error sync\n\t\
-May only be fatal to a certain program or thread. Recovery\n\t\
-and continuation is possible, if I only had a handler for\n\t\
-this. Less serious",
-       "Error\n\t\
-Less serious, but still causing a loss of data and state.\n\t\
-I can't tell you exactly what to do, You have to decide\n\t\
-with help from the target and initiator field, what kind\n\t\
-of further actions may take place.",
-       "Fatal\n\t\
-Represent a permanent hardware failure and I believe this\n\t\
-affects my overall performance and behaviour. I would not\n\t\
-attempt to continue normal operation."
-#else
-       "No Error",
-       "Event",
-       "Warning",
-       "Error sync",
-       "Error",
-       "Fatal"
-#endif /* VERBOSE_ERRORS */
-};
-
-#if 0 /* unused?? */
-const char *_errlog_disposition[] = {
-#ifdef VERBOSE_ERRORS
-       "Fully recovered\n\t\
-There was an error, but it is fully recovered by RTAS.",
-       "Limited recovery\n\t\
-RTAS was able to recover the state of the machine, but some\n\t\
-feature of the machine has been disabled or lost (for example\n\t\
-error checking) or performance may suffer.",
-       "Not recovered\n\t\
-Whether RTAS did not try to recover anything or recovery failed:\n\t\
-HOUSTON, WE HAVE A PROBLEM!"
-#else
-       "Fully recovered",
-       "Limited recovery",
-       "Not recovered"
-#endif /* VERBOSE_ERRORS */
-};
-#endif
-
-const char *_errlog_extended[] = {
-#ifdef VERBOSE_ERRORS
-       "Not present\n\t\
-Sad, the RTAS call didn't return an extended error log.",
-       "Present\n\t\
-The extended log is present and hopefully it contains a lot of\n\t\
-useful information, which leads to the solution of the problem."
-#else
-       "Not present",
-       "Present"
-#endif /* VERBOSE_ERRORS */
-};
-
-const char *_errlog_initiator[] = {
-       "Unknown or not applicable",
-       "CPU",
-       "PCI",
-       "ISA",
-       "Memory",
-       "Power management"
-};
-
-const char *_errlog_target[] = {
-       "Unknown or not applicable",
-       "CPU",
-       "PCI",
-       "ISA",
-       "Memory",
-       "Power management"
-};
-       rtas_error_log error_log;
-       char logdata[1024];
-       int error;
-#if 0 /* unused?? */
-       int retries = 0; /* if HW error, try 10 times */
-#endif
-
-       error = call_rtas ("event-scan", 4, 1, (unsigned long *)&error_log,
-                       INTERNAL_ERROR | EPOW_WARNING,
-                       0, __pa(logdata), 1024);
-
-       if (error == 1) /* no errors found */
-               return 0;
-
-       if (error == -1) {
-               printk(KERN_ERR "Unable to get errors. Do you a favor and throw this box away\n");
-               return 0;
-       }
-       if (error_log.version != 1)
-               printk(KERN_WARNING "Unknown version (%d), please implement me\n",
-                               error_log.version);
-
-       switch (error_log.disposition) {
-               case DISP_FULLY_RECOVERED:
-                       /* there was an error, but everything is fine now */
-                       return 0;
-               case DISP_NOT_RECOVERED:
-                       printk("We have a really serious Problem!\n");
-               case DISP_LIMITED_RECOVERY:
-                       printk("Error classification\n");
-                       printk("Severity  : %s\n",
-                                       ppc_rtas_errorlog_check_severity (error_log));
-                       printk("Initiator : %s\n",
-                                       ppc_rtas_errorlog_check_initiator (error_log));
-                       printk("Target    : %s\n",
-                                       ppc_rtas_errorlog_check_target (error_log));
-                       printk("Type      : %s\n",
-                                       ppc_rtas_errorlog_check_type (error_log));
-                       printk("Ext. log  : %s\n",
-                                       ppc_rtas_errorlog_check_extended (error_log));
-                       if (error_log.extended)
-                               ppc_rtas_errorlog_disect_extended (logdata);
-                       return 1;
-               default:
-                       /* nothing */
-                       break;
-       }
-       return 0;
-}
-/* ****************************************************************** */
-const char * ppc_rtas_errorlog_check_type (rtas_error_log error_log)
-{
-       const char *_errlog_type[] = {
-               "unknown type",
-               "too many tries failed",
-               "TCE error",
-               "RTAS device failed",
-               "target timed out",
-               "parity error on data",                 /* 5 */
-               "parity error on address",
-               "parity error on external cache",
-               "access to invalid address",
-               "uncorrectable ECC error",
-               "corrected ECC error"                   /* 10 */
-       };
-       if (error_log.type == TYPE_EPOW)
-               return "EPOW";
-       if (error_log.type >= TYPE_PMGM_POWER_SW_ON)
-               return "PowerMGM Event (not handled right now)";
-       return _errlog_type[error_log.type];
-}
-
diff --git a/arch/ppc/platforms/error_log.h b/arch/ppc/platforms/error_log.h
deleted file mode 100644 (file)
index b8226ae..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#ifndef __ERROR_LOG_H__
-#define __ERROR_LOG_H__
-
-#define VERBOSE_ERRORS         1 /* Maybe I enlarge the kernel too much */
-#undef VERBOSE_ERRORS
-
-/* Event classes */
-/* XXX: Endianess correct? NOW*/
-#define INTERNAL_ERROR         0x80000000 /* set bit 0 */
-#define EPOW_WARNING           0x40000000 /* set bit 1 */
-#define POWERMGM_EVENTS                0x20000000 /* set bit 2 */
-
-/* event-scan returns */
-#define SEVERITY_FATAL         0x5
-#define SEVERITY_ERROR         0x4
-#define SEVERITY_ERROR_SYNC    0x3
-#define SEVERITY_WARNING       0x2
-#define SEVERITY_EVENT         0x1
-#define SEVERITY_NO_ERROR      0x0
-#define DISP_FULLY_RECOVERED   0x0
-#define DISP_LIMITED_RECOVERY  0x1
-#define DISP_NOT_RECOVERED     0x2
-#define PART_PRESENT           0x0
-#define PART_NOT_PRESENT       0x1
-#define INITIATOR_UNKNOWN      0x0
-#define INITIATOR_CPU          0x1
-#define INITIATOR_PCI          0x2
-#define INITIATOR_ISA          0x3
-#define INITIATOR_MEMORY       0x4
-#define INITIATOR_POWERMGM     0x5
-#define TARGET_UNKNOWN         0x0
-#define TARGET_CPU             0x1
-#define TARGET_PCI             0x2
-#define TARGET_ISA             0x3
-#define TARGET_MEMORY          0x4
-#define TARGET_POWERMGM                0x5
-#define TYPE_RETRY             0x01
-#define TYPE_TCE_ERR           0x02
-#define TYPE_INTERN_DEV_FAIL   0x03
-#define TYPE_TIMEOUT           0x04
-#define TYPE_DATA_PARITY       0x05
-#define TYPE_ADDR_PARITY       0x06
-#define TYPE_CACHE_PARITY      0x07
-#define TYPE_ADDR_INVALID      0x08
-#define TYPE_ECC_UNCORR                0x09
-#define TYPE_ECC_CORR          0x0a
-#define TYPE_EPOW              0x40
-/* I don't add PowerMGM events right now, this is a different topic */
-#define TYPE_PMGM_POWER_SW_ON  0x60
-#define TYPE_PMGM_POWER_SW_OFF 0x61
-#define TYPE_PMGM_LID_OPEN     0x62
-#define TYPE_PMGM_LID_CLOSE    0x63
-#define TYPE_PMGM_SLEEP_BTN    0x64
-#define TYPE_PMGM_WAKE_BTN     0x65
-#define TYPE_PMGM_BATTERY_WARN 0x66
-#define TYPE_PMGM_BATTERY_CRIT 0x67
-#define TYPE_PMGM_SWITCH_TO_BAT        0x68
-#define TYPE_PMGM_SWITCH_TO_AC 0x69
-#define TYPE_PMGM_KBD_OR_MOUSE 0x6a
-#define TYPE_PMGM_ENCLOS_OPEN  0x6b
-#define TYPE_PMGM_ENCLOS_CLOSED        0x6c
-#define TYPE_PMGM_RING_INDICATE        0x6d
-#define TYPE_PMGM_LAN_ATTENTION        0x6e
-#define TYPE_PMGM_TIME_ALARM   0x6f
-#define TYPE_PMGM_CONFIG_CHANGE        0x70
-#define TYPE_PMGM_SERVICE_PROC 0x71
-
-typedef struct _rtas_error_log {
-       unsigned long version:8;                /* Architectural version */
-       unsigned long severity:3;               /* Severity level of error */
-       unsigned long disposition:2;            /* Degree of recovery */
-       unsigned long extended:1;               /* extended log present? */
-       unsigned long /* reserved */ :2;        /* Reserved for future use */
-       unsigned long initiator:4;              /* Initiator of event */
-       unsigned long target:4;                 /* Target of failed operation */
-       unsigned long type:8;                   /* General event or error*/
-       unsigned long extended_log_length:32;   /* length in bytes */
-} rtas_error_log;
-
-/* ****************************************************************** */
-#define ppc_rtas_errorlog_check_severity(x) \
-       (_errlog_severity[x.severity])
-#define ppc_rtas_errorlog_check_target(x) \
-       (_errlog_target[x.target])
-#define ppc_rtas_errorlog_check_initiator(x) \
-       (_errlog_initiator[x.initiator])
-#define ppc_rtas_errorlog_check_extended(x) \
-       (_errlog_extended[x.extended])
-#define ppc_rtas_errorlog_disect_extended(x) \
-       do { /* implement me */ } while(0)
-extern const char * ppc_rtas_errorlog_check_type (rtas_error_log error_log);
-extern int ppc_rtas_errorlog_scan(void);
-
-
-#endif /* __ERROR_LOG_H__ */
diff --git a/arch/ppc/platforms/ev64260.c b/arch/ppc/platforms/ev64260.c
deleted file mode 100644 (file)
index 1275889..0000000
+++ /dev/null
@@ -1,893 +0,0 @@
-/*
- * arch/ppc/platforms/ev64260.c
- *
- * Board setup routines for the Marvell/Galileo EV-64260-BP Evaluation Board.
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2001-2003 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-/*
- * The EV-64260-BP port is the result of hard work from many people from
- * many companies.  In particular, employees of Marvell/Galileo, Mission
- * Critical Linux, Xyterra, and MontaVista Software were heavily involved.
- *
- * Note: I have not been able to get *all* PCI slots to work reliably
- *     at 66 MHz.  I recommend setting jumpers J15 & J16 to short pins 1&2
- *     so that 33 MHz is used. --MAG
- * Note: The 750CXe and 7450 are not stable with a 125MHz or 133MHz TCLK/SYSCLK.
- *     At 100MHz, they are solid.
- */
-#include <linux/config.h>
-
-#include <linux/delay.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-#include <linux/irq.h>
-#include <linux/fs.h>
-#include <linux/seq_file.h>
-#include <linux/console.h>
-#include <linux/initrd.h>
-#include <linux/root_dev.h>
-#if !defined(CONFIG_SERIAL_MPSC_CONSOLE)
-#include <linux/serial.h>
-#include <linux/tty.h>
-#include <linux/serial_core.h>
-#endif
-#include <asm/bootinfo.h>
-#include <asm/machdep.h>
-#include <asm/mv64x60.h>
-#include <asm/ppcboot.h>
-#include <asm/todc.h>
-#include <asm/time.h>
-#include <asm/ocp.h>
-
-#include <platforms/ev64260.h>
-
-#define BOARD_VENDOR   "Marvell/Galileo"
-#define BOARD_MACHINE  "EV-64260-BP"
-
-/* Set IDE controllers into Native mode? */
-/* XXXX
-#define SET_PCI_IDE_NATIVE
-*/
-
-ulong  ev64260_mem_size = 0;
-bd_t   ppcboot_bd;
-int    ppcboot_bd_valid=0;
-
-static mv64x60_handle_t        bh;
-
-#if !defined(CONFIG_SERIAL_MPSC_CONSOLE)
-extern void gen550_progress(char *, unsigned short);
-extern void gen550_init(int, struct serial_struct *);
-#endif
-
-static const unsigned int cpu_7xx[16] = { /* 7xx & 74xx (but not 745x) */
-       18, 15, 14, 2, 4, 13, 5, 9, 6, 11, 8, 10, 16, 12, 7, 0
-};
-static const unsigned int cpu_745x[2][16] = { /* PLL_EXT 0 & 1 */
-       { 1, 15, 14,  2,  4, 13,  5,  9,  6, 11,  8, 10, 16, 12,  7,  0 },
-       { 0, 30,  0,  2,  0, 26,  0, 18,  0, 22, 20, 24, 28, 32,  0,  0 }
-};
-
-
-TODC_ALLOC();
-
-static int
-ev64260_get_bus_speed(void)
-{
-       int     speed;
-
-       if (ppcboot_bd_valid) {
-               speed = ppcboot_bd.bi_busfreq;
-       }
-       else {
-               speed = 100000000; /* Only 100MHz is stable */
-       }
-
-       return speed;
-}
-
-static int
-ev64260_get_cpu_speed(void)
-{
-       unsigned long   pvr, hid1, pll_ext;
-
-       pvr = PVR_VER(mfspr(PVR));
-
-       if (pvr != PVR_VER(PVR_7450)) {
-               hid1 = mfspr(HID1) >> 28;
-               return ev64260_get_bus_speed() * cpu_7xx[hid1]/2;
-       }
-       else {
-               hid1 = (mfspr(HID1) & 0x0001e000) >> 13;
-               pll_ext = 0; /* No way to read; must get from schematic */
-               return ev64260_get_bus_speed() * cpu_745x[pll_ext][hid1]/2;
-       }
-}
-
-unsigned long __init
-ev64260_find_end_of_memory(void)
-{
-       if(!ppcboot_bd_valid) {
-               return mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
-                       MV64x60_TYPE_GT64260A);
-       }
-       return ppcboot_bd.bi_memsize;
-}
-
-#if 0  /* XXXX */
-#ifdef SET_PCI_IDE_NATIVE
-static void __init
-set_pci_native_mode(void)
-{
-       struct pci_dev *dev;
-
-       /* Better way of doing this ??? */
-       pci_for_each_dev(dev) { 
-               int class = dev->class >> 8;
-
-               /* enable pci native mode */
-               if (class == PCI_CLASS_STORAGE_IDE) {
-                       u8 reg;
-
-                       pci_read_config_byte(dev, 0x9, &reg);
-                       if (reg == 0x8a) {
-                               printk("PCI: Enabling PCI IDE native mode on %s\n", dev->slot_name); 
-                               pci_write_config_byte(dev, 0x9,  0x8f);
-
-                               /* let the pci code set this device up after we change it */
-                               pci_setup_device(dev); 
-                       } else if (reg != 0x8f) {
-                               printk("PCI: IDE chip in unknown mode 0x%02x on %s", reg, dev->slot_name);
-                       }
-               }
-       }
-}
-#endif
-#endif
-
-static void __init
-ev64260_pci_fixups(void)
-{
-#ifdef SET_PCI_IDE_NATIVE
-       set_pci_native_mode();
-#endif
-}
-
-
-/*
- * Marvell/Galileo EV-64260-BP Evaluation Board PCI interrupt routing.
- * Note: By playing with J8 and JP1-4, you can get 2 IRQ's from the first
- *     PCI bus (in which cast, INTPIN B would be EV64260_PCI_1_IRQ).
- *     This is the most IRQs you can get from one bus with this board, though.
- */
-static int __init
-ev64260_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
-{
-       struct pci_controller   *hose = pci_bus_to_hose(dev->bus->number);
-
-       if (hose->index == 0) {
-               static char pci_irq_table[][4] =
-               /*
-                *      PCI IDSEL/INTPIN->INTLINE 
-                *         A   B   C   D
-                */
-               {
-                       {EV64260_PCI_0_IRQ,0,0,0}, /* IDSEL 7 - PCI bus 0 */
-                       {EV64260_PCI_0_IRQ,0,0,0}, /* IDSEL 8 - PCI bus 0 */
-               };
-
-               const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
-               return PCI_IRQ_TABLE_LOOKUP;
-       }
-       else {
-               static char pci_irq_table[][4] =
-               /*
-                *      PCI IDSEL/INTPIN->INTLINE 
-                *         A   B   C   D
-                */
-               {
-                       { EV64260_PCI_1_IRQ,0,0,0}, /* IDSEL 7 - PCI bus 1 */
-                       { EV64260_PCI_1_IRQ,0,0,0}, /* IDSEL 8 - PCI bus 1 */
-               };
-
-               const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
-               return PCI_IRQ_TABLE_LOOKUP;
-       }
-}
-
-static void __init
-ev64260_setup_peripherals(void)
-{
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
-               EV64260_EMB_FLASH_BASE, EV64260_EMB_FLASH_SIZE, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
-               EV64260_EXT_SRAM_BASE, EV64260_EXT_SRAM_SIZE, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
-               EV64260_TODC_BASE, EV64260_TODC_SIZE, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
-               EV64260_UART_BASE, EV64260_UART_SIZE, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
-               EV64260_EXT_FLASH_BASE, EV64260_EXT_FLASH_SIZE, 0);
-
-       TODC_INIT(TODC_TYPE_DS1501, 0, 0,
-                       ioremap(EV64260_TODC_BASE, EV64260_TODC_SIZE), 8);
-
-       mv64x60_clr_bits(&bh, MV64x60_CPU_CONFIG, ((1<<28) | (1<<29)));
-       mv64x60_set_bits(&bh, MV64x60_CPU_CONFIG, (1<<27));
-
-       if (ev64260_get_bus_speed() > 100000000) {
-               mv64x60_set_bits(&bh, MV64x60_CPU_CONFIG, (1<<23));
-       }
-
-       mv64x60_set_bits(&bh, MV64x60_PCI0_PCI_DECODE_CNTL,((1<<0) | (1<<3)));
-       mv64x60_set_bits(&bh, MV64x60_PCI1_PCI_DECODE_CNTL,((1<<0) | (1<<3)));
-
-        /*
-         * Enabling of PCI internal-vs-external arbitration
-         * is a platform- and errata-dependent decision.
-         */
-        if (bh.type == MV64x60_TYPE_GT64260A )  {
-                mv64x60_set_bits(&bh, MV64x60_PCI0_ARBITER_CNTL, (1<<31));
-                mv64x60_set_bits(&bh, MV64x60_PCI1_ARBITER_CNTL, (1<<31));
-        }
-
-        mv64x60_set_bits(&bh, MV64x60_CPU_MASTER_CNTL, (1<<9)); /* Only 1 cpu */
-
-       /*
-        * The EV-64260-BP uses several Multi-Purpose Pins (MPP) on the 64260
-        * bridge as interrupt inputs (via the General Purpose Ports (GPP)
-        * register).  Need to route the MPP inputs to the GPP and set the
-        * polarity correctly.
-        *
-        * In MPP Control 2 Register
-        *   MPP 21 -> GPP 21 (DUART channel A intr) bits 20-23 -> 0
-        *   MPP 22 -> GPP 22 (DUART channel B intr) bits 24-27 -> 0
-        */
-       mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_2, (0xf<<20) | (0xf<<24) );
-
-       /*
-        * In MPP Control 3 Register
-        *   MPP 26 -> GPP 26 (RTC INT)         bits  8-11 -> 0
-        *   MPP 27 -> GPP 27 (PCI 0 INTA)      bits 12-15 -> 0
-        *   MPP 29 -> GPP 29 (PCI 1 INTA)      bits 20-23 -> 0
-        */
-       mv64x60_clr_bits(&bh, MV64x60_MPP_CNTL_3,
-               (0xf<<8) | (0xf<<12) | (0xf<<20));
-
-#define GPP_EXTERNAL_INTERRUPTS \
-               ((1<<21) | (1<<22) | (1<<26) | (1<<27) | (1<<29))
-       /* DUART & PCI interrupts are inputs */
-       mv64x60_clr_bits(&bh, MV64x60_GPP_IO_CNTL, GPP_EXTERNAL_INTERRUPTS);
-       /* DUART & PCI interrupts are active low */
-       mv64x60_set_bits(&bh, MV64x60_GPP_LEVEL_CNTL, GPP_EXTERNAL_INTERRUPTS);
-
-       /* Clear any pending interrupts for these inputs and enable them. */
-       mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~GPP_EXTERNAL_INTERRUPTS);
-       mv64x60_set_bits(&bh, MV64x60_GPP_INTR_MASK, GPP_EXTERNAL_INTERRUPTS);
-
-       /*
-        * Set MPSC Multiplex RMII
-        * NOTE: ethernet driver modifies bit 0 and 1
-        */
-       mv64x60_write(&bh, GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
-       return;
-}
-
-
-static void __init
-ev64260_setup_bridge(void)
-{
-       mv64x60_setup_info_t    si;
-       int                     i;
-
-       memset(&si, 0, sizeof(si));
-
-       si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
-       si.map_irq = ev64260_map_irq;
-
-       si.pci_0.enable_bus = 1;
-       si.pci_0.enumerate_bus = 1;
-       si.pci_0.pci_io.cpu_base = 0xa0000000;
-       si.pci_0.pci_io.pci_base_hi = 0;
-       si.pci_0.pci_io.pci_base_lo = 0;
-       si.pci_0.pci_io.size = 0x01000000;
-       si.pci_0.pci_io.swap = 0x01000000; /* XXXX No swapping */
-       si.pci_0.pci_mem[0].cpu_base = 0x80000000;
-       si.pci_0.pci_mem[0].pci_base_hi = 0;
-       si.pci_0.pci_mem[0].pci_base_lo = 0x80000000;
-       si.pci_0.pci_mem[0].size = 0x10000000;
-       si.pci_0.pci_mem[0].swap = 0x01000000; /* XXXX No swapping */
-       si.pci_0.pci_mem[1].cpu_base = 0;
-       si.pci_0.pci_mem[1].pci_base_hi = 0;
-       si.pci_0.pci_mem[1].pci_base_lo = 0;
-       si.pci_0.pci_mem[1].size = 0;   /* Don't use this window */
-       si.pci_0.pci_mem[1].swap = 0;
-       si.pci_0.pci_mem[2].cpu_base = 0;
-       si.pci_0.pci_mem[2].pci_base_hi = 0;
-       si.pci_0.pci_mem[2].pci_base_lo = 0;
-       si.pci_0.pci_mem[2].size = 0;   /* Don't use this window */
-       si.pci_0.pci_mem[1].swap = 0;
-       si.pci_0.pci_cmd_bits = 0;
-       si.pci_0.latency_timer = 0x8;
-
-       si.pci_1.enable_bus = 1;
-       si.pci_1.enumerate_bus = 1;
-       si.pci_1.pci_io.cpu_base = 0xa1000000;
-       si.pci_1.pci_io.pci_base_hi = 0;
-       si.pci_1.pci_io.pci_base_lo = 0x01000000;
-       si.pci_1.pci_io.size = 0x01000000;
-       si.pci_1.pci_io.swap = 0x01000000; /* XXXX No swapping */
-       si.pci_1.pci_mem[0].cpu_base = 0x90000000;
-       si.pci_1.pci_mem[0].pci_base_hi = 0;
-       si.pci_1.pci_mem[0].pci_base_lo = 0x90000000;
-       si.pci_1.pci_mem[0].size = 0x10000000;
-       si.pci_1.pci_mem[0].swap = 0x01000000; /* XXXX No swapping */
-       si.pci_1.pci_mem[1].cpu_base = 0;
-       si.pci_1.pci_mem[1].pci_base_hi = 0;
-       si.pci_1.pci_mem[1].pci_base_lo = 0;
-       si.pci_1.pci_mem[1].size = 0;   /* Don't use this window */
-       si.pci_1.pci_mem[1].swap = 0;
-       si.pci_1.pci_mem[2].cpu_base = 0;
-       si.pci_1.pci_mem[2].pci_base_hi = 0;
-       si.pci_1.pci_mem[2].pci_base_lo = 0;
-       si.pci_1.pci_mem[2].size = 0;   /* Don't use this window */
-       si.pci_1.pci_mem[1].swap = 0;
-       si.pci_1.pci_cmd_bits = 0;
-       si.pci_1.latency_timer = 0x8;
-       si.pci_1.pci_cmd_bits = 0;
-       si.pci_1.latency_timer = 0x8;
-
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               si.cpu_prot_options[i] = 0;
-               si.cpu_snoop_options[i] = GT64260_CPU_SNOOP_WB;
-               si.pci_0.acc_cntl_options[i] =
-                       /* Breaks PCI (especially slot 4)
-                       GT64260_PCI_ACC_CNTL_PREFETCHEN |
-                       */
-                       GT64260_PCI_ACC_CNTL_DREADEN |
-                       GT64260_PCI_ACC_CNTL_RDPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
-                       GT64260_PCI_ACC_CNTL_SWAP_NONE |
-                       GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
-               si.pci_0.snoop_options[i] = GT64260_PCI_SNOOP_WB;
-               si.pci_1.acc_cntl_options[i] =
-                       /* Breaks PCI (especially slot 4)
-                       GT64260_PCI_ACC_CNTL_PREFETCHEN |
-                       */
-                       GT64260_PCI_ACC_CNTL_DREADEN |
-                       GT64260_PCI_ACC_CNTL_RDPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |
-                       GT64260_PCI_ACC_CNTL_RDMULPREFETCH |
-                       GT64260_PCI_ACC_CNTL_SWAP_NONE |
-                       GT64260_PCI_ACC_CNTL_MBURST_32_BTYES;
-               si.pci_1.snoop_options[i] = GT64260_PCI_SNOOP_WB;
-       }
-
-        /* Lookup PCI host bridges */
-        if (mv64x60_init(&bh, &si)) {
-                printk("Bridge initialization failed.\n");
-        }
-
-       return;
-}
-
-#if defined(CONFIG_SERIAL_8250) && !defined(CONFIG_SERIAL_MPSC_CONSOLE)
-static void __init
-ev64260_early_serial_map(void)
-{
-       struct uart_port        port;
-       static char             first_time = 1;
-
-       if (first_time) {
-               memset(&port, 0, sizeof(port));
-
-               port.membase = ioremap(EV64260_SERIAL_0, EV64260_UART_SIZE);
-               port.irq = EV64260_UART_0_IRQ;
-               port.uartclk = BASE_BAUD * 16;
-               port.regshift = 2;
-               port.iotype = SERIAL_IO_MEM;
-               port.flags = STD_COM_FLAGS;
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-               gen550_init(0, &port);
-#endif
-
-               if (early_serial_setup(&port) != 0) {
-                       printk("Early serial init of port 0 failed\n");
-               }
-
-#if 0  /* XXXX */
-               /* Assume early_serial_setup() doesn't modify port */
-               port.membase = ioremap(EV64260_SERIAL_1, EV64260_UART_SIZE);
-               port.irq = EV64260_UART_1_IRQ;
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-               gen550_init(1, &port);
-#endif
-
-               if (early_serial_setup(&port) != 0) {
-                       printk("Early serial init of port 1 failed\n");
-               }
-#endif
-
-               first_time = 0;
-       }
-
-       return;
-}
-#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)
-static void __init
-ev64260_early_serial_map(void)
-{
-#ifdef CONFIG_KGDB
-       static char     first_time = 1;
-
-
-#if defined(CONFIG_KGDB_TTYS0)
-#define KGDB_PORT 0
-#elif defined(CONFIG_KGDB_TTYS1)
-#define KGDB_PORT 1
-#else
-#error "Invalid kgdb_tty port"
-#endif
-
-       if (first_time) {
-               gt_early_mpsc_init(KGDB_PORT, B9600|CS8|CREAD|HUPCL|CLOCAL);
-               first_time = 0;
-       }
-
-       return;
-#endif
-}
-#endif
-
-static void __init
-ev64260_fixup_ocp(void)
-{
-#if defined(CONFIG_SERIAL_MPSC)
-       struct ocp_device       *dev;
-       mv64x60_ocp_mpsc_data_t *dp;
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 0))
-                                                               != NULL) {
-               dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-
-               dp->max_idle = 40;      /* XXXX what should this be? */
-               dp->default_baud = EV64260_DEFAULT_BAUD;
-               dp->brg_clk_src = EV64260_MPSC_CLK_SRC;
-               dp->brg_clk_freq = EV64260_MPSC_CLK_FREQ;
-       }
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 1))
-                                                               != NULL) {
-               dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-
-               dp->max_idle = 40;      /* XXXX what should this be? */
-               dp->default_baud = 9600;        /* XXXX */
-               dp->brg_clk_src = EV64260_MPSC_CLK_SRC;
-               dp->brg_clk_freq = EV64260_MPSC_CLK_FREQ;
-       }
-#endif
-
-       return;
-}
-
-static void __init
-ev64260_setup_arch(void)
-{
-       if ( ppc_md.progress )
-               ppc_md.progress("ev64260_setup_arch: enter", 0);
-
-#ifdef CONFIG_BLK_DEV_INITRD
-       if (initrd_start)
-               ROOT_DEV = Root_RAM0;
-       else
-#endif
-#ifdef CONFIG_ROOT_NFS
-               ROOT_DEV = Root_NFS;
-#else
-               ROOT_DEV = Root_SDA2;
-#endif
-
-       if ( ppc_md.progress )
-               ppc_md.progress("ev64260_setup_arch: Enabling L2 cache", 0);
-
-       /* Enable L2 and L3 caches (if 745x) */
-       _set_L2CR(_get_L2CR() | L2CR_L2E);
-       _set_L3CR(_get_L3CR() | L3CR_L3E);
-
-       if ( ppc_md.progress )
-               ppc_md.progress("ev64260_setup_arch: Initializing bridge", 0);
-
-       ev64260_setup_bridge();         /* set up PCI bridge(s) */
-       ev64260_setup_peripherals();    /* set up chip selects/GPP/MPP etc */
-
-       if ( ppc_md.progress )
-               ppc_md.progress("ev64260_setup_arch: bridge init complete", 0);
-
-       /* Set OCP values to reflect this board's setup */
-       ev64260_fixup_ocp();
-
-#ifdef CONFIG_DUMMY_CONSOLE
-       conswitchp = &dummy_con;
-#endif
-#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_MPSC_CONSOLE)
-       ev64260_early_serial_map();
-#endif
-
-       printk(BOARD_VENDOR " " BOARD_MACHINE "\n");
-       printk("EV-64260-BP port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
-
-       if ( ppc_md.progress )
-               ppc_md.progress("ev64260_setup_arch: exit", 0);
-
-       return;
-}
-
-static void
-ev64260_reset_board(void *addr)
-{
-       local_irq_disable();
-
-       /* disable and invalidate the L2 cache */
-       _set_L2CR(0);
-       _set_L2CR(0x200000);
-
-       /* flush and disable L1 I/D cache */
-       __asm__ __volatile__
-       ("mfspr   3,1008\n\t"
-        "ori   5,5,0xcc00\n\t"
-        "ori   4,3,0xc00\n\t"
-        "andc  5,3,5\n\t"
-        "sync\n\t"
-        "mtspr 1008,4\n\t"
-        "isync\n\t"
-        "sync\n\t"
-        "mtspr 1008,5\n\t"
-        "isync\n\t"
-        "sync\n\t");
-
-       /* unmap any other random cs's that might overlap with bootcs */
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, 0, 0, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, 0, 0, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN, 0, 0, 0);
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN, 0, 0, 0);
-
-       /* map bootrom back in to gt @ reset defaults */
-       mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
-                                               0xff800000, 8*1024*1024, 0);
-
-       /* move gt reg base back to default, setup default pci0 swapping
-        * config... */
-       mv64x60_write(&bh, MV64x60_INTERNAL_SPACE_DECODE,
-               (1<<24) | MV64x60_INTERNAL_SPACE_DEFAULT_ADDR>>20);
-
-       /* NOTE: FROM NOW ON no more GT_REGS accesses.. 0x1 is not mapped
-        * via BAT or MMU, and MSR IR/DR is ON */
-#if 0
-       /* BROKEN... IR/DR is still on !!  won't work!! */
-       /* Set exception prefix high - to the firmware */
-       _nmask_and_or_msr(0, MSR_IP);
-
-       out_8((u_char *)EV64260_BOARD_MODRST_REG, 0x01);
-#else
-       /* SRR0 has system reset vector, SRR1 has default MSR value */
-       /* rfi restores MSR from SRR1 and sets the PC to the SRR0 value */
-       /* NOTE: assumes reset vector is at 0xfff00100 */
-       __asm__ __volatile__
-       ("mtspr   26, %0\n\t"
-        "li      4,(1<<6)\n\t"
-        "mtspr   27,4\n\t"
-        "rfi\n\t"
-        :: "r" (addr):"r4");
-#endif
-       return;
-}
-
-static void
-ev64260_restart(char *cmd)
-{
-       volatile ulong  i = 10000000;
-
-       ev64260_reset_board((void *)0xfff00100);
-
-       while (i-- > 0);
-       panic("restart failed\n");
-}
-
-static void
-ev64260_halt(void)
-{
-       local_irq_disable();
-       while (1);
-       /* NOTREACHED */
-}
-
-static void
-ev64260_power_off(void)
-{
-       ev64260_halt();
-       /* NOTREACHED */
-}
-
-static int
-ev64260_show_cpuinfo(struct seq_file *m)
-{
-       uint pvid;
-
-       pvid = mfspr(PVR);
-       seq_printf(m, "vendor\t\t: " BOARD_VENDOR "\n");
-       seq_printf(m, "machine\t\t: " BOARD_MACHINE "\n");
-       seq_printf(m, "cpu MHz\t\t: %d\n", ev64260_get_cpu_speed()/1000/1000);
-       seq_printf(m, "bus MHz\t\t: %d\n", ev64260_get_bus_speed()/1000/1000);
-
-       return 0;
-}
-
-/* DS1501 RTC has too much variation to use RTC for calibration */
-static void __init
-ev64260_calibrate_decr(void)
-{
-       ulong freq;
-
-       freq = ev64260_get_bus_speed()/4;
-
-       printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
-              freq/1000000, freq%1000000);
-
-       tb_ticks_per_jiffy = freq / HZ;
-       tb_to_us = mulhwu_scale_factor(freq, 1000000);
-
-       return;
-}
-
-#if 0  /* XXXX */
-#ifdef CONFIG_USE_PPCBOOT
-static void parse_ppcbootinfo(unsigned long r3,
-       unsigned long r4, unsigned long r5,
-       unsigned long r6, unsigned long r7)
-{
-    bd_t *bd=NULL;
-    char *cmdline_start=NULL;
-    int cmdline_len=0;
-
-    if(r3) {
-       if((r3 & 0xf0000000) == 0) r3 += KERNELBASE;
-       if((r3 & 0xf0000000) == KERNELBASE) {
-           bd=(void *)r3;
-
-           /* hack for ppcboot loaders that report freqs in Mhz */
-           if(bd->bi_intfreq<1000000) bd->bi_intfreq*=1000000;
-           if(bd->bi_busfreq<1000000) bd->bi_busfreq*=1000000;
-
-           memcpy(&ppcboot_bd,bd,sizeof(ppcboot_bd));
-           ppcboot_bd_valid=1;
-       }
-    }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-    if(r4 && r5 && r5>r4) {
-       if((r4 & 0xf0000000) == 0) r4 += KERNELBASE;
-       if((r5 & 0xf0000000) == 0) r5 += KERNELBASE;
-       if((r4 & 0xf0000000) == KERNELBASE) {
-           initrd_start=r4;
-           initrd_end=r5;
-           initrd_below_start_ok = 1;
-       }
-    }
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-    if(r6 && r7 && r7>r6) {
-       if((r6 & 0xf0000000) == 0) r6 += KERNELBASE;
-       if((r7 & 0xf0000000) == 0) r7 += KERNELBASE;
-       if((r6 & 0xf0000000) == KERNELBASE) {
-           cmdline_start=(void *)r6;
-           cmdline_len=(r7-r6);
-           strncpy(cmd_line,cmdline_start,cmdline_len);
-       }
-    }
-
-    if(ppcboot_bd_valid) {                     
-       printk("found bd_t @%p\n", bd);
-       printk("memstart=%08lx\n", bd->bi_memstart);
-       printk("memsize=%08lx\n", bd->bi_memsize);
-       printk("enetaddr=%02x%02x%02x%02x%02x%02x\n",
-               bd->bi_enetaddr[0],
-               bd->bi_enetaddr[1],
-               bd->bi_enetaddr[2],
-               bd->bi_enetaddr[3],
-               bd->bi_enetaddr[4],
-               bd->bi_enetaddr[5]
-               );
-       printk("intfreq=%ld\n", bd->bi_intfreq);
-       printk("busfreq=%ld\n", bd->bi_busfreq);
-       printk("baudrate=%ld\n", bd->bi_baudrate);
-    }
-
-#ifdef CONFIG_BLK_DEV_INITRD
-    if(initrd_start) {
-       printk("found initrd @%lx-%lx\n", initrd_start, initrd_end);
-    }
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-    if(cmdline_start && cmdline_len) {
-       printk("found cmdline: '%s'\n", cmd_line);
-    }
-}
-#endif /* USE PPC_BOOT */
-#endif
-
-#if 0  /* XXXX */
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-static int
-ev64260_ide_check_region(ide_ioreg_t from, unsigned int extent)
-{
-        return check_region(from, extent);
-}
-
-static void
-ev64260_ide_request_region(ide_ioreg_t from,
-                        unsigned int extent,
-                        const char *name)
-{
-        request_region(from, extent, name);
-       return;
-}
-
-static void
-ev64260_ide_release_region(ide_ioreg_t from,
-                        unsigned int extent)
-{
-        release_region(from, extent);
-       return;
-}
-
-static void __init
-ev64260_ide_pci_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
-                ide_ioreg_t ctrl_port, int *irq)
-{
-       struct pci_dev  *dev;
-#if 1 /* NTL */
-        int i;
-
-       //printk("regs %d to %d @ 0x%x\n", IDE_DATA_OFFSET, IDE_STATUS_OFFSET, data_port);
-        for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-                hw->io_ports[i] = data_port;
-                data_port++;
-        }
-
-       //printk("ctrl %d @ 0x%x\n", IDE_CONTROL_OFFSET, ctrl_port);
-        hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
-#endif
-
-       pci_for_each_dev(dev) {
-               if (((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) ||
-                   ((dev->class >> 8) == PCI_CLASS_STORAGE_RAID)) {
-                       hw->irq = dev->irq;
-
-                       if (irq != NULL) {
-                               *irq = dev->irq;
-                       }
-               }
-       }
-
-       return;
-}
-#endif
-#endif
-
-#if !defined(CONFIG_USE_PPCBOOT)
-/*
- * Set BAT 3 to map 0xfb000000 to 0xfc000000 of physical memory space.
- */
-static __inline__ void
-ev64260_set_bat(void)
-{
-       mb();
-       mtspr(DBAT1U, 0xfb0001fe);
-       mtspr(DBAT1L, 0xfb00002a);
-       mb();
-
-       return;
-}
-#endif
-
-#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
-static void __init
-ev64260_map_io(void)
-{
-       io_block_mapping(0xfb000000, 0xfb000000, 0x01000000, _PAGE_IO);
-}
-#endif
-
-void __init
-platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
-             unsigned long r6, unsigned long r7)
-{
-#ifdef CONFIG_BLK_DEV_INITRD
-       extern int      initrd_below_start_ok;
-
-       initrd_start=initrd_end=0;
-       initrd_below_start_ok=0;
-#endif /* CONFIG_BLK_DEV_INITRD */
-
-       ppcboot_bd_valid=0;
-       memset(&ppcboot_bd,0,sizeof(ppcboot_bd));
-
-#ifdef CONFIG_USE_PPCBOOT
-       parse_ppcbootinfo(r3, r4, r5, r6, r7);
-#else
-       parse_bootinfo(find_bootinfo());
-#endif
-
-       isa_mem_base = 0;
-       isa_io_base = 0xa0000000;       /* XXXX */
-       pci_dram_offset = 0x80000000;   /* XXXX */
-
-       loops_per_jiffy = ev64260_get_cpu_speed() / HZ;
-
-       ppc_md.setup_arch = ev64260_setup_arch;
-       ppc_md.show_cpuinfo = ev64260_show_cpuinfo;
-       ppc_md.init_IRQ = gt64260_init_irq;
-       ppc_md.get_irq = gt64260_get_irq;
-
-       ppc_md.pcibios_fixup = ev64260_pci_fixups;
-
-       ppc_md.restart = ev64260_restart;
-       ppc_md.power_off = ev64260_power_off;
-       ppc_md.halt = ev64260_halt;
-
-       ppc_md.find_end_of_memory = ev64260_find_end_of_memory;
-
-       ppc_md.init = NULL;
-
-       ppc_md.time_init = todc_time_init;
-       ppc_md.set_rtc_time = todc_set_rtc_time;
-       ppc_md.get_rtc_time = todc_get_rtc_time;
-
-       ppc_md.nvram_read_val = todc_direct_read_val;
-       ppc_md.nvram_write_val = todc_direct_write_val;
-
-       ppc_md.calibrate_decr = ev64260_calibrate_decr;
-
-#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
-        ppc_ide_md.ide_init_hwif = ev64260_ide_pci_init_hwif_ports;
-#endif
-
-       bh.p_base = CONFIG_MV64X60_NEW_BASE;
-
-#if !defined(CONFIG_USE_PPCBOOT)
-       ev64260_set_bat();
-#endif
-
-#ifdef CONFIG_SERIAL_8250
-#if defined(CONFIG_SERIAL_TEXT_DEBUG)
-       ppc_md.setup_io_mappings = ev64260_map_io;
-       ppc_md.progress = gen550_progress;
-#endif
-#if defined(CONFIG_KGDB)
-       ppc_md.setup_io_mappings = ev64260_map_io;
-       ppc_md.early_serial_map = ev64260_early_serial_map;
-#endif
-#elif defined(CONFIG_SERIAL_MPSC_CONSOLE)
-#ifdef CONFIG_SERIAL_TEXT_DEBUG
-       ppc_md.setup_io_mappings = ev64260_map_io;
-       ppc_md.progress = gt64260_mpsc_progress;
-#endif /* CONFIG_SERIAL_TEXT_DEBUG */
-#ifdef CONFIG_KGDB
-       ppc_md.setup_io_mappings = ev64260_map_io;
-       ppc_md.early_serial_map = ev64260_early_serial_map;
-#endif /* CONFIG_KGDB */
-
-#endif
-
-       return;
-}
index 156bfa8..bc826d6 100644 (file)
 /*
  * arch/ppc/platforms/ev64260.h
- * 
+ *
  * Definitions for Marvell/Galileo EV-64260-BP Evaluation Board.
  *
  * Author: Mark A. Greer <mgreer@mvista.com>
  *
- * 2001-2002 (c) MontaVista, Software, Inc.  This file is licensed under
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
  * the terms of the GNU General Public License version 2.  This program
  * is licensed "as is" without any warranty of any kind, whether express
  * or implied.
  */
 
 /*
- * The MV64x60 has 2 PCI buses each with 1 window from the CPU bus to
+ * The GT64260 has 2 PCI buses each with 1 window from the CPU bus to
  * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
  * We'll only use one PCI MEM window on each PCI bus.
- *
- * This is the CPU physical memory map (windows must be at least 1MB and start
- * on a boundary that is a multiple of the window size):
- *
- *     0xfc000000-0xffffffff           - External FLASH on device module
- *     0xfbf00000-0xfbffffff           - Embedded (on board) FLASH
- *     0xfbe00000-0xfbefffff           - GT64260 Registers (preferably)
- *                                       but really a config option
- *     0xfbd00000-0xfbdfffff           - External SRAM on device module
- *     0xfbc00000-0xfbcfffff           - TODC chip on device module
- *     0xfbb00000-0xfbbfffff           - External UART on device module
- *     0xa2000000-0xfbafffff           - <hole>
- *     0xa1000000-0xa1ffffff           - PCI 1 I/O (defined in gt64260.h)
- *     0xa0000000-0xa0ffffff           - PCI 0 I/O (defined in gt64260.h)
- *     0x90000000-0x9fffffff           - PCI 1 MEM (defined in gt64260.h)
- *     0x80000000-0x8fffffff           - PCI 0 MEM (defined in gt64260.h)
  */
 
 #ifndef __PPC_PLATFORMS_EV64260_H
 #define __PPC_PLATFORMS_EV64260_H
 
-#ifndef        MAX
-#define        MAX(a,b)        (((a) > (b)) ? (a) : (b))
-#endif
-
-/*
- * CPU Physical Memory Map setup.
- */
-#define        EV64260_EXT_FLASH_BASE          0xfc000000
-#define        EV64260_EMB_FLASH_BASE          0xfbf00000
-#define        EV64260_EXT_SRAM_BASE           0xfbd00000
-#define        EV64260_TODC_BASE               0xfbc00000
-#define        EV64260_UART_BASE               0xfbb00000
+#define        EV64260_BRIDGE_REG_BASE         0xf8000000
+#define        EV64260_BRIDGE_REG_BASE_TO_TOP  0x08000000U
 
-#define        EV64260_EXT_FLASH_SIZE_ACTUAL   0x04000000  /* <= 64MB Extern FLASH */
-#define        EV64260_EMB_FLASH_SIZE_ACTUAL   0x00080000  /* 512KB of Embed FLASH */
-#define        EV64260_EXT_SRAM_SIZE_ACTUAL    0x00100000  /* 1MB SDRAM */
-#define        EV64260_TODC_SIZE_ACTUAL        0x00000020  /* 32 bytes for TODC */
-#define        EV64260_UART_SIZE_ACTUAL        0x00000040  /* 64 bytes for DUART */
-
-#define        EV64260_EXT_FLASH_SIZE          MAX(GT64260_WINDOW_SIZE_MIN,    \
-                                               EV64260_EXT_FLASH_SIZE_ACTUAL)
-#define        EV64260_EMB_FLASH_SIZE          MAX(GT64260_WINDOW_SIZE_MIN,    \
-                                               EV64260_EMB_FLASH_SIZE_ACTUAL)
-#define        EV64260_EXT_SRAM_SIZE           MAX(GT64260_WINDOW_SIZE_MIN,    \
-                                               EV64260_EXT_SRAM_SIZE_ACTUAL)
-#define        EV64260_TODC_SIZE               MAX(GT64260_WINDOW_SIZE_MIN,    \
-                                               EV64260_TODC_SIZE_ACTUAL)
-#if 0  /* XXXX blows up assembler in bootloader */
-#define        EV64260_UART_SIZE               MAX(GT64260_WINDOW_SIZE_MIN,    \
-                                               EV64260_UART_SIZE_ACTUAL)
-#else
-#define        EV64260_UART_SIZE               GT64260_WINDOW_SIZE_MIN
-#endif
-#define        EV64260_UART_END                ((EV64260_UART_BASE +           \
-                                       EV64260_UART_SIZE - 1) & 0xfff00000)
-
-/*
- * Board-specific IRQ info
- */
-#define        EV64260_UART_0_IRQ              85
-#define        EV64260_UART_1_IRQ              86
-#define        EV64260_PCI_0_IRQ               91
-#define        EV64260_PCI_1_IRQ               93
+#define        EV64260_TODC_BASE               0xfc800000
+#define        EV64260_TODC_LEN                0x00800000
+#define        EV64260_TODC_END                (EV64260_TODC_BASE + \
+                                        EV64260_TODC_LEN - 1)
 
-/*
- * Serial port setup.
- */
-#define        EV64260_DEFAULT_BAUD            115200
-
-#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
-#define SERIAL_PORT_DFNS
-
-#define        EV64260_MPSC_CLK_SRC            8               /* TCLK */
-#define        EV64260_MPSC_CLK_FREQ           100000000       /* 100MHz clk */
-#else
+#define        EV64260_UART_BASE               0xfd000000
+#define        EV64260_UART_LEN                0x00800000
+#define        EV64260_UART_END                (EV64260_UART_BASE + \
+                                        EV64260_UART_LEN - 1)
+/* Serial driver setup.  */
 #define EV64260_SERIAL_0               (EV64260_UART_BASE + 0x20)
 #define EV64260_SERIAL_1               EV64260_UART_BASE
 
-#define BASE_BAUD      (EV64260_DEFAULT_BAUD * 2)
+#define BASE_BAUD ( 3686400 / 16 )
 
 #ifdef CONFIG_SERIAL_MANY_PORTS
 #define RS_TABLE_SIZE  64
 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_SKIP_TEST)
 #endif
 
+#if    !defined(CONFIG_GT64260_CONSOLE)
 /* Required for bootloader's ns16550.c code */
 #define STD_SERIAL_PORT_DFNS                                           \
-        { 0, BASE_BAUD, EV64260_SERIAL_0, EV64260_UART_0_IRQ, STD_COM_FLAGS, \
-       iomem_base: (u8 *)EV64260_SERIAL_0,     /* ttyS0 */             \
-       iomem_reg_shift: 2,                                             \
-       io_type: SERIAL_IO_MEM },                                       
-
-#if 0
-        { 1, BASE_BAUD, EV64260_SERIAL_1, EV64260_UART_1_IRQ, STD_COM_FLAGS, \
-       iomem_base: (u8 *)EV64260_SERIAL_1,     /* ttyS1 */             \
+        { 0, BASE_BAUD, EV64260_SERIAL_0, 85, STD_COM_FLAGS, /* ttyS0 */\
+       iomem_base: (u8 *)EV64260_SERIAL_0,                             \
        iomem_reg_shift: 2,                                             \
        io_type: SERIAL_IO_MEM },
-#endif
 
 #define SERIAL_PORT_DFNS \
         STD_SERIAL_PORT_DFNS
+#else
+#define SERIAL_PORT_DFNS
 #endif
+
 #endif /* __PPC_PLATFORMS_EV64260_H */
diff --git a/arch/ppc/platforms/ev64260_setup.c b/arch/ppc/platforms/ev64260_setup.c
new file mode 100644 (file)
index 0000000..a5b75f5
--- /dev/null
@@ -0,0 +1,476 @@
+/*
+ * arch/ppc/platforms/ev64260_setup.c
+ *
+ * Board setup routines for the Marvell/Galileo EV-64260-BP Evaluation Board.
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+/*
+ * The EV-64260-BP port is the result of hard work from many people from
+ * many companies.  In particular, employees of Marvell/Galileo, Mission
+ * Critical Linux, Xyterra, and MontaVista Software were heavily involved.
+ */
+#include <linux/config.h>
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/initrd.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/ide.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#if    !defined(CONFIG_GT64260_CONSOLE)
+#include <linux/serial.h>
+#endif
+
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <asm/time.h>
+#include <asm/dma.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/smp.h>
+#include <asm/todc.h>
+#include <asm/bootinfo.h>
+#include <asm/gt64260.h>
+#include <platforms/ev64260.h>
+
+
+extern char cmd_line[];
+unsigned long ev64260_find_end_of_memory(void);
+
+TODC_ALLOC();
+
+/*
+ * Marvell/Galileo EV-64260-BP Evaluation Board PCI interrupt routing.
+ */
+static int __init
+ev64260_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
+{
+       struct pci_controller   *hose = pci_bus_to_hose(dev->bus->number);
+
+       if (hose->index == 0) {
+               static char pci_irq_table[][4] =
+               /*
+                *      PCI IDSEL/INTPIN->INTLINE
+                *         A   B   C   D
+                */
+               {
+                       { 91, 0, 0, 0 },        /* IDSEL 7 - PCI bus 0 */
+                       { 91, 0, 0, 0 },        /* IDSEL 8 - PCI bus 0 */
+               };
+
+               const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
+               return PCI_IRQ_TABLE_LOOKUP;
+       }
+       else {
+               static char pci_irq_table[][4] =
+               /*
+                *      PCI IDSEL/INTPIN->INTLINE
+                *         A   B   C   D
+                */
+               {
+                       { 93, 0, 0, 0 },        /* IDSEL 7 - PCI bus 1 */
+                       { 93, 0, 0, 0 },        /* IDSEL 8 - PCI bus 1 */
+               };
+
+               const long min_idsel = 7, max_idsel = 8, irqs_per_slot = 4;
+               return PCI_IRQ_TABLE_LOOKUP;
+       }
+}
+
+static void __init
+ev64260_setup_bridge(void)
+{
+       gt64260_bridge_info_t           info;
+       int                             window;
+
+       GT64260_BRIDGE_INFO_DEFAULT(&info, ev64260_find_end_of_memory());
+
+       /* Lookup PCI host bridges */
+       if (gt64260_find_bridges(EV64260_BRIDGE_REG_BASE,
+                                &info,
+                                ev64260_map_irq)) {
+               printk("Bridge initialization failed.\n");
+       }
+
+       /*
+        * Enabling of PCI internal-vs-external arbitration
+        * is a platform- and errata-dependent decision.
+        */
+       if(gt64260_revision == GT64260)  {
+               /* FEr#35 */
+               gt_clr_bits(GT64260_PCI_0_ARBITER_CNTL, (1<<31));
+               gt_clr_bits(GT64260_PCI_1_ARBITER_CNTL, (1<<31));
+       } else if( gt64260_revision == GT64260A )  {
+               gt_set_bits(GT64260_PCI_0_ARBITER_CNTL, (1<<31));
+               gt_set_bits(GT64260_PCI_1_ARBITER_CNTL, (1<<31));
+               /* Make external GPP interrupts level sensitive */
+               gt_set_bits(GT64260_COMM_ARBITER_CNTL, (1<<10));
+               /* Doc Change 9: > 100 MHz so must be set */
+               gt_set_bits(GT64260_CPU_CONFIG, (1<<23));
+       }
+
+       gt_set_bits(GT64260_CPU_MASTER_CNTL, (1<<9)); /* Only 1 cpu */
+
+       /* SCS windows not disabled above, disable all but SCS 0 */
+       for (window=1; window<GT64260_CPU_SCS_DECODE_WINDOWS; window++) {
+               gt64260_cpu_scs_set_window(window, 0, 0);
+       }
+
+       /* Set up windows to RTC/TODC and DUART on device module (CS 1 & 2) */
+       gt64260_cpu_cs_set_window(1, EV64260_TODC_BASE, EV64260_TODC_LEN);
+       gt64260_cpu_cs_set_window(2, EV64260_UART_BASE, EV64260_UART_LEN);
+
+       /*
+        * The EV-64260-BP uses several Multi-Purpose Pins (MPP) on the 64260
+        * bridge as interrupt inputs (via the General Purpose Ports (GPP)
+        * register).  Need to route the MPP inputs to the GPP and set the
+        * polarity correctly.
+        *
+        * In MPP Control 2 Register
+        *   MPP 21 -> GPP 21 (DUART channel A intr)
+        *   MPP 22 -> GPP 22 (DUART channel B intr)
+        *
+        * In MPP Control 3 Register
+        *   MPP 27 -> GPP 27 (PCI 0 INTA)
+        *   MPP 29 -> GPP 29 (PCI 1 INTA)
+        */
+       gt_clr_bits(GT64260_MPP_CNTL_2,
+                              ((1<<20) | (1<<21) | (1<<22) | (1<<23) |
+                               (1<<24) | (1<<25) | (1<<26) | (1<<27)));
+
+       gt_clr_bits(GT64260_MPP_CNTL_3,
+                              ((1<<12) | (1<<13) | (1<<14) | (1<<15) |
+                               (1<<20) | (1<<21) | (1<<22) | (1<<23)));
+
+       gt_write(GT64260_GPP_LEVEL_CNTL, 0x000002c6);
+
+       /* DUART & PCI interrupts are active low */
+       gt_set_bits(GT64260_GPP_LEVEL_CNTL,
+                            ((1<<21) | (1<<22) | (1<<27) | (1<<29)));
+
+       /* Clear any pending interrupts for these inputs and enable them. */
+       gt_write(GT64260_GPP_INTR_CAUSE,
+                         ~((1<<21) | (1<<22) | (1<<27) | (1<<29)));
+       gt_set_bits(GT64260_GPP_INTR_MASK,
+                            ((1<<21) | (1<<22)| (1<<27) | (1<<29)));
+       gt_set_bits(GT64260_IC_CPU_INTR_MASK_HI, ((1<<26) | (1<<27)));
+
+       /* Set MPSC Multiplex RMII */
+       /* NOTE: ethernet driver modifies bit 0 and 1 */
+       gt_write(GT64260_MPP_SERIAL_PORTS_MULTIPLEX, 0x00001102);
+
+       return;
+}
+
+
+static void __init
+ev64260_setup_arch(void)
+{
+#if    !defined(CONFIG_GT64260_CONSOLE)
+       struct serial_struct    serial_req;
+#endif
+
+       if ( ppc_md.progress )
+               ppc_md.progress("ev64260_setup_arch: enter", 0);
+
+       loops_per_jiffy = 50000000 / HZ;
+
+#ifdef CONFIG_BLK_DEV_INITRD
+       if (initrd_start)
+               ROOT_DEV = Root_RAM0;
+       else
+#endif
+#ifdef CONFIG_ROOT_NFS
+               ROOT_DEV = Root_NFS;
+#else
+               ROOT_DEV = Root_SDA2;
+#endif
+
+       if ( ppc_md.progress )
+               ppc_md.progress("ev64260_setup_arch: find_bridges", 0);
+
+       /*
+        * Set up the L2CR register.
+        * L2 cache was invalidated by bootloader.
+        */
+       switch (PVR_VER(mfspr(PVR))) {
+               case PVR_VER(PVR_750):
+                       _set_L2CR(0xfd100000);
+                       break;
+               case PVR_VER(PVR_7400):
+               case PVR_VER(PVR_7410):
+                       _set_L2CR(0xcd100000);
+                       break;
+               /* case PVR_VER(PVR_7450): */
+                       /* XXXX WHAT VALUE?? FIXME */
+                       break;
+       }
+
+       ev64260_setup_bridge();
+
+       TODC_INIT(TODC_TYPE_DS1501, 0, 0, ioremap(EV64260_TODC_BASE,0x20), 8);
+
+#if    !defined(CONFIG_GT64260_CONSOLE)
+       memset(&serial_req, 0, sizeof(serial_req));
+       serial_req.line = 0;
+       serial_req.baud_base = BASE_BAUD;
+       serial_req.port = 0;
+       serial_req.irq = 85;
+       serial_req.flags = STD_COM_FLAGS;
+       serial_req.io_type = SERIAL_IO_MEM;
+       serial_req.iomem_base = ioremap(EV64260_SERIAL_0, 0x20);
+       serial_req.iomem_reg_shift = 2;
+
+       if (early_serial_setup(&serial_req) != 0) {
+               printk("Early serial init of port 0 failed\n");
+       }
+
+       /* Assume early_serial_setup() doesn't modify serial_req */
+       serial_req.line = 1;
+       serial_req.port = 1;
+       serial_req.irq = 86;
+       serial_req.iomem_base = ioremap(EV64260_SERIAL_1, 0x20);
+
+       if (early_serial_setup(&serial_req) != 0) {
+               printk("Early serial init of port 1 failed\n");
+       }
+#endif
+
+       printk("Marvell/Galileo EV-64260-BP Evaluation Board\n");
+       printk("EV-64260-BP port (C) 2001 MontaVista Software, Inc. (source@mvista.com)\n");
+
+       if ( ppc_md.progress )
+               ppc_md.progress("ev64260_setup_arch: exit", 0);
+
+       return;
+}
+
+static void __init
+ev64260_init_irq(void)
+{
+       gt64260_init_irq();
+
+       if(gt64260_revision != GT64260)  {
+               /* XXXX Kludge--need to fix gt64260_init_irq() interface */
+               /* Mark PCI intrs level sensitive */
+               irq_desc[91].status |= IRQ_LEVEL;
+               irq_desc[93].status |= IRQ_LEVEL;
+       }
+}
+
+unsigned long __init
+ev64260_find_end_of_memory(void)
+{
+       return 32*1024*1024;    /* XXXX FIXME */
+}
+
+static void
+ev64260_reset_board(void)
+{
+       local_irq_disable();
+
+       /* Set exception prefix high - to the firmware */
+       _nmask_and_or_msr(0, MSR_IP);
+
+       /* XXX FIXME */
+       printk("XXXX **** trying to reset board ****\n");
+       return;
+}
+
+static void
+ev64260_restart(char *cmd)
+{
+       volatile ulong  i = 10000000;
+
+       ev64260_reset_board();
+
+       while (i-- > 0);
+       panic("restart failed\n");
+}
+
+static void
+ev64260_halt(void)
+{
+       local_irq_disable();
+       while (1);
+       /* NOTREACHED */
+}
+
+static void
+ev64260_power_off(void)
+{
+       ev64260_halt();
+       /* NOTREACHED */
+}
+
+static int
+ev64260_show_cpuinfo(struct seq_file *m)
+{
+       uint pvid;
+
+       pvid = mfspr(PVR);
+       seq_printf(m, "vendor\t\t: Marvell/Galileo\n");
+       seq_printf(m, "machine\t\t: EV-64260-BP\n");
+       seq_printf(m, "PVID\t\t: 0x%x, vendor: %s\n",
+                       pvid, (pvid & (1<<15) ? "IBM" : "Motorola"));
+
+       return 0;
+}
+
+/* DS1501 RTC has too much variation to use RTC for calibration */
+static void __init
+ev64260_calibrate_decr(void)
+{
+       ulong freq;
+
+       freq = 100000000 / 4;
+
+       printk("time_init: decrementer frequency = %lu.%.6lu MHz\n",
+              freq/1000000, freq%1000000);
+
+       tb_ticks_per_jiffy = freq / HZ;
+       tb_to_us = mulhwu_scale_factor(freq, 1000000);
+
+       return;
+}
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG)
+/*
+ * Set BAT 3 to map 0xf0000000 to end of physical memory space.
+ */
+static __inline__ void
+ev64260_set_bat(void)
+{
+       unsigned long   bat3u, bat3l;
+       static int      mapping_set = 0;
+
+       if (!mapping_set) {
+
+               __asm__ __volatile__(
+               " lis %0,0xf000\n \
+                 ori %1,%0,0x002a\n \
+                 ori %0,%0,0x1ffe\n \
+                 mtspr 0x21e,%0\n \
+                 mtspr 0x21f,%1\n \
+                 isync\n \
+                 sync "
+               : "=r" (bat3u), "=r" (bat3l));
+
+               mapping_set = 1;
+       }
+
+       return;
+}
+
+#if !defined(CONFIG_GT64260_CONSOLE)
+#include <linux/serialP.h>
+#include <linux/serial_reg.h>
+#include <asm/serial.h>
+
+static struct serial_state rs_table[RS_TABLE_SIZE] = {
+       SERIAL_PORT_DFNS        /* Defined in <asm/serial.h> */
+};
+
+static void
+ev64260_16550_progress(char *s, unsigned short hex)
+{
+       volatile char c;
+       volatile unsigned long com_port;
+       u16 shift;
+
+       com_port = rs_table[0].port;
+       shift = rs_table[0].iomem_reg_shift;
+
+       while ((c = *s++) != 0) {
+               while ((*((volatile unsigned char *)com_port +
+                               (UART_LSR << shift)) & UART_LSR_THRE) == 0)
+                               ;
+               *(volatile unsigned char *)com_port = c;
+
+               if (c == '\n') {
+                       while ((*((volatile unsigned char *)com_port +
+                               (UART_LSR << shift)) & UART_LSR_THRE) == 0)
+                                       ;
+                       *(volatile unsigned char *)com_port = '\r';
+               }
+       }
+
+       /* Move to next line on */
+       while ((*((volatile unsigned char *)com_port +
+               (UART_LSR << shift)) & UART_LSR_THRE) == 0)
+                       ;
+       *(volatile unsigned char *)com_port = '\n';
+       while ((*((volatile unsigned char *)com_port +
+               (UART_LSR << shift)) & UART_LSR_THRE) == 0)
+                       ;
+       *(volatile unsigned char *)com_port = '\r';
+
+       return;
+}
+#endif /* !CONFIG_GT64260_CONSOLE */
+#endif /* CONFIG_SERIAL_TEXT_DEBUG */
+
+void __init
+platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+             unsigned long r6, unsigned long r7)
+{
+       parse_bootinfo(find_bootinfo());
+
+       isa_mem_base = 0;
+
+       ppc_md.setup_arch = ev64260_setup_arch;
+       ppc_md.show_cpuinfo = ev64260_show_cpuinfo;
+       ppc_md.irq_canonicalize = NULL;
+       ppc_md.init_IRQ = ev64260_init_irq;
+       ppc_md.get_irq = gt64260_get_irq;
+       ppc_md.init = NULL;
+
+       ppc_md.restart = ev64260_restart;
+       ppc_md.power_off = ev64260_power_off;
+       ppc_md.halt = ev64260_halt;
+
+       ppc_md.find_end_of_memory = ev64260_find_end_of_memory;
+
+       ppc_md.time_init = todc_time_init;
+       ppc_md.set_rtc_time = todc_set_rtc_time;
+       ppc_md.get_rtc_time = todc_get_rtc_time;
+       ppc_md.calibrate_decr = ev64260_calibrate_decr;
+
+       ppc_md.nvram_read_val = todc_direct_read_val;
+       ppc_md.nvram_write_val = todc_direct_write_val;
+
+       ppc_md.heartbeat = NULL;
+       ppc_md.heartbeat_reset = 0;
+       ppc_md.heartbeat_count = 0;
+
+#ifdef CONFIG_SERIAL_TEXT_DEBUG
+       ev64260_set_bat();
+#ifdef CONFIG_GT64260_CONSOLE
+       gt64260_base = EV64260_BRIDGE_REG_BASE;
+       ppc_md.progress = gt64260_mpsc_progress; /* embedded UART */
+#else
+       ppc_md.progress = ev64260_16550_progress; /* Dev module DUART */
+#endif
+#else  /* !CONFIG_SERIAL_TEXT_DEBUG */
+       ppc_md.progress = NULL;
+#endif /* CONFIG_SERIAL_TEXT_DEBUG */
+
+       return;
+}
index b26c7e1..5b2221a 100644 (file)
@@ -469,6 +469,7 @@ static int __pmac pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
 static int __pmac pmac_cpufreq_init_7447A(struct device_node *cpunode)
 {
        struct device_node *volt_gpio_np;
+       u32 *reg;
 
        /* OF only reports the high frequency */
        hi_freq = cur_freq;
@@ -484,7 +485,7 @@ static int __pmac pmac_cpufreq_init_7447A(struct device_node *cpunode)
                return 1;
        }
 
-       u32 *reg = (u32 *)get_property(volt_gpio_np, "reg", NULL);
+       reg = (u32 *)get_property(volt_gpio_np, "reg", NULL);
        voltage_gpio = *reg;
        set_speed_proc = dfs_set_cpu_speed;
 
index fd46bb9..bebba87 100644 (file)
@@ -144,6 +144,22 @@ static void __pmac pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
        spin_unlock_irqrestore(&pmac_pic_lock, flags);
 }
 
+/* When an irq gets requested for the first client, if it's an
+ * edge interrupt, we clear any previous one on the controller
+ */
+static unsigned int __pmac pmac_startup_irq(unsigned int irq_nr)
+{
+        unsigned long bit = 1UL << (irq_nr & 0x1f);
+        int i = irq_nr >> 5;
+
+       if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
+               out_le32(&pmac_irq_hw[i]->ack, bit);
+        set_bit(irq_nr, ppc_cached_irq_mask);
+        pmac_set_irq_mask(irq_nr, 0);
+
+       return 0;
+}
+
 static void __pmac pmac_mask_irq(unsigned int irq_nr)
 {
         clear_bit(irq_nr, ppc_cached_irq_mask);
@@ -168,25 +184,21 @@ static void __pmac pmac_end_irq(unsigned int irq_nr)
 
 
 struct hw_interrupt_type pmac_pic = {
-        " PMAC-PIC ",
-        NULL,
-        NULL,
-        pmac_unmask_irq,
-        pmac_mask_irq,
-        pmac_mask_and_ack_irq,
-        pmac_end_irq,
-        NULL
+       .typename       = " PMAC-PIC ",
+       .startup        = pmac_startup_irq,
+       .enable         = pmac_unmask_irq,
+       .disable        = pmac_mask_irq,
+       .ack            = pmac_mask_and_ack_irq,
+       .end            = pmac_end_irq,
 };
 
 struct hw_interrupt_type gatwick_pic = {
-       " GATWICK  ",
-       NULL,
-       NULL,
-       pmac_unmask_irq,
-       pmac_mask_irq,
-       pmac_mask_and_ack_irq,
-       pmac_end_irq,
-       NULL
+       .typename       = " GATWICK  ",
+       .startup        = pmac_startup_irq,
+       .enable         = pmac_unmask_irq,
+       .disable        = pmac_mask_irq,
+       .ack            = pmac_mask_and_ack_irq,
+       .end            = pmac_end_irq,
 };
 
 static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
@@ -444,7 +456,7 @@ void __init pmac_pic_init(void)
                                        nmi_irq = pswitch->intrs[0].line;
                                        openpic_init_nmi_irq(nmi_irq);
                                        request_irq(nmi_irq, xmon_irq, 0,
-                                                   "NMI - XMON", 0);
+                                                   "NMI - XMON", NULL);
                                }
                        }
 #endif /* CONFIG_XMON */
@@ -542,7 +554,7 @@ void __init pmac_pic_init(void)
                for ( i = max_real_irqs ; i < max_irqs ; i++ )
                        irq_desc[i].handler = &gatwick_pic;
                request_irq( irq_cascade, gatwick_action, SA_INTERRUPT,
-                            "cascade", 0 );
+                            "cascade", NULL );
        }
        printk("System has %d possible interrupts\n", max_irqs);
        if (max_irqs != max_real_irqs)
@@ -550,7 +562,7 @@ void __init pmac_pic_init(void)
                        max_real_irqs);
 
 #ifdef CONFIG_XMON
-       request_irq(20, xmon_irq, 0, "NMI - XMON", 0);
+       request_irq(20, xmon_irq, 0, "NMI - XMON", NULL);
 #endif /* CONFIG_XMON */
 }
 
index 4362597..99acd51 100644 (file)
@@ -865,7 +865,7 @@ prep_init_IRQ(void)
                irq_desc[i].handler = &i8259_pic;
        /* If we have a Raven PCI bridge or a Hawk PCI bridge / Memory
         * controller, we poll (as they have a different int-ack address). */
-       early_read_config_dword(0, 0, 0, PCI_VENDOR_ID, &pci_viddid);
+       early_read_config_dword(NULL, 0, 0, PCI_VENDOR_ID, &pci_viddid);
        pci_did = (pci_viddid & 0xffff0000) >> 16;
        if (((pci_viddid & 0xffff) == PCI_VENDOR_ID_MOTOROLA)
                        && ((pci_did == PCI_DEVICE_ID_MOTOROLA_RAVEN)
diff --git a/arch/ppc/platforms/proc_rtas.c b/arch/ppc/platforms/proc_rtas.c
deleted file mode 100644 (file)
index f24f399..0000000
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- *   arch/ppc/platforms/proc_rtas.c
- *   Copyright (C) 2000 Tilmann Bitterberg
- *   (tilmann@bitterberg.de)
- *
- *   RTAS (Runtime Abstraction Services) stuff
- *   Intention is to provide a clean user interface
- *   to use the RTAS.
- *
- *   TODO:
- *   Split off a header file and maybe move it to a different
- *   location. Write Documentation on what the /proc/rtas/ entries
- *   actually do.
- */
-
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/proc_fs.h>
-#include <linux/stat.h>
-#include <linux/ctype.h>
-#include <linux/time.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-#include <asm/uaccess.h>
-#include <asm/bitops.h>
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <asm/prom.h>
-#include <asm/machdep.h> /* for ppc_md */
-#include <asm/time.h>
-
-/* Token for Sensors */
-#define KEY_SWITCH             0x0001
-#define ENCLOSURE_SWITCH       0x0002
-#define THERMAL_SENSOR         0x0003
-#define LID_STATUS             0x0004
-#define POWER_SOURCE           0x0005
-#define BATTERY_VOLTAGE                0x0006
-#define BATTERY_REMAINING      0x0007
-#define BATTERY_PERCENTAGE     0x0008
-#define EPOW_SENSOR            0x0009
-#define BATTERY_CYCLESTATE     0x000a
-#define BATTERY_CHARGING       0x000b
-
-/* IBM specific sensors */
-#define IBM_SURVEILLANCE       0x2328 /* 9000 */
-#define IBM_FANRPM             0x2329 /* 9001 */
-#define IBM_VOLTAGE            0x232a /* 9002 */
-#define IBM_DRCONNECTOR                0x232b /* 9003 */
-#define IBM_POWERSUPPLY                0x232c /* 9004 */
-#define IBM_INTQUEUE           0x232d /* 9005 */
-
-/* Status return values */
-#define SENSOR_CRITICAL_HIGH   13
-#define SENSOR_WARNING_HIGH    12
-#define SENSOR_NORMAL          11
-#define SENSOR_WARNING_LOW     10
-#define SENSOR_CRITICAL_LOW     9
-#define SENSOR_SUCCESS          0
-#define SENSOR_HW_ERROR                -1
-#define SENSOR_BUSY            -2
-#define SENSOR_NOT_EXIST       -3
-#define SENSOR_DR_ENTITY       -9000
-
-/* Location Codes */
-#define LOC_SCSI_DEV_ADDR      'A'
-#define LOC_SCSI_DEV_LOC       'B'
-#define LOC_CPU                        'C'
-#define LOC_DISKETTE           'D'
-#define LOC_ETHERNET           'E'
-#define LOC_FAN                        'F'
-#define LOC_GRAPHICS           'G'
-/* reserved / not used         'H' */
-#define LOC_IO_ADAPTER         'I'
-/* reserved / not used         'J' */
-#define LOC_KEYBOARD           'K'
-#define LOC_LCD                        'L'
-#define LOC_MEMORY             'M'
-#define LOC_NV_MEMORY          'N'
-#define LOC_MOUSE              'O'
-#define LOC_PLANAR             'P'
-#define LOC_OTHER_IO           'Q'
-#define LOC_PARALLEL           'R'
-#define LOC_SERIAL             'S'
-#define LOC_DEAD_RING          'T'
-#define LOC_RACKMOUNTED                'U' /* for _u_nit is rack mounted */
-#define LOC_VOLTAGE            'V'
-#define LOC_SWITCH_ADAPTER     'W'
-#define LOC_OTHER              'X'
-#define LOC_FIRMWARE           'Y'
-#define LOC_SCSI               'Z'
-
-/* Tokens for indicators */
-#define TONE_FREQUENCY         0x0001 /* 0 - 1000 (HZ)*/
-#define TONE_VOLUME            0x0002 /* 0 - 100 (%) */
-#define SYSTEM_POWER_STATE     0x0003
-#define WARNING_LIGHT          0x0004
-#define DISK_ACTIVITY_LIGHT    0x0005
-#define HEX_DISPLAY_UNIT       0x0006
-#define BATTERY_WARNING_TIME   0x0007
-#define CONDITION_CYCLE_REQUEST        0x0008
-#define SURVEILLANCE_INDICATOR 0x2328 /* 9000 */
-#define DR_ACTION              0x2329 /* 9001 */
-#define DR_INDICATOR           0x232a /* 9002 */
-/* 9003 - 9004: Vendor specific */
-#define GLOBAL_INTERRUPT_QUEUE 0x232d /* 9005 */
-/* 9006 - 9999: Vendor specific */
-
-/* other */
-#define MAX_SENSORS             17  /* I only know of 17 sensors */
-#define MAX_LINELENGTH          256
-#define SENSOR_PREFIX          "ibm,sensor-"
-#define cel_to_fahr(x)         ((x*9/5)+32)
-
-
-/* Globals */
-static struct proc_dir_entry *proc_rtas;
-static struct rtas_sensors sensors;
-static struct device_node *rtas;
-static unsigned long power_on_time = 0; /* Save the time the user set */
-static char progress_led[MAX_LINELENGTH];
-
-static unsigned long rtas_tone_frequency = 1000;
-static unsigned long rtas_tone_volume = 0;
-
-/* ****************STRUCTS******************************************* */
-struct individual_sensor {
-       unsigned int token;
-       unsigned int quant;
-};
-
-struct rtas_sensors {
-        struct individual_sensor sensor[MAX_SENSORS];
-       unsigned int quant;
-};
-
-/* ****************************************************************** */
-/* Declarations */
-static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
-               int count, int *eof, void *data);
-static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_clock_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_progress_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_poweron_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-
-static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-
-struct file_operations ppc_rtas_poweron_operations = {
-       .read =         ppc_rtas_poweron_read,
-       .write =        ppc_rtas_poweron_write
-};
-struct file_operations ppc_rtas_progress_operations = {
-       .read =         ppc_rtas_progress_read,
-       .write =        ppc_rtas_progress_write
-};
-
-struct file_operations ppc_rtas_clock_operations = {
-       .read =         ppc_rtas_clock_read,
-       .write =        ppc_rtas_clock_write
-};
-
-struct file_operations ppc_rtas_tone_freq_operations = {
-       .read =         ppc_rtas_tone_freq_read,
-       .write =        ppc_rtas_tone_freq_write
-};
-struct file_operations ppc_rtas_tone_volume_operations = {
-       .read =         ppc_rtas_tone_volume_read,
-       .write =        ppc_rtas_tone_volume_write
-};
-
-int ppc_rtas_find_all_sensors (void);
-int ppc_rtas_process_sensor(struct individual_sensor s, int state,
-               int error, char * buf);
-char * ppc_rtas_process_error(int error);
-int get_location_code(struct individual_sensor s, char * buf);
-int check_location_string (char *c, char * buf);
-int check_location (char *c, int idx, char * buf);
-
-/* ****************************************************************** */
-/* MAIN                                                               */
-/* ****************************************************************** */
-static int __init proc_rtas_init(void)
-{
-       struct proc_dir_entry *entry;
-
-       rtas = find_devices("rtas");
-       if ((rtas == 0) || (_machine != _MACH_chrp)) {
-               return 1;
-       }
-
-       proc_rtas = proc_mkdir("rtas", 0);
-       if (proc_rtas == 0)
-               return 1;
-
-       /* /proc/rtas entries */
-
-       entry = create_proc_entry("progress", S_IRUGO|S_IWUSR, proc_rtas);
-       if (entry) entry->proc_fops = &ppc_rtas_progress_operations;
-
-       entry = create_proc_entry("clock", S_IRUGO|S_IWUSR, proc_rtas);
-       if (entry) entry->proc_fops = &ppc_rtas_clock_operations;
-
-       entry = create_proc_entry("poweron", S_IWUSR|S_IRUGO, proc_rtas);
-       if (entry) entry->proc_fops = &ppc_rtas_poweron_operations;
-
-       create_proc_read_entry("sensors", S_IRUGO, proc_rtas,
-                       ppc_rtas_sensor_read, NULL);
-
-       entry = create_proc_entry("frequency", S_IWUSR|S_IRUGO, proc_rtas);
-       if (entry) entry->proc_fops = &ppc_rtas_tone_freq_operations;
-
-       entry = create_proc_entry("volume", S_IWUSR|S_IRUGO, proc_rtas);
-       if (entry) entry->proc_fops = &ppc_rtas_tone_volume_operations;
-
-       return 0;
-}
-__initcall(proc_rtas_init);
-
-/* ****************************************************************** */
-/* POWER-ON-TIME                                                      */
-/* ****************************************************************** */
-static ssize_t ppc_rtas_poweron_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
-{
-       struct rtc_time tm;
-       unsigned long nowtime;
-       char *dest;
-       int error;
-
-       nowtime = simple_strtoul(buf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_poweron_write: Invalid time\n");
-               return count;
-       }
-       power_on_time = nowtime; /* save the time */
-
-       to_tm(nowtime, &tm);
-
-       error = call_rtas("set-time-for-power-on", 7, 1, NULL,
-                       tm.tm_year, tm.tm_mon, tm.tm_mday,
-                       tm.tm_hour, tm.tm_min, tm.tm_sec, 0 /* nano */);
-       if (error != 0)
-               printk(KERN_WARNING "error: setting poweron time returned: %s\n",
-                               ppc_rtas_process_error(error));
-       return count;
-}
-/* ****************************************************************** */
-static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
-{
-       int n;
-       if (power_on_time == 0)
-               n = sprintf(buf, "Power on time not set\n");
-       else
-               n = sprintf(buf, "%lu\n", power_on_time);
-
-       if (*ppos >= strlen(buf))
-               return 0;
-       if (n > strlen(buf) - *ppos)
-               n = strlen(buf) - *ppos;
-       if (n > count)
-               n = count;
-       *ppos += n;
-       return n;
-}
-
-/* ****************************************************************** */
-/* PROGRESS                                                           */
-/* ****************************************************************** */
-static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
-{
-       unsigned long hex;
-
-       strcpy(progress_led, buf); /* save the string */
-       /* Lets see if the user passed hexdigits */
-       hex = simple_strtoul(buf, NULL, 10);
-
-       ppc_md.progress ((char *)buf, hex);
-       return count;
-
-       /* clear the line */ /* ppc_md.progress("                   ", 0xffff);*/
-}
-/* ****************************************************************** */
-static ssize_t ppc_rtas_progress_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
-{
-       int n = 0;
-       if (progress_led != NULL)
-               n = sprintf (buf, "%s\n", progress_led);
-       if (*ppos >= strlen(buf))
-               return 0;
-       if (n > strlen(buf) - *ppos)
-               n = strlen(buf) - *ppos;
-       if (n > count)
-               n = count;
-       *ppos += n;
-       return n;
-}
-
-/* ****************************************************************** */
-/* CLOCK                                                              */
-/* ****************************************************************** */
-static ssize_t ppc_rtas_clock_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
-{
-       struct rtc_time tm;
-       unsigned long nowtime;
-       char *dest;
-       int error;
-
-       nowtime = simple_strtoul(buf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_clock_write: Invalid time\n");
-               return count;
-       }
-
-       to_tm(nowtime, &tm);
-       error = call_rtas("set-time-of-day", 7, 1, NULL,
-                       tm.tm_year, tm.tm_mon, tm.tm_mday,
-                       tm.tm_hour, tm.tm_min, tm.tm_sec, 0);
-       if (error != 0)
-               printk(KERN_WARNING "error: setting the clock returned: %s\n",
-                               ppc_rtas_process_error(error));
-       return count;
-}
-/* ****************************************************************** */
-static ssize_t ppc_rtas_clock_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
-{
-       unsigned int year, mon, day, hour, min, sec;
-       unsigned long *ret = kmalloc(4*8, GFP_KERNEL);
-       int n, error;
-
-       error = call_rtas("get-time-of-day", 0, 8, ret);
-
-       year = ret[0]; mon  = ret[1]; day  = ret[2];
-       hour = ret[3]; min  = ret[4]; sec  = ret[5];
-
-       if (error != 0){
-               printk(KERN_WARNING "error: reading the clock returned: %s\n",
-                               ppc_rtas_process_error(error));
-               n = sprintf (buf, "0");
-       } else {
-               n = sprintf (buf, "%lu\n", mktime(year, mon, day, hour, min, sec));
-       }
-       kfree(ret);
-
-       if (*ppos >= strlen(buf))
-               return 0;
-       if (n > strlen(buf) - *ppos)
-               n = strlen(buf) - *ppos;
-       if (n > count)
-               n = count;
-       *ppos += n;
-       return n;
-}
-
-/* ****************************************************************** */
-/* SENSOR STUFF                                                       */
-/* ****************************************************************** */
-static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
-               int count, int *eof, void *data)
-{
-       int i,j,n;
-       unsigned long ret;
-       int state, error;
-       char buffer[MAX_LINELENGTH*MAX_SENSORS]; /* May not be enough */
-
-       if (count < 0)
-               return -EINVAL;
-
-       n  = sprintf ( buffer  , "RTAS (RunTime Abstraction Services) Sensor Information\n");
-       n += sprintf ( buffer+n, "Sensor\t\tValue\t\tCondition\tLocation\n");
-       n += sprintf ( buffer+n, "********************************************************\n");
-
-       if (ppc_rtas_find_all_sensors() != 0) {
-               n += sprintf ( buffer+n, "\nNo sensors are available\n");
-               goto return_string;
-       }
-
-       for (i=0; i<sensors.quant; i++) {
-               j = sensors.sensor[i].quant;
-               /* A sensor may have multiple instances */
-               while (j >= 0) {
-                       error = call_rtas("get-sensor-state", 2, 2, &ret,
-                                 sensors.sensor[i].token, sensors.sensor[i].quant-j);
-                       state = (int) ret;
-                       n += ppc_rtas_process_sensor(sensors.sensor[i], state, error, buffer+n );
-                       n += sprintf (buffer+n, "\n");
-                       j--;
-               } /* while */
-       } /* for */
-
-return_string:
-       if (off >= strlen(buffer)) {
-               *eof = 1;
-               return 0;
-       }
-       if (n > strlen(buffer) - off)
-               n = strlen(buffer) - off;
-       if (n > count)
-               n = count;
-       else
-               *eof = 1;
-       memcpy(buf, buffer + off, n);
-       *start = buf;
-       return n;
-}
-
-/* ****************************************************************** */
-
-int ppc_rtas_find_all_sensors (void)
-{
-       unsigned long *utmp;
-       int len, i, j;
-
-       utmp = (unsigned long *) get_property(rtas, "rtas-sensors", &len);
-       if (utmp == NULL) {
-               printk (KERN_ERR "error: could not get rtas-sensors\n");
-               return 1;
-       }
-
-       sensors.quant = len / 8;      /* int + int */
-
-       for (i=0, j=0; j<sensors.quant; i+=2, j++) {
-               sensors.sensor[j].token = utmp[i];
-               sensors.sensor[j].quant = utmp[i+1];
-       }
-       return 0;
-}
-
-/* ****************************************************************** */
-/*
- * Builds a string of what rtas returned
- */
-char * ppc_rtas_process_error(int error)
-{
-       switch (error) {
-               case SENSOR_CRITICAL_HIGH:
-                       return "(critical high)";
-               case SENSOR_WARNING_HIGH:
-                       return "(warning high)";
-               case SENSOR_NORMAL:
-                       return "(normal)";
-               case SENSOR_WARNING_LOW:
-                       return "(warning low)";
-               case SENSOR_CRITICAL_LOW:
-                       return "(critical low)";
-               case SENSOR_SUCCESS:
-                       return "(read ok)";
-               case SENSOR_HW_ERROR:
-                       return "(hardware error)";
-               case SENSOR_BUSY:
-                       return "(busy)";
-               case SENSOR_NOT_EXIST:
-                       return "(non existant)";
-               case SENSOR_DR_ENTITY:
-                       return "(dr entity removed)";
-               default:
-                       return "(UNKNOWN)";
-       }
-}
-
-/* ****************************************************************** */
-/*
- * Builds a string out of what the sensor said
- */
-
-int ppc_rtas_process_sensor(struct individual_sensor s, int state,
-               int error, char * buf)
-{
-       /* Defined return vales */
-       const char * key_switch[]        = { "Off\t", "Normal\t", "Secure\t", "Mainenance" };
-       const char * enclosure_switch[]  = { "Closed", "Open" };
-       const char * lid_status[]        = { " ", "Open", "Closed" };
-       const char * power_source[]      = { "AC\t", "Battery", "AC & Battery" };
-       const char * battery_remaining[] = { "Very Low", "Low", "Mid", "High" };
-       const char * epow_sensor[]       = {
-               "EPOW Reset", "Cooling warning", "Power warning",
-               "System shutdown", "System halt", "EPOW main enclosure",
-               "EPOW power off" };
-       const char * battery_cyclestate[]  = { "None", "In progress", "Requested" };
-       const char * battery_charging[]    = { "Charging", "Discharching", "No current flow" };
-       const char * ibm_drconnector[]     = { "Empty", "Present" };
-       const char * ibm_intqueue[]        = { "Disabled", "Enabled" };
-
-       int have_strings = 0;
-       int temperature = 0;
-       int unknown = 0;
-       int n = 0;
-
-       /* What kind of sensor do we have here? */
-       switch (s.token) {
-               case KEY_SWITCH:
-                       n += sprintf(buf+n, "Key switch:\t");
-                       n += sprintf(buf+n, "%s\t", key_switch[state]);
-                       have_strings = 1;
-                       break;
-               case ENCLOSURE_SWITCH:
-                       n += sprintf(buf+n, "Enclosure switch:\t");
-                       n += sprintf(buf+n, "%s\t", enclosure_switch[state]);
-                       have_strings = 1;
-                       break;
-               case THERMAL_SENSOR:
-                       n += sprintf(buf+n, "Temp. (°C/°F):\t");
-                       temperature = 1;
-                       break;
-               case LID_STATUS:
-                       n += sprintf(buf+n, "Lid status:\t");
-                       n += sprintf(buf+n, "%s\t", lid_status[state]);
-                       have_strings = 1;
-                       break;
-               case POWER_SOURCE:
-                       n += sprintf(buf+n, "Power source:\t");
-                       n += sprintf(buf+n, "%s\t", power_source[state]);
-                       have_strings = 1;
-                       break;
-               case BATTERY_VOLTAGE:
-                       n += sprintf(buf+n, "Battery voltage:\t");
-                       break;
-               case BATTERY_REMAINING:
-                       n += sprintf(buf+n, "Battery remaining:\t");
-                       n += sprintf(buf+n, "%s\t", battery_remaining[state]);
-                       have_strings = 1;
-                       break;
-               case BATTERY_PERCENTAGE:
-                       n += sprintf(buf+n, "Battery percentage:\t");
-                       break;
-               case EPOW_SENSOR:
-                       n += sprintf(buf+n, "EPOW Sensor:\t");
-                       n += sprintf(buf+n, "%s\t", epow_sensor[state]);
-                       have_strings = 1;
-                       break;
-               case BATTERY_CYCLESTATE:
-                       n += sprintf(buf+n, "Battery cyclestate:\t");
-                       n += sprintf(buf+n, "%s\t", battery_cyclestate[state]);
-                       have_strings = 1;
-                       break;
-               case BATTERY_CHARGING:
-                       n += sprintf(buf+n, "Battery Charging:\t");
-                       n += sprintf(buf+n, "%s\t", battery_charging[state]);
-                       have_strings = 1;
-                       break;
-               case IBM_SURVEILLANCE:
-                       n += sprintf(buf+n, "Surveillance:\t");
-                       break;
-               case IBM_FANRPM:
-                       n += sprintf(buf+n, "Fan (rpm):\t");
-                       break;
-               case IBM_VOLTAGE:
-                       n += sprintf(buf+n, "Voltage (mv):\t");
-                       break;
-               case IBM_DRCONNECTOR:
-                       n += sprintf(buf+n, "DR connector:\t");
-                       n += sprintf(buf+n, "%s\t", ibm_drconnector[state]);
-                       have_strings = 1;
-                       break;
-               case IBM_POWERSUPPLY:
-                       n += sprintf(buf+n, "Powersupply:\t");
-                       break;
-               case IBM_INTQUEUE:
-                       n += sprintf(buf+n, "Interrupt queue:\t");
-                       n += sprintf(buf+n, "%s\t", ibm_intqueue[state]);
-                       have_strings = 1;
-                       break;
-               default:
-                       n += sprintf(buf+n,  "Unkown sensor (type %d), ignoring it\n",
-                                       s.token);
-                       unknown = 1;
-                       have_strings = 1;
-                       break;
-       }
-       if (have_strings == 0) {
-               if (temperature) {
-                       n += sprintf(buf+n, "%4d /%4d\t", state, cel_to_fahr(state));
-               } else
-                       n += sprintf(buf+n, "%10d\t", state);
-       }
-       if (unknown == 0) {
-               n += sprintf ( buf+n, "%s\t", ppc_rtas_process_error(error));
-               n += get_location_code(s, buf+n);
-       }
-       return n;
-}
-
-/* ****************************************************************** */
-
-int check_location (char *c, int idx, char * buf)
-{
-       int n = 0;
-
-       switch (*(c+idx)) {
-               case LOC_PLANAR:
-                       n += sprintf ( buf, "Planar #%c", *(c+idx+1));
-                       break;
-               case LOC_CPU:
-                       n += sprintf ( buf, "CPU #%c", *(c+idx+1));
-                       break;
-               case LOC_FAN:
-                       n += sprintf ( buf, "Fan #%c", *(c+idx+1));
-                       break;
-               case LOC_RACKMOUNTED:
-                       n += sprintf ( buf, "Rack #%c", *(c+idx+1));
-                       break;
-               case LOC_VOLTAGE:
-                       n += sprintf ( buf, "Voltage #%c", *(c+idx+1));
-                       break;
-               case LOC_LCD:
-                       n += sprintf ( buf, "LCD #%c", *(c+idx+1));
-                       break;
-               case '.':
-                       n += sprintf ( buf, "- %c", *(c+idx+1));
-               default:
-                       n += sprintf ( buf, "Unknown location");
-                       break;
-       }
-       return n;
-}
-
-
-/* ****************************************************************** */
-/*
- * Format:
- * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ]
- * the '.' may be an abbrevation
- */
-int check_location_string (char *c, char *buf)
-{
-       int n=0,i=0;
-
-       while (c[i]) {
-               if (isalpha(c[i]) || c[i] == '.') {
-                        n += check_location(c, i, buf+n);
-               }
-               else if (c[i] == '/' || c[i] == '-')
-                       n += sprintf(buf+n, " at ");
-               i++;
-       }
-       return n;
-}
-
-
-/* ****************************************************************** */
-
-int get_location_code(struct individual_sensor s, char * buffer)
-{
-       char rstr[512], tmp[10], tmp2[10];
-       int n=0, i=0, llen, len;
-       /* char *buf = kmalloc(MAX_LINELENGTH, GFP_KERNEL); */
-       char *ret;
-
-       static int pos = 0; /* remember position where buffer was */
-
-       /* construct the sensor number like 0003 */
-       /* fill with zeros */
-       n = sprintf(tmp, "%d", s.token);
-       len = strlen(tmp);
-       while (strlen(tmp) < 4)
-               n += sprintf (tmp+n, "0");
-
-       /* invert the string */
-       while (tmp[i]) {
-               if (i<len)
-                       tmp2[4-len+i] = tmp[i];
-               else
-                       tmp2[3-i] = tmp[i];
-               i++;
-       }
-       tmp2[4] = '\0';
-
-       sprintf (rstr, SENSOR_PREFIX"%s", tmp2);
-
-       ret = (char *) get_property(rtas, rstr, &llen);
-
-       n=0;
-       if (ret[0] == '\0')
-               n += sprintf ( buffer+n, "--- ");/* does not have a location */
-       else {
-               char t[50];
-               ret += pos;
-
-               n += check_location_string(ret, buffer + n);
-               n += sprintf ( buffer+n, " ");
-               /* see how many characters we have printed */
-               sprintf ( t, "%s ", ret);
-
-               pos += strlen(t);
-               if (pos >= llen) pos=0;
-       }
-       return n;
-}
-/* ****************************************************************** */
-/* INDICATORS - Tone Frequency                                        */
-/* ****************************************************************** */
-static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
-{
-       unsigned long freq;
-       char *dest;
-       int error;
-       freq = simple_strtoul(buf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_tone_freq_write: Invalid tone freqency\n");
-               return count;
-       }
-       if (freq < 0) freq = 0;
-       rtas_tone_frequency = freq; /* save it for later */
-       error = call_rtas("set-indicator", 3, 1, NULL,
-                       TONE_FREQUENCY, 0, freq);
-       if (error != 0)
-               printk(KERN_WARNING "error: setting tone frequency returned: %s\n",
-                               ppc_rtas_process_error(error));
-       return count;
-}
-/* ****************************************************************** */
-static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
-{
-       int n;
-       n = sprintf(buf, "%lu\n", rtas_tone_frequency);
-
-       if (*ppos >= strlen(buf))
-               return 0;
-       if (n > strlen(buf) - *ppos)
-               n = strlen(buf) - *ppos;
-       if (n > count)
-               n = count;
-       *ppos += n;
-       return n;
-}
-/* ****************************************************************** */
-/* INDICATORS - Tone Volume                                           */
-/* ****************************************************************** */
-static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
-{
-       unsigned long volume;
-       char *dest;
-       int error;
-       volume = simple_strtoul(buf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_tone_volume_write: Invalid tone volume\n");
-               return count;
-       }
-       if (volume < 0) volume = 0;
-       if (volume > 100) volume = 100;
-
-        rtas_tone_volume = volume; /* save it for later */
-       error = call_rtas("set-indicator", 3, 1, NULL,
-                       TONE_VOLUME, 0, volume);
-       if (error != 0)
-               printk(KERN_WARNING "error: setting tone volume returned: %s\n",
-                               ppc_rtas_process_error(error));
-       return count;
-}
-/* ****************************************************************** */
-static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
-{
-       int n;
-       n = sprintf(buf, "%lu\n", rtas_tone_volume);
-
-       if (*ppos >= strlen(buf))
-               return 0;
-       if (n > strlen(buf) - *ppos)
-               n = strlen(buf) - *ppos;
-       if (n > count)
-               n = count;
-       *ppos += n;
-       return n;
-}
diff --git a/arch/ppc/platforms/rpxsuper.h b/arch/ppc/platforms/rpxsuper.h
deleted file mode 100644 (file)
index d826590..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * A collection of structures, addresses, and values associated with
- * the Embedded Planet RPX6 (or RPX Super) MPC8260 board.
- * Copied from the RPX-Classic and SBS8260 stuff.
- *
- * Copyright (c) 2001 Dan Malek <dan@embeddededge.com>
- */
-#ifdef __KERNEL__
-#ifndef __ASM_PLATFORMS_RPXSUPER_H__
-#define __ASM_PLATFORMS_RPXSUPER_H__
-
-/* A Board Information structure that is given to a program when
- * prom starts it up.
- */
-typedef struct bd_info {
-       unsigned int    bi_memstart;    /* Memory start address */
-       unsigned int    bi_memsize;     /* Memory (end) size in bytes */
-       unsigned int    bi_nvsize;      /* NVRAM size in bytes (can be 0) */
-       unsigned int    bi_intfreq;     /* Internal Freq, in Hz */
-       unsigned int    bi_busfreq;     /* Bus Freq, in MHz */
-       unsigned int    bi_cpmfreq;     /* CPM Freq, in MHz */
-       unsigned int    bi_brgfreq;     /* BRG Freq, in MHz */
-       unsigned int    bi_vco;         /* VCO Out from PLL */
-       unsigned int    bi_baudrate;    /* Default console baud rate */
-       unsigned int    bi_immr;        /* IMMR when called from boot rom */
-       unsigned char   bi_enetaddr[6];
-} bd_t;
-
-extern bd_t m8xx_board_info;
-
-/* Memory map is configured by the PROM startup.
- * We just map a few things we need.  The CSR is actually 4 byte-wide
- * registers that can be accessed as 8-, 16-, or 32-bit values.
- */
-#define CPM_MAP_ADDR           ((uint)0xf0000000)
-#define RPX_CSR_ADDR           ((uint)0xfa000000)
-#define RPX_CSR_SIZE           ((uint)(512 * 1024))
-#define RPX_NVRTC_ADDR         ((uint)0xfa080000)
-#define RPX_NVRTC_SIZE         ((uint)(512 * 1024))
-
-/* The RPX6 has 16, byte wide control/status registers.
- * Not all are used (yet).
- */
-extern volatile u_char *rpx6_csr_addr;
-
-/* Things of interest in the CSR.
-*/
-#define BCSR0_ID_MASK          ((u_char)0xf0)          /* Read only */
-#define BCSR0_SWITCH_MASK      ((u_char)0x0f)          /* Read only */
-#define BCSR1_XCVR_SMC1                ((u_char)0x80)
-#define BCSR1_XCVR_SMC2                ((u_char)0x40)
-#define BCSR2_FLASH_WENABLE    ((u_char)0x20)
-#define BCSR2_NVRAM_ENABLE     ((u_char)0x10)
-#define BCSR2_ALT_IRQ2         ((u_char)0x08)
-#define BCSR2_ALT_IRQ3         ((u_char)0x04)
-#define BCSR2_PRST             ((u_char)0x02)          /* Force reset */
-#define BCSR2_ENPRST           ((u_char)0x01)          /* Enable POR */
-#define BCSR3_MODCLK_MASK      ((u_char)0xe0)
-#define BCSR3_ENCLKHDR         ((u_char)0x10)
-#define BCSR3_LED5             ((u_char)0x04)          /* 0 == on */
-#define BCSR3_LED6             ((u_char)0x02)          /* 0 == on */
-#define BCSR3_LED7             ((u_char)0x01)          /* 0 == on */
-#define BCSR4_EN_PHY           ((u_char)0x80)          /* Enable PHY */
-#define BCSR4_EN_MII           ((u_char)0x40)          /* Enable PHY */
-#define BCSR4_MII_READ         ((u_char)0x04)
-#define BCSR4_MII_MDC          ((u_char)0x02)
-#define BCSR4_MII_MDIO         ((u_char)0x02)
-#define BCSR13_FETH_IRQMASK    ((u_char)0xf0)
-#define BCSR15_FETH_IRQ                ((u_char)0x20)
-
-#endif /* __ASM_PLATFORMS_RPXSUPER_H__ */
-#endif /* __KERNEL__ */
index fde6c4e..4de92f4 100644 (file)
@@ -2,16 +2,6 @@
 # Makefile for the linux kernel.
 #
 
-ifdef CONFIG_PPC64BRIDGE
-EXTRA_AFLAGS           := -Wa,-mppc64bridge
-endif
-ifdef CONFIG_4xx
-EXTRA_AFLAGS           := -Wa,-m405
-endif
-ifdef CONFIG_E500
-EXTRA_AFLAGS           := -Wa,-me500
-endif
-
 CFLAGS_prom_init.o      += -fPIC
 CFLAGS_btext.o          += -fPIC
 
@@ -25,7 +15,8 @@ ifeq ($(CONFIG_4xx),y)
 obj-$(CONFIG_4xx)              += ppc4xx_pic.o
 obj-$(CONFIG_40x)              += ppc4xx_setup.o
 obj-$(CONFIG_GEN_RTC)          += todc_time.o
-obj-$(CONFIG_KGDB)             += ppc4xx_kgdb.o
+obj-$(CONFIG_PPC4xx_DMA)       += ppc4xx_dma.o
+obj-$(CONFIG_PPC4xx_EDMA)      += ppc4xx_sgdma.o
 ifeq ($(CONFIG_40x),y)
 obj-$(CONFIG_KGDB)             += ppc4xx_kgdb.o
 obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o ppc405_pci.o
@@ -43,10 +34,9 @@ obj-$(CONFIG_PPC_PREP)               += open_pic.o indirect_pci.o i8259.o todc_time.o
 obj-$(CONFIG_ADIR)             += i8259.o indirect_pci.o pci_auto.o \
                                        todc_time.o
 obj-$(CONFIG_EBONY)            += indirect_pci.o pci_auto.o todc_time.o
-obj-$(CONFIG_EV64260)          += indirect_pci.o todc_time.o pci_auto.o
-obj-$(CONFIG_DMV182)           += indirect_pci.o todc_time.o pci_auto.o
+obj-$(CONFIG_EV64260)          += gt64260_common.o gt64260_pic.o \
+                                       indirect_pci.o todc_time.o pci_auto.o
 obj-$(CONFIG_GEMINI)           += open_pic.o indirect_pci.o
-obj-$(CONFIG_GT64260)          += gt64260_pic.o
 obj-$(CONFIG_K2)               += i8259.o indirect_pci.o todc_time.o \
                                        pci_auto.o
 obj-$(CONFIG_LOPEC)            += i8259.o pci_auto.o todc_time.o
@@ -54,8 +44,6 @@ obj-$(CONFIG_MCPN765)         += todc_time.o indirect_pci.o pci_auto.o \
                                        open_pic.o i8259.o hawk_common.o
 obj-$(CONFIG_MENF1)            += todc_time.o i8259.o mpc10x_common.o \
                                        pci_auto.o indirect_pci.o
-obj-$(CONFIG_MV64360)          += mv64360_pic.o
-obj-$(CONFIG_MV64X60)          += mv64x60.o mv64x60_ocp.o
 obj-$(CONFIG_MVME5100)         += open_pic.o todc_time.o indirect_pci.o \
                                        i8259.o pci_auto.o hawk_common.o
 obj-$(CONFIG_OCOTEA)           += indirect_pci.o pci_auto.o todc_time.o
@@ -72,10 +60,10 @@ obj-$(CONFIG_SANDPOINT)             += i8259.o pci_auto.o todc_time.o
 obj-$(CONFIG_SBC82xx)          += todc_time.o
 obj-$(CONFIG_SPRUCE)           += cpc700_pic.o indirect_pci.o pci_auto.o \
                                   todc_time.o
-obj-$(CONFIG_8260)             += m8260_setup.o cpm2_pic.o
+obj-$(CONFIG_8260)             += m8260_setup.o
 obj-$(CONFIG_PCI_8260)         += m8260_pci.o indirect_pci.o
 obj-$(CONFIG_8260_PCI9)                += m8260_pci_erratum9.o
-obj-$(CONFIG_CPM2)             += cpm2_common.o
+obj-$(CONFIG_CPM2)             += cpm2_common.o cpm2_pic.o
 ifeq ($(CONFIG_PPC_GEN550),y)
 obj-$(CONFIG_KGDB)             += gen550_kgdb.o gen550_dbg.o
 obj-$(CONFIG_SERIAL_TEXT_DEBUG)        += gen550_dbg.o
@@ -89,3 +77,4 @@ obj-$(CONFIG_85xx)            += open_pic.o ppc85xx_common.o ppc85xx_setup.o
 ifeq ($(CONFIG_85xx),y)
 obj-$(CONFIG_PCI)              += indirect_pci.o pci_auto.o
 endif
+obj-$(CONFIG_PPC_MPC52xx)      += mpc52xx_setup.o mpc52xx_pic.o
index e6f680a..70cb577 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Interrupt controller support for Galileo's GT64260.
  *
- * Author: Chris Zankel <source@mvista.com>
+ * Author: Chris Zankel <chris@mvista.com>
  * Modified by: Mark A. Greer <mgreer@mvista.com>
  *
  * Based on sources from Rabeeh Khoury / Galileo Technology
@@ -43,8 +43,7 @@
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/irq.h>
-#include <asm/ocp.h>
-#include <asm/mv64x60.h>
+#include <asm/gt64260.h>
 
 
 /* ========================== forward declaration ========================== */
@@ -67,9 +66,6 @@ struct hw_interrupt_type gt64260_pic = {
 
 u32 gt64260_irq_base = 0;      /* GT64260 handles the next 96 IRQs from here */
 
-static mv64x60_handle_t base_bh;
-static mv64x60_handle_t ic_bh;
-
 /* gt64260_init_irq()
  *
  *  This function initializes the interrupt controller. It assigns
@@ -91,38 +87,19 @@ static mv64x60_handle_t ic_bh;
 __init void
 gt64260_init_irq(void)
 {
-       struct ocp_def  *def;
        int i;
 
-/* XXXX extract reg base, irq base from ocp */
-/* XXXX rewrite read/write macros to not use 'bh'?? */
-/* XXXX Have to use ocp b/c can pass arg to this routine */
-
        if ( ppc_md.progress ) ppc_md.progress("gt64260_init_irq: enter", 0x0);
 
-       if ((def = ocp_get_one_device(OCP_VENDOR_MARVELL, OCP_FUNC_HB,
-                                       OCP_ANY_INDEX)) == NULL) {
-               /* XXXX SCREAM */
-               return;
-       }
-       base_bh.v_base = (u32)ioremap(def->paddr, 0x10000); /* XXXX */
-
-       if ((def = ocp_get_one_device(OCP_VENDOR_MARVELL, OCP_FUNC_PIC,
-                                       OCP_ANY_INDEX)) == NULL) {
-               /* XXXX SCREAM */
-               return;
-       }
-       ic_bh.v_base = (u32)ioremap(def->paddr, 0x1000); /* XXXX */
-
        ppc_cached_irq_mask[0] = 0;
        ppc_cached_irq_mask[1] = 0x0f000000; /* Enable GPP intrs */
        ppc_cached_irq_mask[2] = 0;
 
        /* disable all interrupts and clear current interrupts */
-       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK, ppc_cached_irq_mask[2]);
-       mv64x60_write(&base_bh, MV64x60_GPP_INTR_CAUSE,0);
-       mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_LO, ppc_cached_irq_mask[0]);
-       mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_HI, ppc_cached_irq_mask[1]);
+       gt_write(GT64260_GPP_INTR_MASK, ppc_cached_irq_mask[2]);
+       gt_write(GT64260_GPP_INTR_CAUSE,0);
+       gt_write(GT64260_IC_CPU_INTR_MASK_LO, ppc_cached_irq_mask[0]);
+       gt_write(GT64260_IC_CPU_INTR_MASK_HI, ppc_cached_irq_mask[1]);
 
        /* use the gt64260 for all (possible) interrupt sources */
        for( i = gt64260_irq_base;  i < (gt64260_irq_base + 96);  i++ )  {
@@ -133,8 +110,7 @@ gt64260_init_irq(void)
 }
 
 
-/*
- * gt64260_get_irq()
+/* gt64260_get_irq()
  *
  *  This function returns the lowest interrupt number of all interrupts that
  *  are currently asserted.
@@ -155,18 +131,18 @@ gt64260_get_irq(struct pt_regs *regs)
        int irq;
        int irq_gpp;
 
-       irq = mv64x60_read(&ic_bh, GT64260_IC_MAIN_CAUSE_LO);
+       irq = gt_read(GT64260_IC_MAIN_CAUSE_LO);
        irq = __ilog2((irq & 0x3dfffffe) & ppc_cached_irq_mask[0]);
 
        if (irq == -1) {
-               irq = mv64x60_read(&ic_bh, GT64260_IC_MAIN_CAUSE_HI);
+               irq = gt_read(GT64260_IC_MAIN_CAUSE_HI);
                irq = __ilog2((irq & 0x0f000db7) & ppc_cached_irq_mask[1]);
 
                if (irq == -1) {
                        irq = -2;   /* bogus interrupt, should never happen */
                } else {
                        if (irq >= 24) {
-                               irq_gpp = mv64x60_read(&base_bh, MV64x60_GPP_INTR_CAUSE);
+                               irq_gpp = gt_read(GT64260_GPP_INTR_CAUSE);
                                irq_gpp = __ilog2(irq_gpp &
                                                  ppc_cached_irq_mask[2]);
 
@@ -174,7 +150,7 @@ gt64260_get_irq(struct pt_regs *regs)
                                        irq = -2;
                                } else {
                                        irq = irq_gpp + 64;
-                                       mv64x60_write(&base_bh, MV64x60_GPP_INTR_CAUSE, ~(1<<(irq-64)));
+                                       gt_write(GT64260_GPP_INTR_CAUSE, ~(1<<(irq-64)));
                                }
                        } else {
                                irq += 32;
@@ -206,23 +182,20 @@ gt64260_get_irq(struct pt_regs *regs)
 static void
 gt64260_unmask_irq(unsigned int irq)
 {
-       /* XXXX
-       printk("XXXX: *** unmask irq: %d\n", irq);
-       */
        irq -= gt64260_irq_base;
        if (irq > 31) {
                if (irq > 63) {
                        /* unmask GPP irq */
-                       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK,
+                       gt_write(GT64260_GPP_INTR_MASK,
                                     ppc_cached_irq_mask[2] |= (1<<(irq-64)));
                } else {
                        /* mask high interrupt register */
-                       mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_HI,
+                       gt_write(GT64260_IC_CPU_INTR_MASK_HI,
                                     ppc_cached_irq_mask[1] |= (1<<(irq-32)));
                }
        } else {
                /* mask low interrupt register */
-               mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_LO,
+               gt_write(GT64260_IC_CPU_INTR_MASK_LO,
                             ppc_cached_irq_mask[0] |= (1<<irq));
        }
 }
@@ -245,23 +218,20 @@ gt64260_unmask_irq(unsigned int irq)
 static void
 gt64260_mask_irq(unsigned int irq)
 {
-       /* XXXX
-       printk("XXXX: *** mask irq: %d\n", irq);
-       */
        irq -= gt64260_irq_base;
        if (irq > 31) {
                if (irq > 63) {
                        /* mask GPP irq */
-                       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK,
+                       gt_write(GT64260_GPP_INTR_MASK,
                                     ppc_cached_irq_mask[2] &= ~(1<<(irq-64)));
                } else {
                        /* mask high interrupt register */
-                       mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_HI,
+                       gt_write(GT64260_IC_CPU_INTR_MASK_HI,
                                     ppc_cached_irq_mask[1] &= ~(1<<(irq-32)));
                }
        } else {
                /* mask low interrupt register */
-               mv64x60_write(&ic_bh, GT64260_IC_CPU_INTR_MASK_LO,
+               gt_write(GT64260_IC_CPU_INTR_MASK_LO,
                             ppc_cached_irq_mask[0] &= ~(1<<irq));
        }
 
diff --git a/arch/ppc/syslib/mv64360_pic.c b/arch/ppc/syslib/mv64360_pic.c
deleted file mode 100644 (file)
index ef07629..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * arch/ppc/kernel/mv64360_pic.c
- * 
- * Interrupt controller support for Marvell's MV64360.
- *
- * Author: Rabeeh Khoury <rabeeh@galileo.co.il>
- * Based on MV64360 PIC written by
- * Chris Zankel <chris@mvista.com>
- * Mark A. Greer <mgreer@mvista.com>
- *
- * Copyright 2004 MontaVista Software, Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-/*
- * This file contains the specific functions to support the MV64360
- * interrupt controller.
- *
- * The MV64360 has two main interrupt registers (high and low) that
- * summarizes the interrupts generated by the units of the MV64360.
- * Each bit is assigned to an interrupt number, where the low register
- * are assigned from IRQ0 to IRQ31 and the high cause register
- * from IRQ32 to IRQ63 
- * The GPP (General Purpose Pins) interrupts are assigned from IRQ64 (GPP0) 
- * to IRQ95 (GPP31). 
- * get_irq() returns the lowest interrupt number that is currently asserted.
- *
- * Note: 
- *  - This driver does not initialize the GPP when used as an interrupt 
- *    input.
- */
-
-#include <linux/stddef.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/signal.h>
-#include <linux/stddef.h>
-#include <linux/delay.h>
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/ocp.h>
-#include <asm/mv64x60.h>
-
-#ifdef CONFIG_IRQ_ALL_CPUS
-#error "The mv64360 does not support yet distribution of IRQs on all CPUs"
-#endif
-/* ========================== forward declaration ========================== */
-
-static void mv64360_unmask_irq(unsigned int);
-static void mv64360_mask_irq(unsigned int);
-static irqreturn_t mv64360_cpu_error_int_handler(int, void *, struct pt_regs *);
-static irqreturn_t mv64360_sram_error_int_handler(int, void *, struct pt_regs *);
-static irqreturn_t mv64360_pci_error_int_handler(int, void *, struct pt_regs *);
-
-/* ========================== local declarations =========================== */
-
-struct hw_interrupt_type mv64360_pic = {
-       .typename = " MV64360_PIC ",    /* typename */
-       .enable = mv64360_unmask_irq,   /* enable */
-       .disable = mv64360_mask_irq,    /* disable */
-       .ack = mv64360_mask_irq,        /* ack */
-};
-
-#define CPU_INTR_STR   "MV64360 CPU interface error"
-#define SRAM_INTR_STR  "MV64360 internal sram error"
-#define PCI0_INTR_STR  "MV64360 PCI 0 error"
-#define PCI1_INTR_STR  "MV64360 PCI 1 error"
-
-static mv64x60_handle_t        base_bh;
-
-u32 mv64360_irq_base = 0;      /* MV64360 handles the next 96 IRQs from here */
-
-/* mv64360_init_irq()
- *
- *  This function initializes the interrupt controller. It assigns
- *  all interrupts from IRQ0 to IRQ95 to the mv64360 interrupt controller.
- *
- * Input Variable(s):
- *  None.
- *
- * Outpu. Variable(s):
- *  None.
- *
- * Returns:
- *  void
- *
- * Note:
- *  We register all GPP inputs as interrupt source, but disable them.
- */
-
-__init void
-mv64360_init_irq(void)
-{
-       struct ocp_def  *def;
-       int i;
-
-       if (ppc_md.progress)
-               ppc_md.progress("mv64360_init_irq: enter", 0x0);
-
-       if ( ppc_md.progress ) ppc_md.progress("mv64360_init_irq: enter", 0x0);
-
-       if ((def = ocp_get_one_device(OCP_VENDOR_MARVELL, OCP_FUNC_HB,
-                                       OCP_ANY_INDEX)) == NULL) {
-               /* XXXX SCREAM */
-               return;
-       }
-       base_bh.v_base = (unsigned long)ioremap(def->paddr, 0x1000);
-
-       ppc_cached_irq_mask[0] = 0;
-       ppc_cached_irq_mask[1] = 0x0f000000;    /* Enable GPP intrs */
-       ppc_cached_irq_mask[2] = 0;
-
-       /* disable all interrupts and clear current interrupts */
-       mv64x60_write(&base_bh, MV64x60_GPP_INTR_CAUSE, 0);
-       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK,
-               ppc_cached_irq_mask[2]);
-       mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_LO,
-               ppc_cached_irq_mask[0]);
-       mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_HI,
-               ppc_cached_irq_mask[1]);
-
-       /* use the mv64360 for all (possible) interrupt sources */
-       for (i = mv64360_irq_base; i < (mv64360_irq_base + 96); i++) {
-               /* All interrupts are level interrupts */
-               irq_desc[i].status |= IRQ_LEVEL;
-               irq_desc[i].handler = &mv64360_pic;
-       }
-
-       /* Register CPU interface error interrupt handler */
-       request_irq(MV64x60_IRQ_CPU_ERR, mv64360_cpu_error_int_handler,
-               SA_INTERRUPT, CPU_INTR_STR, 0);
-       mv64x60_write(&base_bh, MV64x60_CPU_ERR_MASK, 0x000000ff);
-
-       /* Register internal SRAM error interrupt handler */
-       request_irq(MV64360_IRQ_SRAM_PAR_ERR, mv64360_sram_error_int_handler,
-               SA_INTERRUPT, SRAM_INTR_STR, 0);
-
-       /* Register PCI 0 error interrupt handler */
-       request_irq(MV64360_IRQ_PCI0, mv64360_pci_error_int_handler,
-               SA_INTERRUPT, PCI0_INTR_STR, (void *) 0);
-       mv64x60_write(&base_bh, MV64x60_PCI0_ERR_MASK, 0x00a50c25);
-
-       /* Register PCI 1 error interrupt handler */
-       request_irq(MV64360_IRQ_PCI1, mv64360_pci_error_int_handler,
-               SA_INTERRUPT, PCI1_INTR_STR, (void *) 1);
-       mv64x60_write(&base_bh, MV64x60_PCI1_ERR_MASK, 0x00a50c25);
-
-       if (ppc_md.progress)
-               ppc_md.progress("mv64360_init_irq: exit", 0x0);
-}
-
-
-/* mv64360_get_irq()
- *
- *  This function returns the lowest interrupt number of all interrupts that
- *  are currently asserted. 
- *
- * Input Variable(s):
- *  struct pt_regs*    not used
- *
- * Output Variable(s):
- *  None.
- *
- * Returns:
- *  int        <interrupt number> or -2 (bogus interrupt)
- * 
- */
-int
-mv64360_get_irq(struct pt_regs *regs)
-{
-       int irq;
-       int irq_gpp;
-
-#ifdef CONFIG_SMP
-#define BIT28 (1<<28)
-       /* 
-        * Second CPU gets only doorbell (message) interrupts.
-        * The doorbell interrupt is BIT28 in the main interrupt low cause reg.
-        */
-       int cpu_nr = smp_processor_id();
-       if (cpu_nr == 1) {
-               irq = mv64x60_read(&base_bh, MV64360_IC_MAIN_CAUSE_LO);
-               if (!(irq & BIT28))
-                       return -1;
-               return 28;
-       }
-#endif
-
-       irq = mv64x60_read(&base_bh, MV64360_IC_MAIN_CAUSE_LO);
-       irq = __ilog2((irq & 0x3dfffffe) & ppc_cached_irq_mask[0]);
-       if (irq == -1) {
-               irq = mv64x60_read(&base_bh, MV64360_IC_MAIN_CAUSE_HI);
-               irq = __ilog2((irq & 0x1f0003f7) & ppc_cached_irq_mask[1]);
-               if (irq == -1) {
-                       irq = -2;       /* bogus interrupt, should never happen */
-               } else {
-                       if ((irq >= 24) && (irq < 28)) {
-                               irq_gpp =
-                                       mv64x60_read(&base_bh,
-                                               MV64x60_GPP_INTR_CAUSE);
-                               irq_gpp =
-                                       __ilog2(irq_gpp &
-                                       ppc_cached_irq_mask[2]);
-
-                               if (irq_gpp == -1) {
-                                       irq = -2;
-                               } else {
-                                       irq = irq_gpp + 64;
-                                       mv64x60_write(&base_bh,
-                                               MV64x60_GPP_INTR_CAUSE,
-                                               ~(1 << (irq - 64)));
-                               }
-                       } else {
-                               irq += 32;
-                       }
-               }
-       }
-
-       if (irq < 0) {
-               return (irq);
-       } else {
-               return (mv64360_irq_base + irq);
-       }
-}
-
-/* mv64360_unmask_irq()
- *
- *  This function enables an interrupt.
- *
- * Input Variable(s):
- *  unsigned int       interrupt number (IRQ0...IRQ95).
- *
- * Output Variable(s):
- *  None.
- *
- * Returns:
- *  void
- */
-
-static void
-mv64360_unmask_irq(unsigned int irq)
-{
-#ifdef CONFIG_SMP
-       /* second CPU gets only doorbell interrupts */
-       if ((irq - mv64360_irq_base) == 28) {
-               mv64x60_set_bits(&base_bh, MV64360_IC_CPU1_INTR_MASK_LO, BIT28);
-               return;
-       }
-#endif
-       irq -= mv64360_irq_base;
-       if (irq > 31) {
-               if (irq > 63) {
-                       /* unmask GPP irq */
-                       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK,
-                               ppc_cached_irq_mask[2] |= (1 << (irq - 64)));
-               } else {
-                       /* mask high interrupt register */
-                       mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_HI,
-                               ppc_cached_irq_mask[1] |= (1 << (irq - 32)));
-               }
-       } else {
-               /* mask low interrupt register */
-               mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_LO,
-                       ppc_cached_irq_mask[0] |= (1 << irq));
-       }
-}
-
-
-/* mv64360_mask_irq()
- *
- *  This function disables the requested interrupt.
- *
- * Input Variable(s):
- *  unsigned int       interrupt number (IRQ0...IRQ95).
- *
- * Output Variable(s):
- *  None.
- *
- * Returns:
- *  void
- */
-
-static void
-mv64360_mask_irq(unsigned int irq)
-{
-#ifdef CONFIG_SMP
-       if ((irq - mv64360_irq_base) == 28) {
-               mv64x60_clr_bits(&base_bh, MV64360_IC_CPU1_INTR_MASK_LO, BIT28);
-               return;
-       }
-#endif
-       irq -= mv64360_irq_base;
-       if (irq > 31) {
-               if (irq > 63) {
-                       /* mask GPP irq */
-                       mv64x60_write(&base_bh, MV64x60_GPP_INTR_MASK,
-                               ppc_cached_irq_mask[2] &= ~(1 << (irq - 64)));
-               } else {
-                       /* mask high interrupt register */
-                       mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_HI,
-                               ppc_cached_irq_mask[1] &= ~(1 << (irq - 32)));
-               }
-       } else {
-               /* mask low interrupt register */
-               mv64x60_write(&base_bh, MV64360_IC_CPU0_INTR_MASK_LO,
-                       ppc_cached_irq_mask[0] &= ~(1 << irq));
-       }
-
-}
-
-static irqreturn_t
-mv64360_cpu_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
-{
-       u32 val;
-       val = mv64x60_read(&base_bh, MV64x60_CPU_ERR_CAUSE);
-       printk(KERN_ERR
-               "mv64360_cpu_error_int_handler: Error on CPU interface - Cause regiser 0x%08x\n",
-               val);
-       printk(KERN_ERR "\tCPU error register dump:\n");
-       printk(KERN_ERR "\tAddress low  0x%08x\n",
-               mv64x60_read(&base_bh, MV64x60_CPU_ERR_ADDR_LO));
-       printk(KERN_ERR "\tAddress high 0x%08x\n",
-               mv64x60_read(&base_bh, MV64x60_CPU_ERR_ADDR_HI));
-       printk(KERN_ERR "\tData low     0x%08x\n",
-               mv64x60_read(&base_bh, MV64x60_CPU_ERR_DATA_LO));
-       printk(KERN_ERR "\tData high    0x%08x\n",
-               mv64x60_read(&base_bh, MV64x60_CPU_ERR_DATA_HI));
-       printk(KERN_ERR "\tParity       0x%08x\n",
-               mv64x60_read(&base_bh, MV64x60_CPU_ERR_PARITY));
-       mv64x60_write(&base_bh, MV64x60_CPU_ERR_CAUSE, 0);
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t
-mv64360_sram_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
-{
-       printk(KERN_ERR
-               "mv64360_sram_error_int_handler: Error in internal SRAM - Cause register 0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_CAUSE));
-       printk(KERN_ERR "\tSRAM error register dump:\n");
-       printk(KERN_ERR "\tAddress Low  0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_ADDR_LO));
-       printk(KERN_ERR "\tAddress High 0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_ADDR_HI));
-       printk(KERN_ERR "\tData Low     0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_DATA_LO));
-       printk(KERN_ERR "\tData High    0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_DATA_HI));
-       printk(KERN_ERR "\tParity       0x%08x\n",
-               mv64x60_read(&base_bh, MV64360_SRAM_ERR_PARITY));
-       mv64x60_write(&base_bh, MV64360_SRAM_ERR_CAUSE, 0);
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t
-mv64360_pci_error_int_handler(int irq, void *dev_id, struct pt_regs *regs)
-{
-       u32 val;
-       unsigned int pci_bus = (unsigned int) dev_id;
-       if (pci_bus == 0) {     /* Error on PCI 0 */
-               val = mv64x60_read(&base_bh, MV64x60_PCI0_ERR_CAUSE);
-               printk(KERN_ERR
-                       "mv64360_pci_error_int_handler: Error in PCI %d Interface\n",
-                       pci_bus);
-               printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
-               printk(KERN_ERR "\tCause register 0x%08x\n", val);
-               printk(KERN_ERR "\tAddress Low    0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI0_ERR_ADDR_LO));
-               printk(KERN_ERR "\tAddress High   0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI0_ERR_ADDR_HI));
-               printk(KERN_ERR "\tAttribute      0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI0_ERR_DATA_LO));
-               printk(KERN_ERR "\tCommand        0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI0_ERR_CMD));
-               mv64x60_write(&base_bh, MV64x60_PCI0_ERR_CAUSE, ~val);
-       }
-       if (pci_bus == 1) {     /* Error on PCI 1 */
-               val = mv64x60_read(&base_bh, MV64x60_PCI1_ERR_CAUSE);
-               printk(KERN_ERR
-                       "mv64360_pci_error_int_handler: Error in PCI %d Interface\n",
-                       pci_bus);
-               printk(KERN_ERR "\tPCI %d error register dump:\n", pci_bus);
-               printk(KERN_ERR "\tCause register 0x%08x\n", val);
-               printk(KERN_ERR "\tAddress Low    0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI1_ERR_ADDR_LO));
-               printk(KERN_ERR "\tAddress High   0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI1_ERR_ADDR_HI));
-               printk(KERN_ERR "\tAttribute      0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI1_ERR_DATA_LO));
-               printk(KERN_ERR "\tCommand        0x%08x\n",
-                       mv64x60_read(&base_bh, MV64x60_PCI1_ERR_CMD));
-               mv64x60_write(&base_bh, MV64x60_PCI1_ERR_CAUSE, ~val);
-       }
-       return IRQ_HANDLED;
-}
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
deleted file mode 100644 (file)
index c31fe53..0000000
+++ /dev/null
@@ -1,2872 +0,0 @@
-/*
- * arch/ppc/syslib/mv64x60.c
- * 
- * Common routines for the Marvell/Galileo Discovery line of host bridges
- * (e.g, gt64260 and mv64360).
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *        Rabeeh Khoury <rabeeh@galileo.co.il>
- *
- * 2001-2002 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/string.h>
-
-#include <asm/byteorder.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mv64x60.h>
-#include <asm/delay.h>
-#include <asm/ocp.h>
-
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define        DBG(x...) printk(x)
-#else
-#define        DBG(x...)
-#endif /* DEBUG */
-
-
-static u32 mv64x60_mask(u32 val, u32 num_bits);
-static u32 mv64x60_shift_left(u32 val, u32 num_bits);
-static u32 mv64x60_shift_right(u32 val, u32 num_bits);
-static void mv64x60_early_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si);
-static int mv64x60_get_type(mv64x60_handle_t *bh);
-static int mv64x60_setup_for_chip(mv64x60_handle_t *bh);
-static void mv64x60_get_mem_windows(mv64x60_handle_t *bh,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2]);
-static u32 mv64x60_calc_mem_size(mv64x60_handle_t *bh,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2]);
-static void mv64x60_config_cpu2mem_windows(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si, u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2]);
-static void mv64x60_config_cpu2pci_windows(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-static void mv64x60_set_cpu2pci_window(mv64x60_handle_t *bh,
-       mv64x60_pci_info_t *pi, u32 *win_tab, u32 *remap_tab);
-static void mv64x60_config_pci2mem_windows(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si, u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2]);
-static void mv64x60_alloc_hoses(mv64x60_handle_t *bh, mv64x60_setup_info_t *si);
-static void mv64x60_init_hoses(mv64x60_handle_t *bh, mv64x60_setup_info_t *si);
-static void mv64x60_init_resources(struct pci_controller *hose,
-       mv64x60_pci_info_t *pi, u32 io_base);
-static void mv64x60_set_pci_params(struct pci_controller *hose,
-       mv64x60_pci_info_t *pi);
-static void mv64x60_enumerate_buses(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-static int mv64x60_pci_exclude_device(u8 bus, u8 devfn);
-static void mv64x60_fixup_ocp(struct ocp_device *, void *arg);
-
-static u32 gt64260_translate_size(u32 base, u32 size, u32 num_bits);
-static u32 gt64260_untranslate_size(u32 base, u32 size, u32 num_bits);
-static void gt64260_set_pci2mem_window(struct pci_controller *hose,
-       u32 window, u32 base);
-static u32 gt64260_is_enabled_32bit(mv64x60_handle_t *bh, u32 window);
-static void gt64260_enable_window_32bit(mv64x60_handle_t *bh, u32 window);
-static void gt64260_disable_window_32bit(mv64x60_handle_t *bh, u32 window);
-static void gt64260_enable_window_64bit(mv64x60_handle_t *bh, u32 window);
-static void gt64260_disable_window_64bit(mv64x60_handle_t *bh, u32 window);
-static void gt64260_disable_all_windows(mv64x60_handle_t *bh,
-                                       mv64x60_setup_info_t *si);
-static void gt64260a_chip_specific_init(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-static void gt64260b_chip_specific_init(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-
-static u32 mv64360_translate_size(u32 base_addr, u32 size, u32 num_bits);
-static u32 mv64360_untranslate_size(u32 base_addr, u32 size, u32 num_bits);
-static void mv64360_set_pci2mem_window(struct pci_controller *hose,
-       u32 window, u32 base);
-static u32 mv64360_is_enabled_32bit(mv64x60_handle_t *bh, u32 window);
-static void mv64360_enable_window_32bit(mv64x60_handle_t *bh, u32 window);
-static void mv64360_disable_window_32bit(mv64x60_handle_t *bh, u32 window);
-static void mv64360_enable_window_64bit(mv64x60_handle_t *bh, u32 window);
-static void mv64360_disable_window_64bit(mv64x60_handle_t *bh, u32 window);
-static void mv64360_disable_all_windows(mv64x60_handle_t *bh,
-                                       mv64x60_setup_info_t *si);
-static void mv64360_chip_specific_init(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-static void mv64460_chip_specific_init(mv64x60_handle_t *bh,
-       mv64x60_setup_info_t *si);
-
-
-u8     mv64x60_pci_exclude_bridge = TRUE;
-
-spinlock_t mv64x60_lock = SPIN_LOCK_UNLOCKED;
-spinlock_t mv64x60_rmw_lock = SPIN_LOCK_UNLOCKED;
-
-static mv64x60_32bit_window_t gt64260_32bit_windows[] __initdata = {
-       /* CPU->MEM Windows */
-       [MV64x60_CPU2MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2MEM_0_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2MEM_1_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2MEM_2_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2MEM_3_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->Device Windows */
-       [MV64x60_CPU2DEV_0_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_0_BASE,
-               .size_reg               = MV64x60_CPU2DEV_0_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2DEV_1_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_1_BASE,
-               .size_reg               = MV64x60_CPU2DEV_1_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2DEV_2_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_2_BASE,
-               .size_reg               = MV64x60_CPU2DEV_2_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2DEV_3_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_3_BASE,
-               .size_reg               = MV64x60_CPU2DEV_3_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->Boot Window */
-       [MV64x60_CPU2BOOT_WIN] = {
-               .base_reg               = MV64x60_CPU2BOOT_0_BASE,
-               .size_reg               = MV64x60_CPU2BOOT_0_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 0 Windows */
-       [MV64x60_CPU2PCI0_IO_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_IO_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_IO_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_0_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_1_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_2_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_3_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 1 Windows */
-       [MV64x60_CPU2PCI1_IO_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_IO_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_IO_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_0_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_1_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_2_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_3_SIZE,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->SRAM Window (64260 has no integrated SRAM) */
-       /* CPU->PCI 0 Remap I/O Window */
-       [MV64x60_CPU2PCI0_IO_REMAP_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_IO_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 1 Remap I/O Window */
-       [MV64x60_CPU2PCI1_IO_REMAP_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_IO_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU Memory Protection Windows */
-       [MV64x60_CPU_PROT_0_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_0,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_0,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_PROT_1_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_1,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_1,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_PROT_2_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_2,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_2,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_PROT_3_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_3,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_3,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU Snoop Windows */
-       [MV64x60_CPU_SNOOP_0_WIN] = {
-               .base_reg               = GT64260_CPU_SNOOP_BASE_0,
-               .size_reg               = GT64260_CPU_SNOOP_SIZE_0,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_SNOOP_1_WIN] = {
-               .base_reg               = GT64260_CPU_SNOOP_BASE_1,
-               .size_reg               = GT64260_CPU_SNOOP_SIZE_1,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_SNOOP_2_WIN] = {
-               .base_reg               = GT64260_CPU_SNOOP_BASE_2,
-               .size_reg               = GT64260_CPU_SNOOP_SIZE_2,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU_SNOOP_3_WIN] = {
-               .base_reg               = GT64260_CPU_SNOOP_BASE_3,
-               .size_reg               = GT64260_CPU_SNOOP_SIZE_3,
-               .base_bits              = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 0->System Memory Remap Windows */
-       [MV64x60_PCI02MEM_REMAP_0_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_0_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_1_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_2_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_3_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       /* PCI 1->System Memory Remap Windows */
-       [MV64x60_PCI12MEM_REMAP_0_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_0_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_1_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_2_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_3_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 20,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-};
-
-static mv64x60_64bit_window_t gt64260_64bit_windows[] __initdata = {
-       /* CPU->PCI 0 MEM Remap Windows */
-       [MV64x60_CPU2PCI0_MEM_0_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_0_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_0_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_1_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_1_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_1_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_2_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_2_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_2_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_3_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_3_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_3_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 1 MEM Remap Windows */
-       [MV64x60_CPU2PCI1_MEM_0_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_0_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_0_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_1_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_1_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_1_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_2_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_2_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_2_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_3_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_3_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_3_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 12,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 0->MEM Access Control Windows */
-       [MV64x60_PCI02MEM_ACC_CNTL_0_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_0_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_0_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_0_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_1_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_1_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_1_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_1_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_2_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_2_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_2_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_2_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_3_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_3_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_3_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_3_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 1->MEM Access Control Windows */
-       [MV64x60_PCI12MEM_ACC_CNTL_0_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_0_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_0_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_0_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_1_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_1_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_1_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_1_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_2_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_2_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_2_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_2_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_3_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_3_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_3_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_3_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 0->MEM Snoop Windows */
-       [MV64x60_PCI02MEM_SNOOP_0_WIN] = {
-               .base_hi_reg            = GT64260_PCI0_SNOOP_0_BASE_HI,
-               .base_lo_reg            = GT64260_PCI0_SNOOP_0_BASE_LO,
-               .size_reg               = GT64260_PCI0_SNOOP_0_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_SNOOP_1_WIN] = {
-               .base_hi_reg            = GT64260_PCI0_SNOOP_1_BASE_HI,
-               .base_lo_reg            = GT64260_PCI0_SNOOP_1_BASE_LO,
-               .size_reg               = GT64260_PCI0_SNOOP_1_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_SNOOP_2_WIN] = {
-               .base_hi_reg            = GT64260_PCI0_SNOOP_2_BASE_HI,
-               .base_lo_reg            = GT64260_PCI0_SNOOP_2_BASE_LO,
-               .size_reg               = GT64260_PCI0_SNOOP_2_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_SNOOP_3_WIN] = {
-               .base_hi_reg            = GT64260_PCI0_SNOOP_3_BASE_HI,
-               .base_lo_reg            = GT64260_PCI0_SNOOP_3_BASE_LO,
-               .size_reg               = GT64260_PCI0_SNOOP_3_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 1->MEM Snoop Windows */
-       [MV64x60_PCI12MEM_SNOOP_0_WIN] = {
-               .base_hi_reg            = GT64260_PCI1_SNOOP_0_BASE_HI,
-               .base_lo_reg            = GT64260_PCI1_SNOOP_0_BASE_LO,
-               .size_reg               = GT64260_PCI1_SNOOP_0_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_SNOOP_1_WIN] = {
-               .base_hi_reg            = GT64260_PCI1_SNOOP_1_BASE_HI,
-               .base_lo_reg            = GT64260_PCI1_SNOOP_1_BASE_LO,
-               .size_reg               = GT64260_PCI1_SNOOP_1_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_SNOOP_2_WIN] = {
-               .base_hi_reg            = GT64260_PCI1_SNOOP_2_BASE_HI,
-               .base_lo_reg            = GT64260_PCI1_SNOOP_2_BASE_LO,
-               .size_reg               = GT64260_PCI1_SNOOP_2_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_SNOOP_3_WIN] = {
-               .base_hi_reg            = GT64260_PCI1_SNOOP_3_BASE_HI,
-               .base_lo_reg            = GT64260_PCI1_SNOOP_3_BASE_LO,
-               .size_reg               = GT64260_PCI1_SNOOP_3_SIZE,
-               .base_lo_bits           = 12,
-               .size_bits              = 12,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-};
-
-static mv64x60_chip_info_t gt64260a_ci __initdata = {
-       .translate_size         = gt64260_translate_size,
-       .untranslate_size       = gt64260_untranslate_size,
-       .set_pci2mem_window     = gt64260_set_pci2mem_window,
-       .is_enabled_32bit       = gt64260_is_enabled_32bit,
-       .enable_window_32bit    = gt64260_enable_window_32bit,
-       .disable_window_32bit   = gt64260_disable_window_32bit,
-       .enable_window_64bit    = gt64260_enable_window_64bit,
-       .disable_window_64bit   = gt64260_disable_window_64bit,
-       .disable_all_windows    = gt64260_disable_all_windows,
-       .chip_specific_init     = gt64260a_chip_specific_init,
-       .window_tab_32bit       = gt64260_32bit_windows,
-       .window_tab_64bit       = gt64260_64bit_windows,
-};
-
-static mv64x60_chip_info_t gt64260b_ci __initdata = {
-       .translate_size         = gt64260_translate_size,
-       .untranslate_size       = gt64260_untranslate_size,
-       .set_pci2mem_window     = gt64260_set_pci2mem_window,
-       .is_enabled_32bit       = gt64260_is_enabled_32bit,
-       .enable_window_32bit    = gt64260_enable_window_32bit,
-       .disable_window_32bit   = gt64260_disable_window_32bit,
-       .enable_window_64bit    = gt64260_enable_window_64bit,
-       .disable_window_64bit   = gt64260_disable_window_64bit,
-       .disable_all_windows    = gt64260_disable_all_windows,
-       .chip_specific_init     = gt64260b_chip_specific_init,
-       .window_tab_32bit       = gt64260_32bit_windows,
-       .window_tab_64bit       = gt64260_64bit_windows,
-};
-
-
-static mv64x60_32bit_window_t mv64360_32bit_windows[] __initdata = {
-       /* CPU->MEM Windows */
-       [MV64x60_CPU2MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2MEM_0_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2MEM_1_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 1 },
-       [MV64x60_CPU2MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2MEM_2_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 2 },
-       [MV64x60_CPU2MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2MEM_3_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 3 },
-       /* CPU->Device Windows */
-       [MV64x60_CPU2DEV_0_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_0_BASE,
-               .size_reg               = MV64x60_CPU2DEV_0_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 4 },
-       [MV64x60_CPU2DEV_1_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_1_BASE,
-               .size_reg               = MV64x60_CPU2DEV_1_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 5 },
-       [MV64x60_CPU2DEV_2_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_2_BASE,
-               .size_reg               = MV64x60_CPU2DEV_2_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 6 },
-       [MV64x60_CPU2DEV_3_WIN] = {
-               .base_reg               = MV64x60_CPU2DEV_3_BASE,
-               .size_reg               = MV64x60_CPU2DEV_3_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 7 },
-       /* CPU->Boot Window */
-       [MV64x60_CPU2BOOT_WIN] = {
-               .base_reg               = MV64x60_CPU2BOOT_0_BASE,
-               .size_reg               = MV64x60_CPU2BOOT_0_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 8 },
-       /* CPU->PCI 0 Windows */
-       [MV64x60_CPU2PCI0_IO_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_IO_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_IO_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 9 },
-       [MV64x60_CPU2PCI0_MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_0_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 10 },
-       [MV64x60_CPU2PCI0_MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_1_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 11 },
-       [MV64x60_CPU2PCI0_MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_2_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 12 },
-       [MV64x60_CPU2PCI0_MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2PCI0_MEM_3_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 13 },
-       /* CPU->PCI 1 Windows */
-       [MV64x60_CPU2PCI1_IO_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_IO_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_IO_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 14 },
-       [MV64x60_CPU2PCI1_MEM_0_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_0_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_0_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 15 },
-       [MV64x60_CPU2PCI1_MEM_1_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_1_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_1_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 16 },
-       [MV64x60_CPU2PCI1_MEM_2_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_2_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_2_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 17 },
-       [MV64x60_CPU2PCI1_MEM_3_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_MEM_3_BASE,
-               .size_reg               = MV64x60_CPU2PCI1_MEM_3_SIZE,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 18 },
-       /* CPU->SRAM Window */
-       [MV64x60_CPU2SRAM_WIN] = {
-               .base_reg               = MV64360_CPU2SRAM_BASE,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 19 },
-       /* CPU->PCI 0 Remap I/O Window */
-       [MV64x60_CPU2PCI0_IO_REMAP_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI0_IO_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 1 Remap I/O Window */
-       [MV64x60_CPU2PCI1_IO_REMAP_WIN] = {
-               .base_reg               = MV64x60_CPU2PCI1_IO_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU Memory Protection Windows */
-       [MV64x60_CPU_PROT_0_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_0,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_0,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0x80000000 | 31 },
-       [MV64x60_CPU_PROT_1_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_1,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_1,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0x80000000 | 31 },
-       [MV64x60_CPU_PROT_2_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_2,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_2,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0x80000000 | 31 },
-       [MV64x60_CPU_PROT_3_WIN] = {
-               .base_reg               = MV64x60_CPU_PROT_BASE_3,
-               .size_reg               = MV64x60_CPU_PROT_SIZE_3,
-               .base_bits              = 16,
-               .size_bits              = 16,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0x80000000 | 31 },
-       /* CPU Snoop Windows -- don't exist on 64360 */
-       /* PCI 0->System Memory Remap Windows */
-       [MV64x60_PCI02MEM_REMAP_0_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_0_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_1_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_2_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI02MEM_REMAP_3_WIN] = {
-               .base_reg               = MV64x60_PCI0_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       /* PCI 1->System Memory Remap Windows */
-       [MV64x60_PCI12MEM_REMAP_0_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_0_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_1_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_2_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-       [MV64x60_PCI12MEM_REMAP_3_WIN] = {
-               .base_reg               = MV64x60_PCI1_SLAVE_MEM_1_REMAP,
-               .size_reg               = 0,
-               .base_bits              = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0 },
-};
-
-static mv64x60_64bit_window_t mv64360_64bit_windows[MV64x60_64BIT_WIN_COUNT]
-                                                               __initdata = {
-       /* CPU->PCI 0 MEM Remap Windows */
-       [MV64x60_CPU2PCI0_MEM_0_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_0_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_0_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_1_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_1_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_1_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_2_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_2_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_2_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI0_MEM_3_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI0_MEM_3_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI0_MEM_3_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* CPU->PCI 1 MEM Remap Windows */
-       [MV64x60_CPU2PCI1_MEM_0_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_0_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_0_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_1_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_1_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_1_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_2_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_2_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_2_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       [MV64x60_CPU2PCI1_MEM_3_REMAP_WIN] = {
-               .base_hi_reg            = MV64x60_CPU2PCI1_MEM_3_REMAP_HI,
-               .base_lo_reg            = MV64x60_CPU2PCI1_MEM_3_REMAP_LO,
-               .size_reg               = 0,
-               .base_lo_bits           = 16,
-               .size_bits              = 0,
-               .get_from_field         = mv64x60_shift_left,
-               .map_to_field           = mv64x60_shift_right,
-               .extra                  = 0 },
-       /* PCI 0->MEM Access Control Windows */
-       [MV64x60_PCI02MEM_ACC_CNTL_0_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_0_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_0_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_0_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_1_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_1_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_1_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_1_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_2_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_2_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_2_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_2_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI02MEM_ACC_CNTL_3_WIN] = {
-               .base_hi_reg            = MV64x60_PCI0_ACC_CNTL_3_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI0_ACC_CNTL_3_BASE_LO,
-               .size_reg               = MV64x60_PCI0_ACC_CNTL_3_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       /* PCI 1->MEM Access Control Windows */
-       [MV64x60_PCI12MEM_ACC_CNTL_0_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_0_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_0_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_0_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_1_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_1_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_1_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_1_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_2_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_2_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_2_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_2_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       [MV64x60_PCI12MEM_ACC_CNTL_3_WIN] = {
-               .base_hi_reg            = MV64x60_PCI1_ACC_CNTL_3_BASE_HI,
-               .base_lo_reg            = MV64x60_PCI1_ACC_CNTL_3_BASE_LO,
-               .size_reg               = MV64x60_PCI1_ACC_CNTL_3_SIZE,
-               .base_lo_bits           = 20,
-               .size_bits              = 20,
-               .get_from_field         = mv64x60_mask,
-               .map_to_field           = mv64x60_mask,
-               .extra                  = 0x80000000 | 0 },
-       /* PCI 0->MEM Snoop Windows -- don't exist on 64360 */
-       /* PCI 1->MEM Snoop Windows -- don't exist on 64360 */
-};
-
-static mv64x60_chip_info_t mv64360_ci __initdata = {
-       .translate_size         = mv64360_translate_size,
-       .untranslate_size       = mv64360_untranslate_size,
-       .set_pci2mem_window     = mv64360_set_pci2mem_window,
-       .is_enabled_32bit       = mv64360_is_enabled_32bit,
-       .enable_window_32bit    = mv64360_enable_window_32bit,
-       .disable_window_32bit   = mv64360_disable_window_32bit,
-       .enable_window_64bit    = mv64360_enable_window_64bit,
-       .disable_window_64bit   = mv64360_disable_window_64bit,
-       .disable_all_windows    = mv64360_disable_all_windows,
-       .chip_specific_init     = mv64360_chip_specific_init,
-       .window_tab_32bit       = mv64360_32bit_windows,
-       .window_tab_64bit       = mv64360_64bit_windows,
-};
-
-static mv64x60_chip_info_t mv64460_ci __initdata = {
-       .translate_size         = mv64360_translate_size,
-       .untranslate_size       = mv64360_untranslate_size,
-       .set_pci2mem_window     = mv64360_set_pci2mem_window,
-       .is_enabled_32bit       = mv64360_is_enabled_32bit,
-       .enable_window_32bit    = mv64360_enable_window_32bit,
-       .disable_window_32bit   = mv64360_disable_window_32bit,
-       .enable_window_64bit    = mv64360_enable_window_64bit,
-       .disable_window_64bit   = mv64360_disable_window_64bit,
-       .disable_all_windows    = mv64360_disable_all_windows,
-       .chip_specific_init     = mv64460_chip_specific_init,
-       .window_tab_32bit       = mv64360_32bit_windows,
-       .window_tab_64bit       = mv64360_64bit_windows,
-};
-
-
-/*
- *****************************************************************************
- *
- *     Bridge Initialization Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_init()
- *
- * Initialze the bridge based on setting passed in via 'si'.  The bridge
- * handle, 'bh', will be set so that it can be used to make subsequent
- * calls to routines in this file.
- */
-int __init
-mv64x60_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       u32     mem_windows[MV64x60_CPU2MEM_WINDOWS][2];
-       int     rc = 0;
-
-       if (ppc_md.progress)
-               ppc_md.progress("mv64x60_init: Enter", 0x0);
-
-       mv64x60_early_init(bh, si);
-       mv64x60_alloc_hoses(bh, si); /* Allocate pci hose structures */
-       if (mv64x60_get_type(bh))
-               return -1;
-
-       if (mv64x60_setup_for_chip(bh) != 0) {
-               iounmap((void *)bh->v_base);
-
-               if (ppc_md.progress)
-                       ppc_md.progress("mv64x60_init: Exit--error", 0x0);
-               return -1;
-       }
-
-       bh->ci->disable_all_windows(bh, si); /* Disable windows except mem ctlr */
-       mv64x60_config_cpu2pci_windows(bh, si); /* Init CPU->PCI windows */
-       mv64x60_get_mem_windows(bh, mem_windows); /* Read mem ctlr regs */
-       mv64x60_config_cpu2mem_windows(bh, si, mem_windows); /* CPU->MEM setup*/
-       mv64x60_config_pci2mem_windows(bh, si, mem_windows); /* PCI->Sys MEM */
-       mv64x60_init_hoses(bh, si); /* Init hose structs & PCI params */
-       bh->ci->chip_specific_init(bh, si);
-       mv64x60_enumerate_buses(bh, si); /* Enumerate PCI buses */
-       ocp_for_each_device(mv64x60_fixup_ocp, (void *)bh);
-
-       if (ppc_md.progress)
-               ppc_md.progress("mv64x60_init: Exit", 0x0);
-
-       return rc;
-} /* mv64x60_init() */
-
-/*
- *****************************************************************************
- *
- *     Pre-Bridge-Init Routines (Externally Visible)
- *
- *****************************************************************************
- */
-/*
- * mv64x60_get_mem_size()
- *
- * Calculate the amount of memory that the memory controller is set up for.
- * This should only be used by board-specific code if there is no other
- * way to determine the amount of memory in the system.
- */
-u32 __init
-mv64x60_get_mem_size(u32 bridge_base, u32 chip_type)
-{
-       mv64x60_handle_t        bh;
-       u32                     mem_windows[MV64x60_CPU2MEM_WINDOWS][2];
-
-       memset(&bh, 0, sizeof(bh));
-
-       bh.type = chip_type;
-       bh.p_base = bridge_base;
-       bh.v_base = bridge_base;
-
-       (void)mv64x60_setup_for_chip(&bh);
-       mv64x60_get_mem_windows(&bh, mem_windows);
-       return mv64x60_calc_mem_size(&bh, mem_windows);
-}
-
-/*
- *****************************************************************************
- *
- *     Window Config Routines (Externally Visible)
- *
- *****************************************************************************
- */
-/*
- * mv64x60_get_32bit_window()
- *
- * Determine the base address and size of a 32-bit window on the bridge.
- */
-void __init
-mv64x60_get_32bit_window(mv64x60_handle_t *bh, u32 window, u32 *base, u32 *size)
-{
-       u32     val, base_reg, size_reg, base_bits, size_bits;
-       u32     (*get_from_field)(u32 val, u32 num_bits);
-
-       base_reg  = bh->ci->window_tab_32bit[window].base_reg;
-
-       if (base_reg != 0) {
-               size_reg  = bh->ci->window_tab_32bit[window].size_reg;
-               base_bits = bh->ci->window_tab_32bit[window].base_bits;
-               size_bits = bh->ci->window_tab_32bit[window].size_bits;
-               get_from_field= bh->ci->window_tab_32bit[window].get_from_field;
-
-               val = mv64x60_read(bh, base_reg);
-               *base = get_from_field(val, base_bits);
-
-               if (size_reg != 0) {
-                       val = mv64x60_read(bh, size_reg);
-                       val = get_from_field(val, size_bits);
-                       *size = bh->ci->untranslate_size(*base, val, size_bits);
-               }
-               else {
-                       *size = 0;
-               }
-       }
-       else {
-               *base = 0;
-               *size = 0;
-       }
-
-       DBG("get 32bit window: %d, base: 0x%x, size: 0x%x\n",
-               window, *base, *size);
-
-       return;
-}
-
-/*
- * mv64x60_set_32bit_window()
- *
- * Set the base address and size of a 32-bit window on the bridge.
- */
-void __init
-mv64x60_set_32bit_window(mv64x60_handle_t *bh, u32 window, u32 base, u32 size,
-                                                               u32 other_bits)
-{
-       u32     val, base_reg, size_reg, base_bits, size_bits;
-       u32     (*map_to_field)(u32 val, u32 num_bits);
-
-       DBG("set 32bit window: %d, base: 0x%x, size: 0x%x, other: 0x%x\n",
-               window, base, size, other_bits);
-
-       base_reg  = bh->ci->window_tab_32bit[window].base_reg;
-
-       if (base_reg != 0) {
-               size_reg  = bh->ci->window_tab_32bit[window].size_reg;
-               base_bits = bh->ci->window_tab_32bit[window].base_bits;
-               size_bits = bh->ci->window_tab_32bit[window].size_bits;
-               map_to_field = bh->ci->window_tab_32bit[window].map_to_field;
-
-               val = map_to_field(base, base_bits) | other_bits;
-               mv64x60_write(bh, base_reg, val);
-
-               if (size_reg != 0) {
-                       val = bh->ci->translate_size(base, size, size_bits);
-                       val = map_to_field(val, size_bits);
-                       mv64x60_write(bh, size_reg, val);
-               }
-               (void)mv64x60_read(bh, base_reg); /* Flush FIFO */
-       }
-
-       return;
-}
-
-/*
- * mv64x60_get_64bit_window()
- *
- * Determine the base address and size of a 64-bit window on the bridge.
- */
-void __init
-mv64x60_get_64bit_window(mv64x60_handle_t *bh, u32 window, u32 *base_hi,
-                                                       u32 *base_lo, u32 *size)
-{
-       u32     val, base_lo_reg, size_reg, base_lo_bits, size_bits;
-       u32     (*get_from_field)(u32 val, u32 num_bits);
-
-       base_lo_reg = bh->ci->window_tab_64bit[window].base_lo_reg;
-
-       if (base_lo_reg != 0) {
-               size_reg = bh->ci->window_tab_64bit[window].size_reg;
-               base_lo_bits = bh->ci->window_tab_64bit[window].base_lo_bits;
-               size_bits = bh->ci->window_tab_64bit[window].size_bits;
-               get_from_field= bh->ci->window_tab_64bit[window].get_from_field;
-
-               *base_hi = mv64x60_read(bh, 
-                       bh->ci->window_tab_64bit[window].base_hi_reg);
-
-               val = mv64x60_read(bh, base_lo_reg);
-               *base_lo = get_from_field(val, base_lo_bits);
-
-               if (size_reg != 0) {
-                       val = mv64x60_read(bh, size_reg);
-                       val = get_from_field(val, size_bits);
-                       *size = bh->ci->untranslate_size(*base_lo, val,
-                                                               size_bits);
-               }
-               else {
-                       *size = 0;
-               }
-       }
-       else {
-               *base_hi = 0;
-               *base_lo = 0;
-               *size = 0;
-       }
-
-       DBG("get 64bit window: %d, base hi: 0x%x, base lo: 0x%x, size: 0x%x\n",
-               window, *base_hi, *base_lo, *size);
-
-       return;
-}
-
-/*
- * mv64x60_set_64bit_window()
- *
- * Set the base address and size of a 64-bit window on the bridge.
- */
-void __init
-mv64x60_set_64bit_window(mv64x60_handle_t *bh, u32 window,
-                       u32 base_hi, u32 base_lo, u32 size, u32 other_bits)
-{
-       u32     val, base_lo_reg, size_reg, base_lo_bits, size_bits;
-       u32     (*map_to_field)(u32 val, u32 num_bits);
-
-       DBG("set 64bit window: %d, base hi: 0x%x, base lo: 0x%x, " \
-               "size: 0x%x, other: 0x%x\n",
-               window, base_hi, base_lo, size, other_bits);
-
-       base_lo_reg = bh->ci->window_tab_64bit[window].base_lo_reg;
-
-       if (base_lo_reg != 0) {
-               size_reg = bh->ci->window_tab_64bit[window].size_reg;
-               base_lo_bits = bh->ci->window_tab_64bit[window].base_lo_bits;
-               size_bits = bh->ci->window_tab_64bit[window].size_bits;
-               map_to_field = bh->ci->window_tab_64bit[window].map_to_field;
-
-               mv64x60_write(bh, bh->ci->window_tab_64bit[window].base_hi_reg,
-                       base_hi);
-
-               val = map_to_field(base_lo, base_lo_bits) | other_bits;
-               mv64x60_write(bh, base_lo_reg, val);
-
-               if (size_reg != 0) {
-                       val = bh->ci->translate_size(base_lo, size, size_bits);
-                       val = map_to_field(val, size_bits);
-                       mv64x60_write(bh, size_reg, val);
-               }
-
-               (void)mv64x60_read(bh, base_lo_reg); /* Flush FIFO */
-       }
-
-       return;
-}
-
-/*
- * mv64x60_mask()
- *
- * Take the high-order 'num_bits' of 'val' & mask off low bits.
- */
-static u32 __init
-mv64x60_mask(u32 val, u32 num_bits)
-{
-       DBG("mask val: 0x%x, num_bits: %d == 0x%x\n", val,
-               num_bits, val & (0xffffffff << (32 - num_bits)));
-
-       return val & (0xffffffff << (32 - num_bits));
-}
-
-/*
- * mv64x60_mask_shift_left()
- *
- * Take the low-order 'num_bits' of 'val', shift left to align at bit 31 (MSB).
- */
-static u32 __init
-mv64x60_shift_left(u32 val, u32 num_bits)
-{
-       DBG("shift left val: 0x%x, num_bits: %d == 0x%x\n", val,
-               num_bits, val << (32 - num_bits));
-
-       return val << (32 - num_bits);
-}
-
-/*
- * mv64x60_shift_right()
- *
- * Take the high-order 'num_bits' of 'val', shift right to align at bit 0 (LSB).
- */
-static u32 __init
-mv64x60_shift_right(u32 val, u32 num_bits)
-{
-       DBG("shift right val: 0x%x, num_bits: %d == 0x%x\n", val, num_bits,
-               val >> (32 - num_bits));
-
-       return val >> (32 - num_bits);
-}
-
-/*
- *****************************************************************************
- *
- *     Early Init Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_early_init()
- *
- * Do some bridge work that must take place before we start messing with
- * the bridge for real.
- */
-static void __init
-mv64x60_early_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       memset(bh, 0, sizeof(*bh));
-
-       bh->p_base = si->phys_reg_base;
-       bh->v_base = (u32)ioremap(bh->p_base, MV64x60_INTERNAL_SPACE_SIZE);
-       bh->base_irq = si->base_irq;
-
-       /* Bit 12 MUST be 0; set bit 27--don't auto-update cpu remap regs */
-       mv64x60_clr_bits(bh, MV64x60_CPU_CONFIG, (1<<12));
-       mv64x60_set_bits(bh, MV64x60_CPU_CONFIG, (1<<27));
-
-       /*
-        * Turn off timer/counters.  Not turning off watchdog timer because
-        * can't read its reg on the 64260A so don't know if we'll be enabling
-        * or disabling.
-        */
-       mv64x60_clr_bits(bh, MV64x60_TIMR_CNTR_0_3_CNTL,
-                       ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
-
-#ifdef CONFIG_GT64260
-       mv64x60_clr_bits(bh, GT64260_TIMR_CNTR_4_7_CNTL,
-                       ((1<<0) | (1<<8) | (1<<16) | (1<<24)));
-#endif
-
-#if 0
-XXXX Put in PCI_x_RETRY adjustment XXXX
-#endif
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     Chip Identification Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_get_type()
- *
- * Determine the type of bridge chip we have.
- */
-static int __init mv64x60_get_type(struct mv64x60_handle *bh)
-{
-       struct pci_controller *hose = bh->hose_a;
-       int pcidev;
-       int devfn;
-       u16 val;
-       u8 save_exclude;
-
-       pcidev = (mv64x60_read(bh, MV64x60_PCI0_P2P_CONFIG) >> 24) & 0xf;
-       devfn = PCI_DEVFN(pcidev, 0); 
-
-       save_exclude = mv64x60_pci_exclude_bridge;
-       mv64x60_pci_exclude_bridge = FALSE;
-
-       /* Sanity check of bridge's Vendor ID */
-       early_read_config_word(hose, 0, devfn, PCI_VENDOR_ID, &val);
-
-       if (val != PCI_VENDOR_ID_MARVELL)
-               return -1;
-
-       /* Figure out the type of Marvell bridge it is */
-       early_read_config_word(hose, 0, devfn, PCI_DEVICE_ID, &val);
-
-       switch (val) {
-       case PCI_DEVICE_ID_MARVELL_GT64260:
-               early_read_config_word(hose, 0, devfn,
-                                      PCI_CLASS_REVISION, &val);
-
-               switch (val & 0xff) {
-               case GT64260_REV_A:
-                       bh->type = MV64x60_TYPE_GT64260A;
-                       break;
-               case GT64260_REV_B:
-                       bh->type = MV64x60_TYPE_GT64260B;
-                       break;
-               }
-               break;
-
-       case PCI_DEVICE_ID_MARVELL_MV64360:
-               /* Marvell won't tell me how to distinguish a 64361 & 64362 */
-               bh->type = MV64x60_TYPE_MV64360;
-               break;
-
-       case PCI_DEVICE_ID_MARVELL_MV64460:
-               bh->type = MV64x60_TYPE_MV64460;
-               break;
-
-       default:
-               printk(KERN_CRIT "Unknown Marvell bridge type %04x\n", val);
-               return -1;
-       }
-
-       mv64x60_pci_exclude_bridge = save_exclude;
-       return 0;
-}
-
-/*
- * mv64x60_setup_for_chip()
- *
- * Set 'bh' to use the proper set of routine for the bridge chip that we have.
- */
-static int __init
-mv64x60_setup_for_chip(mv64x60_handle_t *bh)
-{
-       int     rc = 0;
-
-       /* Set up chip-specific info based on the chip/bridge type */
-       switch(bh->type) {
-               case MV64x60_TYPE_GT64260A:
-                       bh->ci = &gt64260a_ci;
-                       break;
-
-               case MV64x60_TYPE_GT64260B:
-                       bh->ci = &gt64260b_ci;
-                       break;
-
-               case MV64x60_TYPE_MV64360:
-                       bh->ci = &mv64360_ci;
-                       break;
-
-#if 0 /* Marvell won't tell me how to distinguish--MAG */
-               case MV64x60_TYPE_MV64361:
-               case MV64x60_TYPE_MV64362:
-#endif
-               case MV64x60_TYPE_MV64460:
-                       bh->ci = &mv64460_ci;
-                       break;
-
-               case MV64x60_TYPE_INVALID:
-               default:
-                       if (ppc_md.progress)
-                               ppc_md.progress("mv64x60: Unsupported bridge",
-                                                                       0x0);
-                       printk("mv64x60: Unsupported bridge\n");
-                       rc = -1;
-       }
-
-       return rc;
-}
-
-/*
- *****************************************************************************
- *
- *     System Memory Window Related Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_get_mem_windows()
- *
- * Get the values in the memory controller & return in the 'mem_windows' array.
- */
-static void __init
-mv64x60_get_mem_windows(mv64x60_handle_t *bh,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
-{
-       u32     i;
-       u32     windows[] = { MV64x60_CPU2MEM_0_WIN, MV64x60_CPU2MEM_1_WIN,
-                               MV64x60_CPU2MEM_2_WIN, MV64x60_CPU2MEM_3_WIN };
-
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               if (bh->ci->is_enabled_32bit(bh, i)) {
-                       mv64x60_get_32bit_window(bh, windows[i],
-                               &mem_windows[i][0], &mem_windows[i][1]);
-               }
-               else {
-                       mem_windows[i][0] = 0;
-                       mem_windows[i][1] = 0;
-               }
-       }
-
-       return;
-}
-
-/*
- * mv64x60_calc_mem_size()
- *
- * Using the memory controller register values in 'mem_windows', determine
- * how much memory it is set up for.
- */
-static u32 __init
-mv64x60_calc_mem_size(mv64x60_handle_t *bh,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
-{
-       u32     i, total = 0;
-
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               total += mem_windows[i][1];
-       }
-
-       return total;
-}
-
-/*
- *****************************************************************************
- *
- *     CPU->System MEM Config Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_config_cpu2mem_windows()
- *
- * Configure CPU->Memory windows on the bridge.
- */
-static void __init
-mv64x60_config_cpu2mem_windows(mv64x60_handle_t *bh, mv64x60_setup_info_t *si,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
-{
-       u32     i;
-       u32     prot_windows[] = {
-                       MV64x60_CPU_PROT_0_WIN, MV64x60_CPU_PROT_1_WIN,
-                       MV64x60_CPU_PROT_2_WIN, MV64x60_CPU_PROT_3_WIN };
-       u32     cpu_snoop_windows[] = {
-                       MV64x60_CPU_SNOOP_0_WIN, MV64x60_CPU_SNOOP_1_WIN,
-                       MV64x60_CPU_SNOOP_2_WIN, MV64x60_CPU_SNOOP_3_WIN };
-
-       /* Set CPU protection & snoop windows */
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               if (bh->ci->is_enabled_32bit(bh, i)) {
-                       mv64x60_set_32bit_window(bh, prot_windows[i],
-                               mem_windows[i][0], mem_windows[i][1],
-                               si->cpu_prot_options[i]);
-                       bh->ci->enable_window_32bit(bh, prot_windows[i]);
-
-                       if (bh->ci->window_tab_32bit[cpu_snoop_windows[i]].
-                                                               base_reg != 0) {
-                               mv64x60_set_32bit_window(bh,
-                                       cpu_snoop_windows[i], mem_windows[i][0],
-                                       mem_windows[i][1],
-                                       si->cpu_snoop_options[i]);
-                               bh->ci->enable_window_32bit(bh,
-                                       cpu_snoop_windows[i]);
-                       }
-
-               }
-       }
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     CPU->PCI Config Routines
- *
- *****************************************************************************
- */
-
-/*
- * mv64x60_config_cpu2pci_windows()
- *
- * Configure the CPU->PCI windows on the bridge.
- */
-static void __init
-mv64x60_config_cpu2pci_windows(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       if (ppc_md.progress)
-               ppc_md.progress("mv64x60_config_bridge: Enter", 0x0);
-
-       /*
-        * Set up various parts of the bridge including CPU->PCI windows.
-        * Depending on the board, there may be only one hose that needs to
-        * be set up.
-        */
-       if (si->pci_0.enable_bus) {
-               u32     win_tab[] = { MV64x60_CPU2PCI0_IO_WIN,
-                               MV64x60_CPU2PCI0_MEM_0_WIN,
-                               MV64x60_CPU2PCI0_MEM_1_WIN,
-                               MV64x60_CPU2PCI0_MEM_2_WIN };
-               u32     remap_tab[] = { MV64x60_CPU2PCI0_IO_REMAP_WIN,
-                               MV64x60_CPU2PCI0_MEM_0_REMAP_WIN,
-                               MV64x60_CPU2PCI0_MEM_1_REMAP_WIN,
-                               MV64x60_CPU2PCI0_MEM_2_REMAP_WIN };
-
-               mv64x60_set_cpu2pci_window(bh, &si->pci_0, win_tab, remap_tab);
-       }
-
-       if (si->pci_1.enable_bus) {
-               u32     win_tab[] = { MV64x60_CPU2PCI1_IO_WIN,
-                               MV64x60_CPU2PCI1_MEM_0_WIN,
-                               MV64x60_CPU2PCI1_MEM_1_WIN,
-                               MV64x60_CPU2PCI1_MEM_2_WIN };
-               u32     remap_tab[] = { MV64x60_CPU2PCI1_IO_REMAP_WIN,
-                               MV64x60_CPU2PCI1_MEM_0_REMAP_WIN,
-                               MV64x60_CPU2PCI1_MEM_1_REMAP_WIN,
-                               MV64x60_CPU2PCI1_MEM_2_REMAP_WIN };
-
-               mv64x60_set_cpu2pci_window(bh, &si->pci_1, win_tab, remap_tab);
-       }
-
-       return;
-} /* mv64x60_config_bridge() */
-
-/*
- * mv64x60_set_cpu2pci_window()
- *
- * Configure the CPU->PCI windows for one of the PCI buses.
- */
-static void __init
-mv64x60_set_cpu2pci_window(mv64x60_handle_t *bh, mv64x60_pci_info_t *pi,
-                                               u32 *win_tab, u32 *remap_tab)
-{
-       int     i;
-
-       if (pi->pci_io.size > 0) {
-               mv64x60_set_32bit_window(bh, win_tab[0], pi->pci_io.cpu_base,
-                                       pi->pci_io.size, pi->pci_io.swap);
-               mv64x60_set_32bit_window(bh, remap_tab[0],
-                                       pi->pci_io.pci_base_lo, 0, 0);
-               bh->ci->enable_window_32bit(bh, win_tab[0]);
-       }
-       else { /* Actually, the window should already be disabled */
-               bh->ci->disable_window_32bit(bh, win_tab[0]);
-       }
-
-       for (i=0; i<3; i++) {
-               if (pi->pci_mem[i].size > 0) {
-                       mv64x60_set_32bit_window(bh, win_tab[i+1],
-                               pi->pci_mem[i].cpu_base, pi->pci_mem[i].size,
-                               pi->pci_mem[i].swap);
-                       mv64x60_set_64bit_window(bh, remap_tab[i+1],
-                               pi->pci_mem[i].pci_base_hi,
-                               pi->pci_mem[i].pci_base_lo, 0, 0);
-                       bh->ci->enable_window_32bit(bh, win_tab[i+1]);
-               }
-               else { /* Actually, the window should already be disabled */
-                       bh->ci->disable_window_32bit(bh, win_tab[i+1]);
-               }
-       }
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     PCI->System MEM Config Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_config_pci2mem_windows()
- *
- * Configure the PCI->Memory windows on the bridge.
- */
-static void __init
-mv64x60_config_pci2mem_windows(mv64x60_handle_t *bh, mv64x60_setup_info_t *si,
-       u32 mem_windows[MV64x60_CPU2MEM_WINDOWS][2])
-{
-       u32     i;
-       u32     pci_0_acc_windows[] = {
-                       MV64x60_PCI02MEM_ACC_CNTL_0_WIN,
-                       MV64x60_PCI02MEM_ACC_CNTL_1_WIN,
-                       MV64x60_PCI02MEM_ACC_CNTL_2_WIN,
-                       MV64x60_PCI02MEM_ACC_CNTL_3_WIN };
-       u32     pci_1_acc_windows[] = {
-                       MV64x60_PCI12MEM_ACC_CNTL_0_WIN,
-                       MV64x60_PCI12MEM_ACC_CNTL_1_WIN,
-                       MV64x60_PCI12MEM_ACC_CNTL_2_WIN,
-                       MV64x60_PCI12MEM_ACC_CNTL_3_WIN };
-       u32     pci_0_snoop_windows[] = {
-                       MV64x60_PCI02MEM_SNOOP_0_WIN,
-                       MV64x60_PCI02MEM_SNOOP_1_WIN,
-                       MV64x60_PCI02MEM_SNOOP_2_WIN,
-                       MV64x60_PCI02MEM_SNOOP_3_WIN };
-       u32     pci_1_snoop_windows[] = {
-                       MV64x60_PCI12MEM_SNOOP_0_WIN,
-                       MV64x60_PCI12MEM_SNOOP_1_WIN,
-                       MV64x60_PCI12MEM_SNOOP_2_WIN,
-                       MV64x60_PCI12MEM_SNOOP_3_WIN };
-       u32     pci_0_size[] = {
-                       MV64x60_PCI0_MEM_0_SIZE, MV64x60_PCI0_MEM_1_SIZE,
-                       MV64x60_PCI0_MEM_2_SIZE, MV64x60_PCI0_MEM_3_SIZE };
-       u32     pci_1_size[] = {
-                       MV64x60_PCI1_MEM_0_SIZE, MV64x60_PCI1_MEM_1_SIZE,
-                       MV64x60_PCI1_MEM_2_SIZE, MV64x60_PCI1_MEM_3_SIZE };
-
-       /* Clear bit 0 of PCI addr decode control so PCI->CPU remap 1:1 */
-       mv64x60_clr_bits(bh, MV64x60_PCI0_PCI_DECODE_CNTL, 0x00000001);
-       mv64x60_clr_bits(bh, MV64x60_PCI1_PCI_DECODE_CNTL, 0x00000001);
-
-       /*
-        * Set the access control, snoop, BAR size, and window base addresses.
-        * PCI->MEM windows base addresses will match exactly what the
-        * CPU->MEM windows are.
-        */
-       for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) {
-               if (bh->ci->is_enabled_32bit(bh, i)) {
-                       if (si->pci_0.enable_bus) {
-                               mv64x60_set_64bit_window(bh,
-                                       pci_0_acc_windows[i], 0,
-                                       mem_windows[i][0], mem_windows[i][1],
-                                       si->pci_0.acc_cntl_options[i]);
-                               bh->ci->enable_window_64bit(bh,
-                                       pci_0_acc_windows[i]);
-
-                               if (bh->ci->window_tab_64bit[
-                                       pci_0_snoop_windows[i]].base_lo_reg
-                                                                       != 0) {
-                                       mv64x60_set_64bit_window(bh,
-                                               pci_0_snoop_windows[i], 0,
-                                               mem_windows[i][0],
-                                               mem_windows[i][1],
-                                               si->pci_0.snoop_options[i]);
-                                       bh->ci->enable_window_64bit(bh,
-                                               pci_0_snoop_windows[i]);
-                               }
-
-                               bh->ci->set_pci2mem_window(bh->hose_a, i,
-                                       mem_windows[i][0]);
-                               mv64x60_write(bh, pci_0_size[i],
-                                       mv64x60_mask(mem_windows[i][1] -1, 20));
-
-                               /* Enable the window */
-                               mv64x60_clr_bits(bh, MV64x60_PCI0_BAR_ENABLE,
-                                                                       1 << i);
-                       }
-                       if (si->pci_1.enable_bus) {
-                               mv64x60_set_64bit_window(bh,
-                                       pci_1_acc_windows[i], 0,
-                                       mem_windows[i][0], mem_windows[i][1],
-                                       si->pci_1.acc_cntl_options[i]);
-                               bh->ci->enable_window_64bit(bh,
-                                       pci_1_acc_windows[i]);
-
-                               if (bh->ci->window_tab_64bit[
-                                       pci_1_snoop_windows[i]].base_lo_reg
-                                                                       != 0) {
-                                       mv64x60_set_64bit_window(bh,
-                                               pci_1_snoop_windows[i], 0,
-                                               mem_windows[i][0],
-                                               mem_windows[i][1],
-                                               si->pci_1.snoop_options[i]);
-                                       bh->ci->enable_window_64bit(bh,
-                                               pci_1_snoop_windows[i]);
-                               }
-
-                               bh->ci->set_pci2mem_window(bh->hose_b, i,
-                                       mem_windows[i][0]);
-                               mv64x60_write(bh, pci_1_size[i],
-                                       mv64x60_mask(mem_windows[i][1] -1, 20));
-
-                               /* Enable the window */
-                               mv64x60_clr_bits(bh, MV64x60_PCI1_BAR_ENABLE,
-                                                                       1 << i);
-                       }
-               }
-       }
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     Hose & Resource Alloc/Init Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_alloc_hoses()
- *
- * Allocate the PCI hose structures for the bridge's PCI buses.
- */
-static void __init
-mv64x60_alloc_hoses(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       /*
-        * Alloc first hose struct even when its not to be configured b/c the
-        * chip identification routines need to use it.
-        */
-       bh->hose_a = pcibios_alloc_controller();
-       setup_indirect_pci(bh->hose_a,
-               bh->p_base + MV64x60_PCI0_CONFIG_ADDR,
-               bh->p_base + MV64x60_PCI0_CONFIG_DATA);
-
-       if (si->pci_1.enable_bus) {
-               bh->hose_b = pcibios_alloc_controller();
-               setup_indirect_pci(bh->hose_b,
-                       bh->p_base + MV64x60_PCI1_CONFIG_ADDR,
-                       bh->p_base + MV64x60_PCI1_CONFIG_DATA);
-       }
-
-       return;
-}
-
-/*
- * mv64x60_init_hoses()
- *
- * Initialize the PCI hose structures for the bridge's PCI hoses.
- */
-static void __init
-mv64x60_init_hoses(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       if (si->pci_1.enable_bus) {
-               bh->io_base_b = (u32)ioremap(si->pci_1.pci_io.cpu_base,
-                                                       si->pci_1.pci_io.size);
-               isa_io_base = bh->io_base_b;
-       }
-
-       if (si->pci_0.enable_bus) {
-               bh->io_base_a = (u32)ioremap(si->pci_0.pci_io.cpu_base,
-                                                       si->pci_0.pci_io.size);
-               isa_io_base = bh->io_base_a;
-
-               mv64x60_init_resources(bh->hose_a, &si->pci_0, bh->io_base_a);
-               mv64x60_set_pci_params(bh->hose_a, &si->pci_0);
-       }
-
-       /* Must do here so proper isa_io_base is used in calculations */
-       if (si->pci_1.enable_bus) {
-               mv64x60_init_resources(bh->hose_b, &si->pci_1, bh->io_base_b);
-               mv64x60_set_pci_params(bh->hose_b, &si->pci_1);
-       }
-
-       return;
-}
-
-/*
- * mv64x60_init_resources()
- *
- * Calculate the offsets, etc. for the hose structures to reflect all of
- * the address remapping that happens as you go from CPU->PCI and PCI->MEM.
- */
-static void __init
-mv64x60_init_resources(struct pci_controller *hose, mv64x60_pci_info_t *pi,
-                               u32 io_base)
-{
-       int             i;
-       /* 2 hoses; 4 resources/hose; sting <= 64 bytes; not work if > 1 chip */
-       static char     s[2][4][64];
-
-       if (pi->pci_io.size != 0) {
-               sprintf(s[hose->index][0], "PCI hose %d I/O Space",
-                       hose->index);
-               pci_init_resource(&hose->io_resource, io_base - isa_io_base,
-                       io_base - isa_io_base + pi->pci_io.size - 1,
-                       IORESOURCE_IO, s[hose->index][0]);
-               hose->io_space.start = pi->pci_io.pci_base_lo;
-               hose->io_space.end = pi->pci_io.pci_base_lo + pi->pci_io.size-1;
-               hose->io_base_virt = (void *)isa_io_base;
-       }
-
-       for (i=0; i<3; i++) {
-               if (pi->pci_mem[i].size != 0) {
-                       sprintf(s[hose->index][i+1], "PCI hose %d MEM Space %d",
-                               hose->index, i);
-                       pci_init_resource(&hose->mem_resources[i],
-                               pi->pci_mem[i].cpu_base,
-                               pi->pci_mem[i].cpu_base + pi->pci_mem[i].size-1,
-                               IORESOURCE_MEM, s[hose->index][i+1]);
-               }
-       }
-       
-       hose->mem_space.end = pi->pci_mem[0].pci_base_lo +
-                                               pi->pci_mem[0].size - 1;
-       hose->pci_mem_offset = pi->pci_mem[0].cpu_base -
-                                               pi->pci_mem[0].pci_base_lo;
-
-       return;
-} /* mv64x60_init_resources() */
-
-/*
- * mv64x60_set_pci_params()
- *
- * Configure a hose's PCI config space parameters.
- */
-static void __init
-mv64x60_set_pci_params(struct pci_controller *hose, mv64x60_pci_info_t *pi)
-{
-       u32     devfn;
-       u16     u16_val;
-       u8      save_exclude;
-
-       devfn = PCI_DEVFN(0,0);
-
-       save_exclude = mv64x60_pci_exclude_bridge;
-       mv64x60_pci_exclude_bridge = FALSE;
-
-       /* Set class code to indicate host bridge */
-       u16_val = PCI_CLASS_BRIDGE_HOST; /* 0x0600 (host bridge) */
-       early_write_config_word(hose, 0, devfn, PCI_CLASS_DEVICE, u16_val);
-
-       /* Enable 64260 to be PCI master & respond to PCI MEM cycles */
-       early_read_config_word(hose, 0, devfn, PCI_COMMAND, &u16_val);
-       u16_val &= ~(PCI_COMMAND_IO | PCI_COMMAND_INVALIDATE |
-               PCI_COMMAND_PARITY | PCI_COMMAND_SERR | PCI_COMMAND_FAST_BACK);
-       u16_val |= pi->pci_cmd_bits | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
-       early_write_config_word(hose, 0, devfn, PCI_COMMAND, u16_val);
-
-       /* Set latency timer, cache line size, clear BIST */
-       u16_val = (pi->latency_timer << 8) | (L1_CACHE_LINE_SIZE >> 2);
-       early_write_config_word(hose, 0, devfn, PCI_CACHE_LINE_SIZE, u16_val);
-
-       mv64x60_pci_exclude_bridge = save_exclude;
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     PCI Related Routine
- *
- *****************************************************************************
- */
-/*
- * mv64x60_enumerate_buses()
- *
- * If requested, enumerate the PCI buses and set the appropriate
- * info in the hose structures.
- */
-static void __init
-mv64x60_enumerate_buses(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       u32     val;
-
-       pci_dram_offset = 0; /* System mem at same addr on PCI & cpu bus */
-
-       ppc_md.pci_exclude_device = mv64x60_pci_exclude_device;
-       ppc_md.pci_swizzle = common_swizzle;
-       ppc_md.pci_map_irq = si->map_irq;
-
-       /* Now that the bridge is set up, its safe to scan the PCI buses */
-       if (si->pci_0.enable_bus) {
-               if (si->pci_0.enumerate_bus) {
-                       /* Set bus number for PCI 0 to 0 */
-                       val = mv64x60_read(bh, MV64x60_PCI0_P2P_CONFIG);
-                       val &= 0xe0000000;
-                       val |= 0x000000ff;
-                       mv64x60_write(bh, MV64x60_PCI0_P2P_CONFIG, val);
-                       /* Flush FIFO*/
-                       (void)mv64x60_read(bh, MV64x60_PCI0_P2P_CONFIG);
-
-#if 0
-XXXX Different if in PCI-X mode (look at mv64360_find_bridges()) XXXX
-#endif
-
-                       bh->hose_a->first_busno = 0;
-                       bh->hose_a->last_busno  = 0xff;
-
-                       bh->hose_a->last_busno = pciauto_bus_scan(bh->hose_a,
-                                               bh->hose_a->first_busno);
-               }
-               else {
-                       /* Assume bridge set up correctly by someone else */
-                       val = mv64x60_read(bh, MV64x60_PCI0_P2P_CONFIG);
-                       bh->hose_a->first_busno = (val & 0x00ff0000) >> 16;
-               }
-       }
-
-       if (si->pci_1.enable_bus) {
-               if (si->pci_1.enumerate_bus) {
-                       if (si->pci_0.enable_bus) {
-                               bh->hose_b->first_busno =
-                                       bh->hose_a->last_busno + 1;
-
-                               /* Set bus number for PCI 1 hose */
-                               val = mv64x60_read(bh, MV64x60_PCI1_P2P_CONFIG);
-                               val &= 0xe0000000;
-                               val |= (bh->hose_b->first_busno << 16) | 0xff;
-                               mv64x60_write(bh, MV64x60_PCI1_P2P_CONFIG, val);
-                               /* Flush FIFO */
-                               (void)mv64x60_read(bh, MV64x60_PCI1_P2P_CONFIG);
-                       }
-                       else {
-                               bh->hose_b->first_busno = 0;
-                       }
-
-                       bh->hose_b->last_busno  = 0xff;
-                       bh->hose_b->last_busno = pciauto_bus_scan(bh->hose_b,
-                                               bh->hose_b->first_busno);
-               }
-               else {
-                       /* Assume bridge set up correctly by someone else */
-                       val = mv64x60_read(bh, MV64x60_PCI1_P2P_CONFIG);
-                       bh->hose_b->first_busno = (val & 0x00ff0000) >> 16;
-                       bh->hose_b->last_busno = 0xff; /* No way to know */
-               }
-       }
-
-       if (si->pci_0.enable_bus && !si->pci_0.enumerate_bus) {
-               if (si->pci_1.enable_bus) {
-                       bh->hose_a->last_busno = bh->hose_b->first_busno - 1;
-               }
-               else {
-                       bh->hose_a->last_busno = 0xff; /* No way to know */
-               }
-       }
-
-       return;
-}
-
-/*
- * mv64x60_exclude_pci_device()
- *
- * This routine is used to make the bridge not appear when the
- * PCI subsystem is accessing PCI devices (in PCI config space).
- */
-static int
-mv64x60_pci_exclude_device(u8 bus, u8 devfn)
-{
-       struct pci_controller   *hose;
-
-       hose = pci_bus_to_hose(bus);
-
-       /* Skip slot 0 on both hoses */
-       if ((mv64x60_pci_exclude_bridge == TRUE) &&
-           (PCI_SLOT(devfn) == 0) &&
-           (hose->first_busno == bus)) {
-               return PCIBIOS_DEVICE_NOT_FOUND;
-       }
-       else {
-               return PCIBIOS_SUCCESSFUL;
-       }
-} /* mv64x60_pci_exclude_device() */
-
-/*
- *****************************************************************************
- *
- *     OCP Fixup Routines
- *
- *****************************************************************************
- */
-/*
- * mv64x60_fixup_ocp()
- *
- * Adjust the 'paddr' field in the bridge's OCP entries to reflect where they
- * really are in the physical address space.
- */
-static void __init
-mv64x60_fixup_ocp(struct ocp_device *dev, void *arg)
-{
-       mv64x60_handle_t        *bh = (mv64x60_handle_t *)arg;
-
-       if (dev->def->vendor == OCP_VENDOR_MARVELL) {
-               dev->def->paddr += bh->p_base;
-       }
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     GT64260-Specific Routines
- *
- *****************************************************************************
- */
-/*
- * gt64260_translate_size()
- *
- * On the GT64260, the size register is really the "top" address of the window.
- */
-static u32 __init
-gt64260_translate_size(u32 base, u32 size, u32 num_bits)
-{
-       return base + mv64x60_mask(size - 1, num_bits);
-}
-
-/*
- * gt64260_untranslate_size()
- *
- * Translate the top address of a window into a window size.
- */
-static u32 __init
-gt64260_untranslate_size(u32 base, u32 size, u32 num_bits)
-{
-       if (size >= base) {
-               size = size - base + (1 << (32 - num_bits));
-       }
-       else {
-               size = 0;
-       }
-
-       return size;
-}
-
-/*
- * gt64260_set_pci2mem_window()
- *
- * The PCI->MEM window registers are actually in PCI config space so need
- * to set them by setting the correct config space BARs.
- */
-static void __init
-gt64260_set_pci2mem_window(struct pci_controller *hose, u32 window, u32 base)
-{
-       u32     reg_addrs[] = { 0x10, 0x14, 0x18, 0x1c };
-
-       DBG("set pci->mem window: %d, hose: %d, base: 0x%x\n", window,
-               hose->index, base);
-
-       early_write_config_dword(hose, hose->first_busno,
-                       PCI_DEVFN(0, 0), reg_addrs[window],
-                       mv64x60_mask(base, 20) | 0x8);
-       return;
-}
-
-/*
- * gt64260_is_enabled_32bit()
- *
- * On a GT64260, a window is enabled iff its top address is >= to its base
- * address.
- */
-static u32 __init
-gt64260_is_enabled_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       u32     rc = 0;
-
-       if ((gt64260_32bit_windows[window].base_reg != 0) &&
-               (gt64260_32bit_windows[window].size_reg != 0) &&
-               ((mv64x60_read(bh, gt64260_32bit_windows[window].size_reg) &
-                       ((1 << gt64260_32bit_windows[window].size_bits) - 1)) >=
-                (mv64x60_read(bh, gt64260_32bit_windows[window].base_reg) &
-                       ((1 << gt64260_32bit_windows[window].base_bits) - 1)))){
-
-               rc = 1;
-       }
-
-       if (rc) {
-               DBG("32bit window %d is enabled\n", window);
-       }
-       else {
-               DBG("32bit window %d is disabled\n", window);
-       }
-
-       return rc;
-}
-
-/*
- * gt64260_enable_window_32bit()
- *
- * On the GT64260, a window is enabled iff the top address is >= to the base
- * address of the window.  Since the window has already been configured by
- * the time this routine is called, we have nothing to do here.
- */
-static void __init
-gt64260_enable_window_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("enable 32bit window: %d\n", window);
-       return;
-}
-
-/*
- * gt64260_disable_window_32bit()
- *
- * On a GT64260, you disable a window by setting its top address to be less
- * than its base address.
- */
-static void __init
-gt64260_disable_window_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("disable 32bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
-               window, gt64260_32bit_windows[window].base_reg,
-               gt64260_32bit_windows[window].size_reg);
-
-       if ((gt64260_32bit_windows[window].base_reg != 0) &&
-               (gt64260_32bit_windows[window].size_reg != 0)) {
-
-               /* To disable, make bottom reg higher than top reg */
-               mv64x60_write(bh, gt64260_32bit_windows[window].base_reg,0xfff);
-               mv64x60_write(bh, gt64260_32bit_windows[window].size_reg, 0);
-       }
-
-       return;
-}
-
-/*
- * gt64260_enable_window_64bit()
- *
- * On the GT64260, a window is enabled iff the top address is >= to the base
- * address of the window.  Since the window has already been configured by
- * the time this routine is called, we have nothing to do here.
- */
-static void __init
-gt64260_enable_window_64bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("enable 64bit window: %d\n", window);
-       return; /* Enabled when window configured (i.e., when top >= base) */
-}
-
-/*
- * gt64260_disable_window_64bit()
- *
- * On a GT64260, you disable a window by setting its top address to be less
- * than its base address.
- */
-static void __init
-gt64260_disable_window_64bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("disable 64bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
-               window, gt64260_64bit_windows[window].base_lo_reg,
-               gt64260_64bit_windows[window].size_reg);
-
-       if ((gt64260_64bit_windows[window].base_lo_reg != 0) &&
-               (gt64260_64bit_windows[window].size_reg != 0)) {
-
-               /* To disable, make bottom reg higher than top reg */
-               mv64x60_write(bh, gt64260_64bit_windows[window].base_lo_reg,
-                                                                       0xfff);
-               mv64x60_write(bh, gt64260_64bit_windows[window].base_hi_reg, 0);
-               mv64x60_write(bh, gt64260_64bit_windows[window].size_reg, 0);
-       }
-
-       return;
-}
-
-/*
- * gt64260_disable_all_windows()
- *
- * The GT64260 has several windows that aren't represented in the table of
- * windows at the top of this file.  This routine turns all of them off
- * except for the memory controller windows, of course.
- */
-static void __init
-gt64260_disable_all_windows(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       u32     i;
-
-       /* Disable 32bit windows (don't disable cpu->mem windows) */
-       for (i=MV64x60_CPU2DEV_0_WIN; i<MV64x60_32BIT_WIN_COUNT; i++) {
-               if (!(si->window_preserve_mask_32 & (1<<i)))
-                       gt64260_disable_window_32bit(bh, i);
-       }
-
-       /* Disable 64bit windows */
-       for (i=0; i<MV64x60_64BIT_WIN_COUNT; i++) {
-               if (!(si->window_preserve_mask_64 & (1<<i)))
-                       gt64260_disable_window_64bit(bh, i);
-       }
-
-       /* Turn off cpu protection windows not in gt64260_32bit_windows[] */
-       mv64x60_write(bh, GT64260_CPU_PROT_BASE_4, 0xfff);
-       mv64x60_write(bh, GT64260_CPU_PROT_SIZE_4, 0);
-       mv64x60_write(bh, GT64260_CPU_PROT_BASE_5, 0xfff);
-       mv64x60_write(bh, GT64260_CPU_PROT_SIZE_5, 0);
-       mv64x60_write(bh, GT64260_CPU_PROT_BASE_6, 0xfff);
-       mv64x60_write(bh, GT64260_CPU_PROT_SIZE_6, 0);
-       mv64x60_write(bh, GT64260_CPU_PROT_BASE_7, 0xfff);
-       mv64x60_write(bh, GT64260_CPU_PROT_SIZE_7, 0);
-
-       /* Turn off PCI->MEM access cntl wins not in gt64260_64bit_windows[] */
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_LO, 0xfff);
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_HI, 0);
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_4_SIZE, 0);
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_LO, 0xfff);
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_HI, 0);
-       mv64x60_write(bh, MV64x60_PCI0_ACC_CNTL_5_SIZE, 0);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_BASE_LO, 0xfff);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_BASE_HI, 0);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_6_SIZE, 0);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_BASE_LO, 0xfff);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_BASE_HI, 0);
-       mv64x60_write(bh, GT64260_PCI0_ACC_CNTL_7_SIZE, 0);
-
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_LO, 0xfff);
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_HI, 0);
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_4_SIZE, 0);
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_LO, 0xfff);
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_HI, 0);
-       mv64x60_write(bh, MV64x60_PCI1_ACC_CNTL_5_SIZE, 0);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_BASE_LO, 0xfff);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_BASE_HI, 0);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_6_SIZE, 0);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_BASE_LO, 0xfff);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_BASE_HI, 0);
-       mv64x60_write(bh, GT64260_PCI1_ACC_CNTL_7_SIZE, 0);
-
-       /* Disable all PCI-><whatever> windows */
-       mv64x60_set_bits(bh, MV64x60_PCI0_BAR_ENABLE, 0x07ffffff);
-       mv64x60_set_bits(bh, MV64x60_PCI1_BAR_ENABLE, 0x07ffffff);
-
-       return;
-}
-
-/*
- * gt64260a_chip_specific_init()
- *
- * Implement errata work arounds for the GT64260A.
- */
-static void
-gt64260a_chip_specific_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       struct ocp_device       *dev;
-       mv64x60_ocp_mpsc_data_t *mpsc_dp;
-       u8                      save_exclude;
-       u32                     val;
-
-       /* R#18 */
-       /* cpu read buffer to buffer 1 (reg 0x0448) */
-       mv64x60_set_bits(bh, GT64260_SDRAM_CONFIG, (1<<26));
-
-       /* No longer errata so turn on */
-       /* Enable pci read/write combine, master write trigger,
-       * disable slave sync barrier
-       * readmultiple (reg 0x0c00 and 0x0c80)
-       */
-       if (si->pci_0.enable_bus) {
-               mv64x60_set_bits(bh, MV64x60_PCI0_CMD,
-                       ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
-       }
-
-       if (si->pci_1.enable_bus) {
-               mv64x60_set_bits(bh, MV64x60_PCI1_CMD,
-                       ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
-       }
-
-#if 1  /* XXXX */
-       /*
-        * Dave Wilhardt found that bit 4 in the PCI Command registers must
-        * be set if you are using cache coherency.
-        *
-        * Note: he also said that bit 4 must be on in all PCI devices but
-        *       that has not been implemented yet.
-        */
-       save_exclude = mv64x60_pci_exclude_bridge;
-       mv64x60_pci_exclude_bridge = FALSE;
-
-       early_read_config_dword(bh->hose_a,
-                       bh->hose_a->first_busno,
-                       PCI_DEVFN(0,0),
-                       PCI_COMMAND,
-                       &val);
-       val |= PCI_COMMAND_INVALIDATE;
-       early_write_config_dword(bh->hose_a,
-                       bh->hose_a->first_busno,
-                       PCI_DEVFN(0,0),
-                       PCI_COMMAND,
-                       val);
-
-       early_read_config_dword(bh->hose_b,
-                       bh->hose_b->first_busno,
-                       PCI_DEVFN(0,0),
-                       PCI_COMMAND,
-                       &val);
-       val |= PCI_COMMAND_INVALIDATE;
-       early_write_config_dword(bh->hose_b,
-                       bh->hose_b->first_busno,
-                       PCI_DEVFN(0,0),
-                       PCI_COMMAND,
-                       val);
-
-       mv64x60_pci_exclude_bridge = save_exclude;
-#endif
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 0))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->mirror_regs = 1;
-               mpsc_dp->cache_mgmt = 1;
-       }
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 1))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->mirror_regs = 1;
-               mpsc_dp->cache_mgmt = 1;
-       }
-
-       return;
-}
-
-/*
- * gt64260b_chip_specific_init()
- *
- * Implement errata work arounds for the GT64260B.
- */
-static void
-gt64260b_chip_specific_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       struct ocp_device       *dev;
-       mv64x60_ocp_mpsc_data_t *mpsc_dp;
-
-       /* R#18 */
-       /* cpu read buffer to buffer 1 (reg 0x0448) */
-       mv64x60_set_bits(bh, GT64260_SDRAM_CONFIG, (1<<26));
-
-       /* No longer errata so turn on */
-       /* Enable pci read/write combine, master write trigger,
-       * disable slave sync barrier
-       * readmultiple (reg 0x0c00 and 0x0c80)
-       */
-       if (si->pci_0.enable_bus) {
-               mv64x60_set_bits(bh, MV64x60_PCI0_CMD,
-                       ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
-       }
-
-       if (si->pci_1.enable_bus) {
-               mv64x60_set_bits(bh, MV64x60_PCI1_CMD,
-                       ((1<<4) | (1<<5) | (1<<9) | (1<<13)));
-       }
-
-       mv64x60_set_bits(bh, GT64260_CPU_WB_PRIORITY_BUFFER_DEPTH, 0xf);
-
-       /*
-        * The 64260B is not supposed to have the bug where the MPSC & ENET
-        * can't access cache coherent regions.  However, testing has shown
-        * that the MPSC, at least, still has this bug.
-        */
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 0))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->cache_mgmt = 1;
-       }
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 1))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->cache_mgmt = 1;
-       }
-
-       return;
-}
-
-/*
- *****************************************************************************
- *
- *     MV64360-Specific Routines
- *
- *****************************************************************************
- */
-/*
- * mv64360_translate_size()
- *
- * On the MV64360, the size register is set similar to the size you get
- * from a pci config space BAR register.  That is, programmed from LSB to MSB
- * as a sequence of 1's followed by a sequence of 0's. IOW, "size -1" with the
- * assumption that the size is a power of 2.
- */
-static u32 __init
-mv64360_translate_size(u32 base_addr, u32 size, u32 num_bits)
-{
-       return mv64x60_mask(size - 1, num_bits);
-}
-
-/*
- * mv64360_untranslate_size()
- *
- * Translate the size register value of a window into a window size.
- */
-static u32 __init
-mv64360_untranslate_size(u32 base_addr, u32 size, u32 num_bits)
-{
-       if (size > 0) {
-               size >>= (32 - num_bits);
-               size++;
-               size <<= (32 - num_bits);
-       }
-
-       return size;
-}
-
-/*
- * mv64360_set_pci2mem_window()
- *
- * The PCI->MEM window registers are actually in PCI config space so need
- * to set them by setting the correct config space BARs.
- */
-static void __init
-mv64360_set_pci2mem_window(struct pci_controller *hose, u32 window, u32 base)
-{
-       struct {
-               u32     fcn;
-               u32     base_hi_bar;
-               u32     base_lo_bar;
-       } reg_addrs[] = {{ 0, 0x14, 0x10 }, { 0, 0x1c, 0x18 },
-               { 1, 0x14, 0x10 }, { 1, 0x1c, 0x18 }};
-
-       DBG("set pci->mem window: %d, hose: %d, base: 0x%x\n", window,
-               hose->index, base);
-
-       early_write_config_dword(hose, hose->first_busno,
-                       PCI_DEVFN(0, reg_addrs[window].fcn),
-                       reg_addrs[window].base_hi_bar, 0);
-       early_write_config_dword(hose, hose->first_busno,
-                       PCI_DEVFN(0, reg_addrs[window].fcn),
-                       reg_addrs[window].base_lo_bar,
-                       mv64x60_mask(base, 20) | 0xc);
-       return;
-}
-
-/*
- * mv64360_is_enabled_32bit()
- *
- * On a MV64360, a window is enabled by either clearing a bit in the
- * CPU BAR Enable reg or setting a bit in the window's base reg.
- * Note that this doesn't work for windows on the PCI slave side but we don't
- * check those so its okay.
- */
-static u32 __init
-mv64360_is_enabled_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       u32     rc = 0;
-
-       if ((mv64360_32bit_windows[window].base_reg != 0) &&
-               (mv64360_32bit_windows[window].size_reg != 0)) {
-
-               if (mv64360_32bit_windows[window].extra & 0x80000000) {
-                       rc = (mv64x60_read(bh,
-                               mv64360_32bit_windows[window].base_reg) & 
-                               (1 << (mv64360_32bit_windows[window].extra &
-                                                               0xff))) != 0;
-               }
-               else {
-                       rc = (mv64x60_read(bh, MV64360_CPU_BAR_ENABLE) & 
-                               (1 << mv64360_32bit_windows[window].extra)) ==0;
-               }
-       }
-
-       if (rc) {
-               DBG("32bit window %d is enabled\n", window);
-       }
-       else {
-               DBG("32bit window %d is disabled\n", window);
-       }
-
-       return rc;
-}
-
-/*
- * mv64360_enable_window_32bit()
- *
- * On a MV64360, a window is enabled by either clearing a bit in the
- * CPU BAR Enable reg or setting a bit in the window's base reg.
- */
-static void __init
-mv64360_enable_window_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("enable 32bit window: %d\n", window);
-
-       if ((mv64360_32bit_windows[window].base_reg != 0) &&
-               (mv64360_32bit_windows[window].size_reg != 0)) {
-
-               if (mv64360_32bit_windows[window].extra & 0x80000000) {
-                       mv64x60_set_bits(bh,
-                               mv64360_32bit_windows[window].base_reg,
-                               (1 << (mv64360_32bit_windows[window].extra &
-                                                                       0xff)));
-               }
-               else {
-                       mv64x60_clr_bits(bh, MV64360_CPU_BAR_ENABLE,
-                               (1 << mv64360_32bit_windows[window].extra));
-               }
-       }
-
-       return;
-}
-
-/*
- * mv64360_disable_window_32bit()
- *
- * On a MV64360, a window is disabled by either setting a bit in the
- * CPU BAR Enable reg or clearing a bit in the window's base reg.
- */
-static void __init
-mv64360_disable_window_32bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("disable 32bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
-               window, mv64360_32bit_windows[window].base_reg,
-               mv64360_32bit_windows[window].size_reg);
-
-       if ((mv64360_32bit_windows[window].base_reg != 0) &&
-               (mv64360_32bit_windows[window].size_reg != 0)) {
-
-               if (mv64360_32bit_windows[window].extra & 0x80000000) {
-                       mv64x60_clr_bits(bh,
-                               mv64360_32bit_windows[window].base_reg,
-                               (1 << (mv64360_32bit_windows[window].extra &
-                                                                       0xff)));
-               }
-               else {
-                       mv64x60_set_bits(bh, MV64360_CPU_BAR_ENABLE,
-                               (1 << mv64360_32bit_windows[window].extra));
-               }
-       }
-
-       return;
-}
-
-/*
- * mv64360_enable_window_64bit()
- *
- * On the MV64360, a 64-bit window is enabled by setting a bit in the window's 
- * base reg.
- */
-static void __init
-mv64360_enable_window_64bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("enable 64bit window: %d\n", window);
-
-       /* For 64360, 'extra' field holds bit that enables the window */
-       if ((mv64360_64bit_windows[window].base_lo_reg!= 0) &&
-               (mv64360_64bit_windows[window].size_reg != 0)) {
-
-               if (mv64360_64bit_windows[window].extra & 0x80000000) {
-                       mv64x60_set_bits(bh,
-                               mv64360_64bit_windows[window].base_lo_reg,
-                               (1 << (mv64360_64bit_windows[window].extra &
-                                                                       0xff)));
-               } /* Should be no 'else' ones */
-       }
-
-       return;
-}
-
-/*
- * mv64360_disable_window_64bit()
- *
- * On a MV64360, a 64-bit window is disabled by clearing a bit in the window's
- * base reg.
- */
-static void __init
-mv64360_disable_window_64bit(mv64x60_handle_t *bh, u32 window)
-{
-       DBG("disable 64bit window: %d, base_reg: 0x%x, size_reg: 0x%x\n",
-               window, mv64360_64bit_windows[window].base_lo_reg,
-               mv64360_64bit_windows[window].size_reg);
-
-       if ((mv64360_64bit_windows[window].base_lo_reg != 0) &&
-               (mv64360_64bit_windows[window].size_reg != 0)) {
-
-               if (mv64360_64bit_windows[window].extra & 0x80000000) {
-                       mv64x60_clr_bits(bh,
-                               mv64360_64bit_windows[window].base_lo_reg,
-                               (1 << (mv64360_64bit_windows[window].extra &
-                                                                       0xff)));
-               } /* Should be no 'else' ones */
-       }
-
-       return;
-}
-
-/*
- * mv64360_disable_all_windows()
- *
- * The MV64360 has a few windows that aren't represented in the table of
- * windows at the top of this file.  This routine turns all of them off
- * except for the memory controller windows, of course.
- */
-static void __init
-mv64360_disable_all_windows(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       u32     i;
-
-       /* Disable 32bit windows (don't disable cpu->mem windows) */
-       for (i=MV64x60_CPU2DEV_0_WIN; i<MV64x60_32BIT_WIN_COUNT; i++) {
-               if (!(si->window_preserve_mask_32 & (1<<i)))
-                       mv64360_disable_window_32bit(bh, i);
-       }
-
-       /* Disable 64bit windows */
-       for (i=0; i<MV64x60_64BIT_WIN_COUNT; i++) {
-               if (!(si->window_preserve_mask_64 & (1<<i)))
-                       mv64360_disable_window_64bit(bh, i);
-       }
-
-       /* Turn off PCI->MEM access cntl wins not in mv64360_64bit_windows[] */
-       mv64x60_clr_bits(bh, MV64x60_PCI0_ACC_CNTL_4_BASE_LO, 0);
-       mv64x60_clr_bits(bh, MV64x60_PCI0_ACC_CNTL_5_BASE_LO, 0);
-       mv64x60_clr_bits(bh, MV64x60_PCI1_ACC_CNTL_4_BASE_LO, 0);
-       mv64x60_clr_bits(bh, MV64x60_PCI1_ACC_CNTL_5_BASE_LO, 0);
-
-       /* Disable all PCI-><whatever> windows */
-       mv64x60_set_bits(bh, MV64x60_PCI0_BAR_ENABLE, 0x0000f9ff);
-       mv64x60_set_bits(bh, MV64x60_PCI1_BAR_ENABLE, 0x0000f9ff);
-
-       return;
-}
-
-/*
- * mv64360_chip_specific_init()
- *
- * No errata work arounds for the MV64360 implemented at this point.
- */
-static void
-mv64360_chip_specific_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       struct ocp_device       *dev;
-       mv64x60_ocp_mpsc_data_t *mpsc_dp;
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 0))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->brg_can_tune = 1;
-       }
-
-       if ((dev = ocp_find_device(OCP_VENDOR_MARVELL, OCP_FUNC_MPSC, 1))
-                                                               != NULL) {
-               mpsc_dp = (mv64x60_ocp_mpsc_data_t *)dev->def->additions;
-               mpsc_dp->brg_can_tune = 1;
-       }
-
-       return;
-}
-
-/*
- * mv64460_chip_specific_init()
- *
- * No errata work arounds for the MV64460 implemented at this point.
- */
-static void
-mv64460_chip_specific_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si)
-{
-       mv64360_chip_specific_init(bh, si); /* XXXX check errata */
-       return;
-}
diff --git a/arch/ppc/syslib/mv64x60_ocp.c b/arch/ppc/syslib/mv64x60_ocp.c
deleted file mode 100644 (file)
index 935bb9a..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * arch/ppc/syslib/mv64x60_ocp.c
- * 
- * Common OCP definitions for the Marvell GT64260/MV64360/MV64460/...
- * line of host bridges.
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <asm/mv64x60.h>
-#include <asm/ocp.h>
-
-static mv64x60_ocp_mpsc_data_t mv64x60_ocp_mpsc0_def = {
-       .mirror_regs            = 0,
-       .cache_mgmt             = 0,
-       .max_idle               = 0,
-       .default_baud           = 9600,
-       .default_bits           = 8,
-       .default_parity         = 'n',
-       .default_flow           = 'n',
-       .chr_1_val              = 0x00000000,
-       .chr_2_val              = 0x00000000,
-       .chr_10_val             = 0x00000003,
-       .mpcr_val               = 0,
-       .mrr_val                = 0x3ffffe38,
-       .rcrr_val               = 0,
-       .tcrr_val               = 0,
-       .intr_mask_val          = 0,
-       .bcr_val                = 0,
-       .sdma_irq               = MV64x60_IRQ_SDMA_0,
-       .brg_can_tune           = 0,
-       .brg_clk_src            = 8,            /* Default to TCLK */
-       .brg_clk_freq           = 100000000,    /* Default to 100 MHz */
-};
-static mv64x60_ocp_mpsc_data_t mv64x60_ocp_mpsc1_def = {
-       .mirror_regs            = 0,
-       .cache_mgmt             = 0,
-       .max_idle               = 0,
-       .default_baud           = 9600,
-       .default_bits           = 8,
-       .default_parity         = 'n',
-       .default_flow           = 'n',
-       .chr_1_val              = 0x00000000,
-       .chr_1_val              = 0x00000000,
-       .chr_2_val              = 0x00000000,
-       .chr_10_val             = 0x00000003,
-       .mpcr_val               = 0,
-       .mrr_val                = 0x3ffffe38,
-       .rcrr_val               = 0,
-       .tcrr_val               = 0,
-       .intr_mask_val          = 0,
-       .bcr_val                = 0,
-       .sdma_irq               = MV64x60_IRQ_SDMA_1,
-       .brg_can_tune           = 0,
-       .brg_clk_src            = 8,            /* Default to TCLK */
-       .brg_clk_freq           = 100000000,    /* Default to 100 MHz */
-};
-MV64x60_OCP_SYSFS_MPSC_DATA()
-
-struct ocp_def core_ocp[] = {
-       /* Base address for the block of bridge's regs */
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x00 */
-         .function     = OCP_FUNC_HB,
-         .index        = 0,
-         .paddr        = 0,
-         .pm           = OCP_CPM_NA,
-       },
-       /* 10/100 Ethernet controller */
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x01 */
-         .function     = OCP_FUNC_EMAC,
-         .index        = 0,
-         .paddr        = GT64260_ENET_0_OFFSET,
-         .irq          = MV64x60_IRQ_ETH_0,
-         .pm           = OCP_CPM_NA,
-       },
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x02 */
-         .function     = OCP_FUNC_EMAC,
-         .index        = 1,
-         .paddr        = GT64260_ENET_1_OFFSET,
-         .irq          = MV64x60_IRQ_ETH_1,
-         .pm           = OCP_CPM_NA,
-       },
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x03 */
-         .function     = OCP_FUNC_EMAC,
-         .index        = 2,
-         .paddr        = GT64260_ENET_2_OFFSET,
-         .irq          = MV64x60_IRQ_ETH_2,
-         .pm           = OCP_CPM_NA,
-       },
-       /* Multi-Protocol Serial Controller (MPSC) */
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x04 */
-         .function     = OCP_FUNC_MPSC,
-         .index        = 0,
-         .paddr        = MV64x60_MPSC_0_OFFSET,
-         .irq          = MV64x60_IRQ_MPSC_0,
-         .pm           = OCP_CPM_NA,
-         .additions    = &mv64x60_ocp_mpsc0_def,
-         .show         = &mv64x60_ocp_show_mpsc
-       },
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x05 */
-         .function     = OCP_FUNC_MPSC,
-         .index        = 1,
-         .paddr        = MV64x60_MPSC_1_OFFSET,
-         .irq          = MV64x60_IRQ_MPSC_1,
-         .pm           = OCP_CPM_NA,
-         .additions    = &mv64x60_ocp_mpsc1_def,
-         .show         = &mv64x60_ocp_show_mpsc
-       },
-       /* Inter-Integrated Circuit Controller */
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x06 */
-         .function     = OCP_FUNC_I2C,
-         .index        = 0,
-         .paddr        = GT64260_I2C_OFFSET,
-         .irq          = MV64x60_IRQ_I2C,
-         .pm           = OCP_CPM_NA,
-       },
-       /* Programmable Interrupt Controller */
-       { .vendor       = OCP_VENDOR_MARVELL,                   /* 0x07 */
-         .function     = OCP_FUNC_PIC,
-         .index        = 0,
-         .paddr        = GT64260_IC_OFFSET,
-         .pm           = OCP_CPM_NA,
-       },
-       { .vendor       = OCP_VENDOR_INVALID
-       }
-};
index 0b58789..a19f8c2 100644 (file)
@@ -554,14 +554,16 @@ static void __init openpic_initipi(u_int ipi, u_int pri, u_int vec)
  *  Externally called, however, it takes an IPI number (0...OPENPIC_NUM_IPI)
  *  and not a system-wide interrupt number
  */
-void openpic_cause_IPI(u_int ipi, u_int cpumask)
+void openpic_cause_IPI(u_int ipi, cpumask_t cpumask)
 {
+       cpumask_t phys;
        DECL_THIS_CPU;
 
        CHECK_THIS_CPU;
        check_arg_ipi(ipi);
+       phys = physmask(cpumask);
        openpic_write(&OpenPIC->THIS_CPU.IPI_Dispatch(ipi),
-                     physmask(cpumask));
+                     cpus_addr(physmask(cpumask))[0]);
 }
 
 void openpic_request_IPIs(void)
@@ -579,16 +581,16 @@ void openpic_request_IPIs(void)
        /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
        request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset,
                    openpic_ipi_action, SA_INTERRUPT,
-                   "IPI0 (call function)", 0);
+                   "IPI0 (call function)", NULL);
        request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+1,
                    openpic_ipi_action, SA_INTERRUPT,
-                   "IPI1 (reschedule)", 0);
+                   "IPI1 (reschedule)", NULL);
        request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+2,
                    openpic_ipi_action, SA_INTERRUPT,
-                   "IPI2 (invalidate tlb)", 0);
+                   "IPI2 (invalidate tlb)", NULL);
        request_irq(OPENPIC_VEC_IPI+open_pic_irq_offset+3,
                    openpic_ipi_action, SA_INTERRUPT,
-                   "IPI3 (xmon break)", 0);
+                   "IPI3 (xmon break)", NULL);
 
        for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
                openpic_enable_ipi(OPENPIC_VEC_IPI+open_pic_irq_offset+i);
@@ -610,7 +612,7 @@ void __devinit do_openpic_setup_cpu(void)
        spin_lock(&openpic_setup_lock);
 
 #ifdef CONFIG_IRQ_ALL_CPUS
-       cpu_set(smp_hw_index[smp_processor_id()], mask);
+       cpu_set(smp_hw_index[smp_processor_id()], msk);
 
        /* let the openpic know we want intrs. default affinity
         * is 0xffffffff until changed via /proc
@@ -872,6 +874,7 @@ openpic_get_irq(struct pt_regs *regs)
 void
 smp_openpic_message_pass(int target, int msg, unsigned long data, int wait)
 {
+       cpumask_t mask = CPU_MASK_ALL;
        /* make sure we're sending something that translates to an IPI */
        if (msg > 0x3) {
                printk("SMP %d: smp_message_pass: unknown msg %d\n",
@@ -880,14 +883,14 @@ smp_openpic_message_pass(int target, int msg, unsigned long data, int wait)
        }
        switch (target) {
        case MSG_ALL:
-               openpic_cause_IPI(msg, 0xffffffff);
+               openpic_cause_IPI(msg, mask);
                break;
        case MSG_ALL_BUT_SELF:
-               openpic_cause_IPI(msg,
-                                 0xffffffff & ~(1 << smp_processor_id()));
+               cpu_clear(smp_processor_id(), mask);
+               openpic_cause_IPI(msg, mask);
                break;
        default:
-               openpic_cause_IPI(msg, 1<<target);
+               openpic_cause_IPI(msg, cpumask_of_cpu(target));
                break;
        }
 }
index 79888ad..c9701d5 100644 (file)
@@ -111,15 +111,15 @@ static void prom_instantiate_rtas(void);
 static void * early_get_property(unsigned long base, unsigned long node,
                                char *prop);
 
-prom_entry prom __initdata = 0;
-ihandle prom_chosen __initdata = 0;
-ihandle prom_stdout __initdata = 0;
+prom_entry prom __initdata;
+ihandle prom_chosen __initdata;
+ihandle prom_stdout __initdata;
 
-char *prom_display_paths[FB_MAX] __initdata = { 0, };
+char *prom_display_paths[FB_MAX] __initdata;
 phandle prom_display_nodes[FB_MAX] __initdata;
-unsigned int prom_num_displays __initdata = 0;
-char *of_stdout_device __initdata = 0;
-static ihandle prom_disp_node __initdata = 0;
+unsigned int prom_num_displays __initdata;
+char *of_stdout_device __initdata;
+static ihandle prom_disp_node __initdata;
 
 unsigned int rtas_data;   /* physical pointer */
 unsigned int rtas_entry;  /* physical pointer */
@@ -161,7 +161,7 @@ call_prom(const char *service, int nargs, int nret, ...)
                prom_args.args[i] = va_arg(list, void *);
        va_end(list);
        for (i = 0; i < nret; ++i)
-               prom_args.args[i + nargs] = 0;
+               prom_args.args[i + nargs] = NULL;
        prom(&prom_args);
        return prom_args.args[nargs];
 }
@@ -181,7 +181,7 @@ call_prom_ret(const char *service, int nargs, int nret, void **rets, ...)
                prom_args.args[i] = va_arg(list, void *);
        va_end(list);
        for (i = 0; i < nret; ++i)
-               prom_args.args[i + nargs] = 0;
+               prom_args.args[i + nargs] = NULL;
        prom(&prom_args);
        for (i = 1; i < nret; ++i)
                rets[i-1] = prom_args.args[nargs + i];
@@ -363,9 +363,9 @@ check_display(unsigned long mem)
        };
        const unsigned char *clut;
 
-       prom_disp_node = 0;
+       prom_disp_node = NULL;
 
-       for (node = 0; prom_next_node(&node); ) {
+       for (node = NULL; prom_next_node(&node); ) {
                type[0] = 0;
                call_prom("getprop", 4, 1, node, "device_type",
                          type, sizeof(type));
@@ -546,8 +546,8 @@ copy_device_tree(unsigned long mem_start, unsigned long mem_end)
        }
        allnextp = &allnodes;
        mem_start = ALIGNUL(mem_start);
-       new_start = inspect_node(root, 0, mem_start, mem_end, &allnextp);
-       *allnextp = 0;
+       new_start = inspect_node(root, NULL, mem_start, mem_end, &allnextp);
+       *allnextp = NULL;
        return new_start;
 }
 
@@ -695,7 +695,7 @@ prom_hold_cpus(unsigned long mem)
        /* look for cpus */
        *(unsigned long *)(0x0) = 0;
        asm volatile("dcbf 0,%0": : "r" (0) : "memory");
-       for (node = 0; prom_next_node(&node); ) {
+       for (node = NULL; prom_next_node(&node); ) {
                type[0] = 0;
                call_prom("getprop", 4, 1, node, "device_type",
                          type, sizeof(type));
@@ -888,7 +888,7 @@ prom_init(int r3, int r4, prom_entry pp)
        prom_print("returning 0x");
        prom_print_hex(phys);
        prom_print("from prom_init\n");
-       prom_stdout = 0;
+       prom_stdout = NULL;
 
        return phys;
 }
@@ -910,7 +910,7 @@ early_get_property(unsigned long base, unsigned long node, char *prop)
                        return (void *)((unsigned long)pp->value + base);
                }
        }
-       return 0;
+       return NULL;
 }
 
 /* Is boot-info compatible ? */
@@ -928,7 +928,7 @@ bootx_init(unsigned long r4, unsigned long phys)
 
        boot_infos = PTRUNRELOC(bi);
        if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
-               bi->logicalDisplayBase = 0;
+               bi->logicalDisplayBase = NULL;
 
 #ifdef CONFIG_BOOTX_TEXT
        btext_init(bi);
index 58d2e0f..e9431d8 100644 (file)
@@ -424,8 +424,6 @@ config IRQSTACKS
          for handling hard and soft interrupts.  This can help avoid
          overflowing the process kernel stacks.
          
-endmenu
-
 config SPINLINE
        bool "Inline spinlock code at each call site"
        depends on SMP && !PPC_SPLPAR && !PPC_ISERIES
@@ -436,6 +434,8 @@ config SPINLINE
 
          If in doubt, say N.
 
+endmenu
+
 source "kernel/vserver/Kconfig"
 
 source "security/Kconfig"
index fdb3606..63ec73f 100644 (file)
@@ -345,7 +345,6 @@ CONFIG_LLC=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index fda2788..c5dd7e1 100644 (file)
@@ -15,14 +15,11 @@ obj-y               :=      setup.o entry.o traps.o irq.o idle.o dma.o \
 
 obj-$(CONFIG_PPC_OF) +=        of_device.o
 
-obj-$(CONFIG_PCI)      += pci.o pci_dn.o pci_iommu.o
+pci-obj-$(CONFIG_PPC_ISERIES)  += iSeries_pci.o iSeries_pci_reset.o \
+                                    iSeries_IoMmTable.o
+pci-obj-$(CONFIG_PPC_PSERIES)  += pci_dn.o pci_dma_direct.o
 
-ifdef CONFIG_PPC_ISERIES
-obj-$(CONFIG_PCI)      += iSeries_pci.o iSeries_pci_reset.o \
-                            iSeries_IoMmTable.o 
-else
-obj-$(CONFIG_PCI)      += pci_dma_direct.o
-endif
+obj-$(CONFIG_PCI)      += pci.o pci_iommu.o $(pci-obj-y)
 
 obj-$(CONFIG_PPC_ISERIES) += iSeries_irq.o \
                             iSeries_VpdInfo.o XmPciLpEvent.o \
@@ -46,6 +43,7 @@ obj-$(CONFIG_VIOPATH)         += viopath.o
 obj-$(CONFIG_LPARCFG)          += lparcfg.o
 obj-$(CONFIG_HVC_CONSOLE)      += hvconsole.o
 obj-$(CONFIG_BOOTX_TEXT)       += btext.o
+obj-$(CONFIG_HVCS)             += hvcserver.o
 
 obj-$(CONFIG_PPC_PMAC)         += pmac_setup.o pmac_feature.o pmac_pci.o \
                                   pmac_time.o pmac_nvram.o pmac_low_i2c.o \
index a3b5899..f19f763 100644 (file)
@@ -86,10 +86,17 @@ int main(void)
         DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, saved_msr));
         DEFINE(PACASTABREAL, offsetof(struct paca_struct, stab_real));
         DEFINE(PACASTABVIRT, offsetof(struct paca_struct, stab_addr));
-       DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_next_rr));
+       DEFINE(PACASTABRR, offsetof(struct paca_struct, stab_rr));
         DEFINE(PACAR1, offsetof(struct paca_struct, saved_r1));
        DEFINE(PACATOC, offsetof(struct paca_struct, kernel_toc));
        DEFINE(PACAPROCENABLED, offsetof(struct paca_struct, proc_enabled));
+       DEFINE(PACASLBCACHE, offsetof(struct paca_struct, slb_cache));
+       DEFINE(PACASLBCACHEPTR, offsetof(struct paca_struct, slb_cache_ptr));
+       DEFINE(PACACONTEXTID, offsetof(struct paca_struct, context.id));
+       DEFINE(PACASLBR3, offsetof(struct paca_struct, slb_r3));
+#ifdef CONFIG_HUGETLB_PAGE
+       DEFINE(PACAHTLBSEGS, offsetof(struct paca_struct, context.htlb_segs));
+#endif /* CONFIG_HUGETLB_PAGE */
        DEFINE(PACADEFAULTDECR, offsetof(struct paca_struct, default_decr));
        DEFINE(PACAPROFENABLED, offsetof(struct paca_struct, prof_enabled));
        DEFINE(PACAPROFLEN, offsetof(struct paca_struct, prof_len));
index bb8ca7f..d2a7377 100644 (file)
@@ -298,8 +298,7 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
               cur_cpu_spec->firmware_features);
 }
 
-void
-chrp_progress(char *s, unsigned short hex)
+void chrp_progress(char *s, unsigned short hex)
 {
        struct device_node *root;
        int width, *p;
@@ -313,60 +312,55 @@ chrp_progress(char *s, unsigned short hex)
                return;
 
        if (max_width == 0) {
-               if ( (root = find_path_device("/rtas")) &&
+               if ((root = find_path_device("/rtas")) &&
                     (p = (unsigned int *)get_property(root,
                                                       "ibm,display-line-length",
-                                                      NULL)) )
+                                                      NULL)))
                        max_width = *p;
                else
                        max_width = 0x10;
                display_character = rtas_token("display-character");
                set_indicator = rtas_token("set-indicator");
        }
-       if (display_character == RTAS_UNKNOWN_SERVICE) {
-               /* use hex display */
-               if (set_indicator == RTAS_UNKNOWN_SERVICE)
-                       return;
-               rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
-               return;
-       }
 
-       if(display_character == RTAS_UNKNOWN_SERVICE) {
+       if (display_character == RTAS_UNKNOWN_SERVICE) {
                /* use hex display if available */
-               if(set_indicator != RTAS_UNKNOWN_SERVICE)
+               if (set_indicator != RTAS_UNKNOWN_SERVICE)
                        rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
                return;
        }
 
        spin_lock(&progress_lock);
 
-       /* Last write ended with newline, but we didn't print it since
+       /*
+        * Last write ended with newline, but we didn't print it since
         * it would just clear the bottom line of output. Print it now
         * instead.
         *
         * If no newline is pending, print a CR to start output at the
         * beginning of the line.
         */
-       if(pending_newline) {
+       if (pending_newline) {
                rtas_call(display_character, 1, 1, NULL, '\r');
                rtas_call(display_character, 1, 1, NULL, '\n');
                pending_newline = 0;
-       } else
+       } else {
                rtas_call(display_character, 1, 1, NULL, '\r');
+       }
  
        width = max_width;
        os = s;
        while (*os) {
-               if(*os == '\n' || *os == '\r') {
+               if (*os == '\n' || *os == '\r') {
                        /* Blank to end of line. */
-                       while(width-- > 0)
+                       while (width-- > 0)
                                rtas_call(display_character, 1, 1, NULL, ' ');
  
                        /* If newline is the last character, save it
                         * until next call to avoid bumping up the
                         * display output.
                         */
-                       if(*os == '\n' && !os[1]) {
+                       if (*os == '\n' && !os[1]) {
                                pending_newline = 1;
                                spin_unlock(&progress_lock);
                                return;
@@ -374,7 +368,7 @@ chrp_progress(char *s, unsigned short hex)
  
                        /* RTAS wants CR-LF, not just LF */
  
-                       if(*os == '\n') {
+                       if (*os == '\n') {
                                rtas_call(display_character, 1, 1, NULL, '\r');
                                rtas_call(display_character, 1, 1, NULL, '\n');
                        } else {
@@ -393,14 +387,14 @@ chrp_progress(char *s, unsigned short hex)
                os++;
  
                /* if we overwrite the screen length */
-               if ( width <= 0 )
-                       while ( (*os != 0) && (*os != '\n') && (*os != '\r') )
+               if (width <= 0)
+                       while ((*os != 0) && (*os != '\n') && (*os != '\r'))
                                os++;
        }
  
        /* Blank to end of line. */
-       while ( width-- > 0 )
-               rtas_call(display_character, 1, 1, NULL, ' ' );
+       while (width-- > 0)
+               rtas_call(display_character, 1, 1, NULL, ' ');
 
        spin_unlock(&progress_lock);
 }
index 8a975c6..5fdcce2 100644 (file)
@@ -473,10 +473,10 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
 {
        struct eeh_early_enable_info *info = data;
        int ret;
-       char *status = get_property(dn, "status", 0);
-       u32 *class_code = (u32 *)get_property(dn, "class-code", 0);
-       u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", 0);
-       u32 *device_id = (u32 *)get_property(dn, "device-id", 0);
+       char *status = get_property(dn, "status", NULL);
+       u32 *class_code = (u32 *)get_property(dn, "class-code", NULL);
+       u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL);
+       u32 *device_id = (u32 *)get_property(dn, "device-id", NULL);
        u32 *regs;
        int enable;
 
@@ -522,7 +522,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
 
        /* Ok... see if this device supports EEH.  Some do, some don't,
         * and the only way to find out is to check each and every one. */
-       regs = (u32 *)get_property(dn, "reg", 0);
+       regs = (u32 *)get_property(dn, "reg", NULL);
        if (regs) {
                /* First register entry is addr (00BBSS00)  */
                /* Try to enable eeh */
@@ -618,7 +618,7 @@ void __init eeh_init(void)
 
                info.buid_lo = BUID_LO(buid);
                info.buid_hi = BUID_HI(buid);
-               traverse_pci_devices(phb, early_enable_eeh, NULL, &info);
+               traverse_pci_devices(phb, early_enable_eeh, &info);
        }
 
        if (eeh_subsystem_enabled) {
@@ -802,7 +802,7 @@ static int eeh_check_opts_config(struct device_node *dn,
 
        /* Build list of strings to match */
        nstrs = 0;
-       s = (char *)get_property(dn, "ibm,loc-code", 0);
+       s = (char *)get_property(dn, "ibm,loc-code", NULL);
        if (s)
                strs[nstrs++] = s;
        sprintf(devname, "dev%04x:%04x", vendor_id, device_id);
index e7d88ca..2d48d24 100644 (file)
@@ -132,7 +132,7 @@ system_call:                        /* label this so stack traces look sane */
  */
        ld      r11,.SYS_CALL_TABLE@toc(2)
        andi.   r10,r10,_TIF_32BIT
-       beq-    15f
+       beq     15f
        ld      r11,.SYS_CALL_TABLE32@toc(2)
        clrldi  r3,r3,32
        clrldi  r4,r4,32
@@ -143,8 +143,8 @@ system_call:                        /* label this so stack traces look sane */
 15:
        slwi    r0,r0,3
        ldx     r10,r11,r0      /* Fetch system call handler [ptr] */
-       mtlr    r10
-       blrl                    /* Call handler */
+       mtctr   r10
+       bctrl                   /* Call handler */
 
 syscall_exit:
 #ifdef SHOW_SYSCALLS
@@ -182,7 +182,7 @@ syscall_exit_trace_cont:
        stdcx.  r0,0,r1                 /* to clear the reservation */
        andi.   r6,r8,MSR_PR
        ld      r4,_LINK(r1)
-       beq     1f                      /* only restore r13 if */
+       beq-    1f                      /* only restore r13 if */
        ld      r13,GPR13(r1)           /* returning to usermode */
 1:     ld      r2,GPR2(r1)
        ld      r1,GPR1(r1)
@@ -194,6 +194,7 @@ syscall_exit_trace_cont:
        mtspr   SRR0,r7
        mtspr   SRR1,r8
        rfid
+       b       .       /* prevent speculative execution */
 
 syscall_enosys:
        li      r3,-ENOSYS
@@ -540,7 +541,7 @@ restore:
        ld      r1,GPR1(r1)
 
        rfid
-       b       .
+       b       .       /* prevent speculative execution */
 
 /* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */
 do_work:
@@ -684,6 +685,7 @@ _GLOBAL(enter_rtas)
        mtspr   SRR0,r5
        mtspr   SRR1,r6
        rfid
+       b       .       /* prevent speculative execution */
 
 _STATIC(rtas_return_loc)
        /* relocation is off at this point */
@@ -704,6 +706,7 @@ _STATIC(rtas_return_loc)
        mtspr   SRR0,r3
        mtspr   SRR1,r4
        rfid
+       b       .       /* prevent speculative execution */
 
 _STATIC(rtas_restore_regs)
        /* relocation is on at this point */
index 647b239..a5d67f5 100644 (file)
@@ -200,6 +200,7 @@ exception_marker:
 #define EX_R13         32
 #define EX_SRR0                40
 #define EX_DAR         48
+#define EX_LR          48      /* SLB miss saves LR, but not DAR */
 #define EX_DSISR       56
 #define EX_CCR         60
 
@@ -220,7 +221,8 @@ exception_marker:
        mtspr   SRR0,r12;                                               \
        mfspr   r12,SRR1;               /* and SRR1 */                  \
        mtspr   SRR1,r10;                                               \
-       rfid
+       rfid;                                                           \
+       b       .       /* prevent speculative execution */
 
 /*
  * This is the start of the interrupt handlers for iSeries
@@ -301,12 +303,14 @@ exception_marker:
        . = n;                                          \
        .globl label##_Pseries;                         \
 label##_Pseries:                                       \
+       HMT_MEDIUM;                                     \
        mtspr   SPRG1,r13;              /* save r13 */  \
        EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
 
 #define STD_EXCEPTION_ISERIES(n, label, area)          \
        .globl label##_Iseries;                         \
 label##_Iseries:                                       \
+       HMT_MEDIUM;                                     \
        mtspr   SPRG1,r13;              /* save r13 */  \
        EXCEPTION_PROLOG_ISERIES_1(area);               \
        EXCEPTION_PROLOG_ISERIES_2;                     \
@@ -315,6 +319,7 @@ label##_Iseries:                                    \
 #define MASKABLE_EXCEPTION_ISERIES(n, label)                           \
        .globl label##_Iseries;                                         \
 label##_Iseries:                                                       \
+       HMT_MEDIUM;                                                     \
        mtspr   SPRG1,r13;              /* save r13 */                  \
        EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN);                         \
        lbz     r10,PACAPROFENABLED(r13);                               \
@@ -408,12 +413,14 @@ __start_interrupts:
 
        . = 0x200
 _MachineCheckPseries:
+       HMT_MEDIUM
        mtspr   SPRG1,r13               /* save r13 */
        EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common)
 
        . = 0x300
        .globl DataAccess_Pseries
 DataAccess_Pseries:
+       HMT_MEDIUM
        mtspr   SPRG1,r13
 BEGIN_FTR_SECTION
        mtspr   SPRG2,r12
@@ -432,19 +439,57 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
        . = 0x380
        .globl DataAccessSLB_Pseries
 DataAccessSLB_Pseries:
+       HMT_MEDIUM
        mtspr   SPRG1,r13
-       mtspr   SPRG2,r12
-       mfspr   r13,DAR
-       mfcr    r12
-       srdi    r13,r13,60
-       cmpdi   r13,0xc
-       beq     .do_slb_bolted_Pseries
-       mtcrf   0x80,r12
-       mfspr   r12,SPRG2
-       EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, DataAccessSLB_common)
+       mfspr   r13,SPRG3               /* get paca address into r13 */
+       std     r9,PACA_EXSLB+EX_R9(r13)        /* save r9 - r12 */
+       std     r10,PACA_EXSLB+EX_R10(r13)
+       std     r11,PACA_EXSLB+EX_R11(r13)
+       std     r12,PACA_EXSLB+EX_R12(r13)
+       std     r3,PACASLBR3(r13)
+       mfspr   r9,SPRG1
+       std     r9,PACA_EXSLB+EX_R13(r13)
+       mfcr    r9
+       clrrdi  r12,r13,32              /* get high part of &label */
+       mfmsr   r10
+       mfspr   r11,SRR0                /* save SRR0 */
+       ori     r12,r12,(.do_slb_miss)@l
+       ori     r10,r10,MSR_IR|MSR_DR   /* DON'T set RI for SLB miss */
+       mtspr   SRR0,r12
+       mfspr   r12,SRR1                /* and SRR1 */
+       mtspr   SRR1,r10
+       mfspr   r3,DAR
+       rfid
+       b       .       /* prevent speculative execution */
 
        STD_EXCEPTION_PSERIES(0x400, InstructionAccess)
-       STD_EXCEPTION_PSERIES(0x480, InstructionAccessSLB)
+
+       . = 0x480
+       .globl InstructionAccessSLB_Pseries
+InstructionAccessSLB_Pseries:
+       HMT_MEDIUM
+       mtspr   SPRG1,r13
+       mfspr   r13,SPRG3               /* get paca address into r13 */
+       std     r9,PACA_EXSLB+EX_R9(r13)        /* save r9 - r12 */
+       std     r10,PACA_EXSLB+EX_R10(r13)
+       std     r11,PACA_EXSLB+EX_R11(r13)
+       std     r12,PACA_EXSLB+EX_R12(r13)
+       std     r3,PACASLBR3(r13)
+       mfspr   r9,SPRG1
+       std     r9,PACA_EXSLB+EX_R13(r13)
+       mfcr    r9
+       clrrdi  r12,r13,32              /* get high part of &label */
+       mfmsr   r10
+       mfspr   r11,SRR0                /* save SRR0 */
+       ori     r12,r12,(.do_slb_miss)@l
+       ori     r10,r10,MSR_IR|MSR_DR   /* DON'T set RI for SLB miss */
+       mtspr   SRR0,r12
+       mfspr   r12,SRR1                /* and SRR1 */
+       mtspr   SRR1,r10
+       mr      r3,r11                  /* SRR0 is faulting address */
+       rfid
+       b       .       /* prevent speculative execution */
+
        STD_EXCEPTION_PSERIES(0x500, HardwareInterrupt)
        STD_EXCEPTION_PSERIES(0x600, Alignment)
        STD_EXCEPTION_PSERIES(0x700, ProgramCheck)
@@ -456,6 +501,7 @@ DataAccessSLB_Pseries:
        . = 0xc00
        .globl  SystemCall_Pseries
 SystemCall_Pseries:
+       HMT_MEDIUM
        mr      r9,r13
        mfmsr   r10
        mfspr   r13,SPRG3
@@ -468,6 +514,7 @@ SystemCall_Pseries:
        mfspr   r12,SRR1
        mtspr   SRR1,r10
        rfid
+       b       .       /* prevent speculative execution */
 
        STD_EXCEPTION_PSERIES(0xd00, SingleStep)
        STD_EXCEPTION_PSERIES(0xe00, Trap_0e)
@@ -494,11 +541,6 @@ _GLOBAL(do_stab_bolted_Pseries)
        mfspr   r12,SPRG2
        EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
 
-_GLOBAL(do_slb_bolted_Pseries)
-       mtcrf   0x80,r12
-       mfspr   r12,SPRG2
-       EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_slb_bolted)
-
        
        /* Space for the naca.  Architected to be located at real address
         * NACA_PHYS_ADDR.  Various tools rely on this location being fixed.
@@ -587,27 +629,25 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
        .globl  DataAccessSLB_Iseries
 DataAccessSLB_Iseries:
        mtspr   SPRG1,r13               /* save r13 */
-       mtspr   SPRG2,r12
-       mfspr   r13,DAR
-       mfcr    r12
-       srdi    r13,r13,60
-       cmpdi   r13,0xc
-       beq     .do_slb_bolted_Iseries
-       mtcrf   0x80,r12
-       mfspr   r12,SPRG2
-       EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN)
-       EXCEPTION_PROLOG_ISERIES_2
-       b       DataAccessSLB_common
-
-.do_slb_bolted_Iseries:
-       mtcrf   0x80,r12
-       mfspr   r12,SPRG2
        EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB)
-       EXCEPTION_PROLOG_ISERIES_2
-       b       .do_slb_bolted
+       std     r3,PACASLBR3(r13)
+       ld      r11,PACALPPACA+LPPACASRR0(r13)
+       ld      r12,PACALPPACA+LPPACASRR1(r13)
+       mfspr   r3,DAR
+       b       .do_slb_miss
 
        STD_EXCEPTION_ISERIES(0x400, InstructionAccess, PACA_EXGEN)
-       STD_EXCEPTION_ISERIES(0x480, InstructionAccessSLB, PACA_EXGEN)
+
+       .globl  InstructionAccessSLB_Iseries
+InstructionAccessSLB_Iseries:
+       mtspr   SPRG1,r13               /* save r13 */
+       EXCEPTION_PROLOG_ISERIES_1(PACA_EXSLB)
+       std     r3,PACASLBR3(r13)
+       ld      r11,PACALPPACA+LPPACASRR0(r13)
+       ld      r12,PACALPPACA+LPPACASRR1(r13)
+       mr      r3,r11
+       b       .do_slb_miss
+
        MASKABLE_EXCEPTION_ISERIES(0x500, HardwareInterrupt)
        STD_EXCEPTION_ISERIES(0x600, Alignment, PACA_EXGEN)
        STD_EXCEPTION_ISERIES(0x700, ProgramCheck, PACA_EXGEN)
@@ -683,7 +723,7 @@ Decrementer_Iseries_masked:
        li      r11,1
        stb     r11,PACALPPACA+LPPACADECRINT(r13)
        lwz     r12,PACADEFAULTDECR(r13)
-       mtspr   DEC,r12
+       mtspr   SPRN_DEC,r12
        /* fall through */
 
        .globl HardwareInterrupt_Iseries_masked
@@ -699,6 +739,7 @@ HardwareInterrupt_Iseries_masked:
        ld      r12,PACA_EXGEN+EX_R12(r13)
        ld      r13,PACA_EXGEN+EX_R13(r13)
        rfid
+       b       .       /* prevent speculative execution */
 #endif
 
 /*
@@ -714,10 +755,12 @@ fwnmi_data_area:
        . = 0x8000
        .globl SystemReset_FWNMI
 SystemReset_FWNMI:
+       HMT_MEDIUM
        mtspr   SPRG1,r13               /* save r13 */
        EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, SystemReset_common)
        .globl MachineCheck_FWNMI
 MachineCheck_FWNMI:
+       HMT_MEDIUM
        mtspr   SPRG1,r13               /* save r13 */
        EXCEPTION_PROLOG_PSERIES(PACA_EXMC, MachineCheck_common)
 
@@ -839,6 +882,7 @@ fast_exception_return:
        REST_4GPRS(10, r1)
        ld      r1,GPR1(r1)
        rfid
+       b       .       /* prevent speculative execution */
 
 unrecov_fer:
        bl      .save_nvgprs
@@ -864,21 +908,6 @@ DataAccess_common:
        li      r5,0x300
        b       .do_hash_page           /* Try to handle as hpte fault */
 
-       .align  7
-       .globl DataAccessSLB_common
-DataAccessSLB_common:
-       mfspr   r10,DAR
-       std     r10,PACA_EXGEN+EX_DAR(r13)
-       EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN)
-       ld      r3,PACA_EXGEN+EX_DAR(r13)
-       std     r3,_DAR(r1)
-       bl      .slb_allocate
-       cmpdi   r3,0                    /* Check return code */
-       beq     fast_exception_return   /* Return if we succeeded */
-       li      r5,0
-       std     r5,_DSISR(r1)
-       b       .handle_page_fault
-
        .align  7
        .globl InstructionAccess_common
 InstructionAccess_common:
@@ -888,21 +917,6 @@ InstructionAccess_common:
        li      r5,0x400
        b       .do_hash_page           /* Try to handle as hpte fault */
 
-       .align  7
-       .globl InstructionAccessSLB_common
-InstructionAccessSLB_common:
-       EXCEPTION_PROLOG_COMMON(0x480, PACA_EXGEN)
-       ld      r3,_NIP(r1)             /* SRR0 = NIA   */
-       bl      .slb_allocate
-       or.     r3,r3,r3                /* Check return code */
-       beq+    fast_exception_return   /* Return if we succeeded */
-
-       ld      r4,_NIP(r1)
-       li      r5,0
-       std     r4,_DAR(r1)
-       std     r5,_DSISR(r1)
-       b      .handle_page_fault
-
        .align  7
        .globl HardwareInterrupt_common
        .globl HardwareInterrupt_entry
@@ -1028,7 +1042,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
        bl      .local_irq_restore
        b       11f
 #else
-       beq+    fast_exception_return   /* Return from exception on success */
+       beq     fast_exception_return   /* Return from exception on success */
        /* fall through */
 #endif
 
@@ -1148,134 +1162,42 @@ _GLOBAL(do_stab_bolted)
        ld      r12,PACA_EXSLB+EX_R12(r13)
        ld      r13,PACA_EXSLB+EX_R13(r13)
        rfid
+       b       .       /* prevent speculative execution */
 
 /*
  * r13 points to the PACA, r9 contains the saved CR,
  * r11 and r12 contain the saved SRR0 and SRR1.
+ * r3 has the faulting address
  * r9 - r13 are saved in paca->exslb.
+ * r3 is saved in paca->slb_r3
  * We assume we aren't going to take any exceptions during this procedure.
  */
-/* XXX note fix masking in get_kernel_vsid to match */
-_GLOBAL(do_slb_bolted)
+_GLOBAL(do_slb_miss)
+       mflr    r10
+
        stw     r9,PACA_EXSLB+EX_CCR(r13)       /* save CR in exc. frame */
        std     r11,PACA_EXSLB+EX_SRR0(r13)     /* save SRR0 in exc. frame */
+       std     r10,PACA_EXSLB+EX_LR(r13)       /* save LR */
 
-       /*
-        * We take the next entry, round robin. Previously we tried
-        * to find a free slot first but that took too long. Unfortunately
-        * we dont have any LRU information to help us choose a slot.
-        */
-
-       /* r13 = paca */
-1:     ld      r10,PACASTABRR(r13)
-       addi    r9,r10,1
-       cmpdi   r9,SLB_NUM_ENTRIES
-       blt+    2f
-       li      r9,2                    /* dont touch slot 0 or 1 */
-2:     std     r9,PACASTABRR(r13)
-
-       /* r13 = paca, r10 = entry */
-
-       /* 
-        * Never cast out the segment for our kernel stack. Since we
-        * dont invalidate the ERAT we could have a valid translation
-        * for the kernel stack during the first part of exception exit 
-        * which gets invalidated due to a tlbie from another cpu at a
-        * non recoverable point (after setting srr0/1) - Anton
-        */
-       slbmfee r9,r10
-       srdi    r9,r9,27
-       /*
-        * Use paca->ksave as the value of the kernel stack pointer,
-        * because this is valid at all times.
-        * The >> 27 (rather than >> 28) is so that the LSB is the
-        * valid bit - this way we check valid and ESID in one compare.
-        * In order to completely close the tiny race in the context
-        * switch (between updating r1 and updating paca->ksave),
-        * we check against both r1 and paca->ksave.
-        */
-       srdi    r11,r1,27
-       ori     r11,r11,1
-       cmpd    r11,r9
-       beq-    1b
-       ld      r11,PACAKSAVE(r13)
-       srdi    r11,r11,27
-       ori     r11,r11,1
-       cmpd    r11,r9
-       beq-    1b
-
-       /* r13 = paca, r10 = entry */
-
-       /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */
-       mfspr   r9,DAR
-       rldicl  r11,r9,36,51
-       sldi    r11,r11,15
-       srdi    r9,r9,60
-       or      r11,r11,r9
-
-       /* VSID_RANDOMIZER */
-       li      r9,9
-       sldi    r9,r9,32
-       oris    r9,r9,58231
-       ori     r9,r9,39831
-
-       /* vsid = (ordinal * VSID_RANDOMIZER) & VSID_MASK */
-       mulld   r11,r11,r9
-       clrldi  r11,r11,28
-
-       /* r13 = paca, r10 = entry, r11 = vsid */
-
-       /* Put together slb word1 */
-       sldi    r11,r11,12
-
-BEGIN_FTR_SECTION
-       /* set kp and c bits */
-       ori     r11,r11,0x480
-END_FTR_SECTION_IFCLR(CPU_FTR_16M_PAGE)
-BEGIN_FTR_SECTION
-       /* set kp, l and c bits */
-       ori     r11,r11,0x580
-END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE)
-
-       /* r13 = paca, r10 = entry, r11 = slb word1 */
-
-       /* Put together slb word0 */
-       mfspr   r9,DAR
-       clrrdi  r9,r9,28        /* get the new esid */
-       oris    r9,r9,0x800     /* set valid bit */
-       rldimi  r9,r10,0,52     /* insert entry */
-
-       /* r13 = paca, r9 = slb word0, r11 = slb word1 */
-
-       /* 
-        * No need for an isync before or after this slbmte. The exception
-        * we enter with and the rfid we exit with are context synchronizing .
-        */
-       slbmte  r11,r9
+       bl      .slb_allocate                   /* handle it */
 
        /* All done -- return from exception. */
+
+       ld      r10,PACA_EXSLB+EX_LR(r13)
+       ld      r3,PACASLBR3(r13)
        lwz     r9,PACA_EXSLB+EX_CCR(r13)       /* get saved CR */
        ld      r11,PACA_EXSLB+EX_SRR0(r13)     /* get saved SRR0 */
 
+       mtlr    r10
+
        andi.   r10,r12,MSR_RI  /* check for unrecoverable exception */
        beq-    unrecov_slb
 
-       /*
-        * Until everyone updates binutils hardwire the POWER4 optimised
-        * single field mtcrf
-        */
-#if 0
-       .machine        push
-       .machine        "power4"
+.machine       push
+.machine       "power4"
        mtcrf   0x80,r9
-       .machine        pop
-#else
-       .long 0x7d380120
-#endif
-
-       mfmsr   r10
-       clrrdi  r10,r10,2
-       mtmsrd  r10,1
+       mtcrf   0x01,r9         /* slb_allocate uses cr0 and cr7 */
+.machine       pop
 
        mtspr   SRR0,r11
        mtspr   SRR1,r12
@@ -1285,6 +1207,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_16M_PAGE)
        ld      r12,PACA_EXSLB+EX_R12(r13)
        ld      r13,PACA_EXSLB+EX_R13(r13)
        rfid
+       b       .       /* prevent speculative execution */
 
 unrecov_slb:
        EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
@@ -1390,6 +1313,7 @@ _STATIC(mmu_off)
        mtspr   SRR1,r3
        sync
        rfid
+       b       .       /* prevent speculative execution */
 _GLOBAL(__start_initialization_pSeries)
        mr      r31,r3                  /* save parameters */
        mr      r30,r4
@@ -1872,6 +1796,7 @@ _GLOBAL(__secondary_start)
        mtspr   SRR0,r3
        mtspr   SRR1,r4
        rfid
+       b       .       /* prevent speculative execution */
 
 /* 
  * Running with relocation on at this point.  All we want to do is
@@ -2035,6 +1960,7 @@ _STATIC(start_here_pSeries)
        mtspr   SRR0,r3
        mtspr   SRR1,r4
        rfid
+       b       .       /* prevent speculative execution */
 #endif /* CONFIG_PPC_PSERIES */
        
        /* This is where all platforms converge execution */
index 2f777d5..8461687 100644 (file)
@@ -143,47 +143,6 @@ EXPORT_SYMBOL(synchronize_irq);
 
 #endif /* CONFIG_SMP */
 
-/* XXX Make this into free_irq() - Anton */
-
-/* This could be promoted to a real free_irq() ... */
-static int
-do_free_irq(int irq, void* dev_id)
-{
-       irq_desc_t *desc = get_irq_desc(irq);
-       struct irqaction **p;
-       unsigned long flags;
-
-       spin_lock_irqsave(&desc->lock,flags);
-       p = &desc->action;
-       for (;;) {
-               struct irqaction * action = *p;
-               if (action) {
-                       struct irqaction **pp = p;
-                       p = &action->next;
-                       if (action->dev_id != dev_id)
-                               continue;
-
-                       /* Found it - now remove it from the list of entries */
-                       *pp = action->next;
-                       if (!desc->action) {
-                               desc->status |= IRQ_DISABLED;
-                               mask_irq(irq);
-                       }
-                       spin_unlock_irqrestore(&desc->lock,flags);
-
-                       /* Wait to make sure it's not being used on another CPU */
-                       synchronize_irq(irq);
-                       kfree(action);
-                       return 0;
-               }
-               printk("Trying to free free IRQ%d\n",irq);
-               spin_unlock_irqrestore(&desc->lock,flags);
-               break;
-       }
-       return -ENOENT;
-}
-
-
 int request_irq(unsigned int irq,
        irqreturn_t (*handler)(int, void *, struct pt_regs *),
        unsigned long irqflags, const char * devname, void *dev_id)
@@ -194,8 +153,7 @@ int request_irq(unsigned int irq,
        if (irq >= NR_IRQS)
                return -EINVAL;
        if (!handler)
-               /* We could implement really free_irq() instead of that... */
-               return do_free_irq(irq, dev_id);
+               return -EINVAL;
 
        action = (struct irqaction *)
                kmalloc(sizeof(struct irqaction), GFP_KERNEL);
@@ -222,7 +180,38 @@ EXPORT_SYMBOL(request_irq);
 
 void free_irq(unsigned int irq, void *dev_id)
 {
-       request_irq(irq, NULL, 0, NULL, dev_id);
+       irq_desc_t *desc = get_irq_desc(irq);
+       struct irqaction **p;
+       unsigned long flags;
+
+       spin_lock_irqsave(&desc->lock,flags);
+       p = &desc->action;
+       for (;;) {
+               struct irqaction * action = *p;
+               if (action) {
+                       struct irqaction **pp = p;
+                       p = &action->next;
+                       if (action->dev_id != dev_id)
+                               continue;
+
+                       /* Found it - now remove it from the list of entries */
+                       *pp = action->next;
+                       if (!desc->action) {
+                               desc->status |= IRQ_DISABLED;
+                               mask_irq(irq);
+                       }
+                       spin_unlock_irqrestore(&desc->lock,flags);
+
+                       /* Wait to make sure it's not being used on another CPU */
+                       synchronize_irq(irq);
+                       kfree(action);
+                       return;
+               }
+               printk("Trying to free free IRQ%d\n",irq);
+               spin_unlock_irqrestore(&desc->lock,flags);
+               break;
+       }
+       return;
 }
 
 EXPORT_SYMBOL(free_irq);
@@ -589,7 +578,7 @@ out:
 }
 
 #ifdef CONFIG_PPC_ISERIES
-int do_IRQ(struct pt_regs *regs)
+void do_IRQ(struct pt_regs *regs)
 {
        struct paca_struct *lpaca;
        struct ItLpQueue *lpq;
@@ -629,15 +618,13 @@ int do_IRQ(struct pt_regs *regs)
                /* Signal a fake decrementer interrupt */
                timer_interrupt(regs);
        }
-
-       return 1; /* lets ret_from_int know we can do checks */
 }
 
 #else  /* CONFIG_PPC_ISERIES */
 
-int do_IRQ(struct pt_regs *regs)
+void do_IRQ(struct pt_regs *regs)
 {
-       int irq, first = 1;
+       int irq;
 
        irq_enter();
 
@@ -656,25 +643,15 @@ int do_IRQ(struct pt_regs *regs)
        }
 #endif
 
-       /*
-        * Every arch is required to implement ppc_md.get_irq.
-        * This function will either return an irq number or -1 to
-        * indicate there are no more pending.  But the first time
-        * through the loop this means there wasn't an IRQ pending.
-        * The value -2 is for buggy hardware and means that this IRQ
-        * has already been handled. -- Tom
-        */
-       while ((irq = ppc_md.get_irq(regs)) >= 0) {
+       irq = ppc_md.get_irq(regs);
+
+       if (irq >= 0)
                ppc_irq_dispatch_handler(regs, irq);
-               first = 0;
-       }
-       if (irq != -2 && first)
+       else
                /* That's not SMP safe ... but who cares ? */
                ppc_spurious_interrupts++;
 
        irq_exit();
-
-       return 1; /* lets ret_from_int know we can do checks */
 }
 #endif /* CONFIG_PPC_ISERIES */
 
index e0857d9..9111268 100644 (file)
@@ -832,7 +832,15 @@ _GLOBAL(sys_call_table32)
        .llong .compat_sys_sched_setaffinity
        .llong .compat_sys_sched_getaffinity
        .llong .sys_ni_syscall
-       .llong .sys_ni_syscall          /* 225 - reserved for tux */
+#ifdef CONFIG_TUX
+        .llong .__sys_tux
+#else
+# ifdef CONFIG_TUX_MODULE
+        .llong .sys_tux
+# else
+       .llong .sys_ni_syscall
+# endif
+#endif
        .llong .sys32_sendfile64
        .llong .compat_sys_io_setup
        .llong .sys_io_destroy
@@ -1104,7 +1112,15 @@ _GLOBAL(sys_call_table)
        .llong .sys_sched_setaffinity
        .llong .sys_sched_getaffinity
        .llong .sys_ni_syscall
-       .llong .sys_ni_syscall          /* 225 - reserved for tux */
+#ifdef CONFIG_TUX
+        .llong .__sys_tux
+#else
+# ifdef CONFIG_TUX_MODULE
+        .llong .sys_tux
+# else
+       .llong .sys_ni_syscall
+# endif
+#endif
        .llong .sys_ni_syscall          /* 32bit only sendfile64 */
        .llong .sys_io_setup
        .llong .sys_io_destroy
index 874afcb..f0afedd 100644 (file)
@@ -168,7 +168,7 @@ void __init pSeries_init_openpic(void)
         struct device_node *np;
         int i;
         unsigned int *addrp;
-        unsigned char* chrp_int_ack_special = 0;
+        unsigned char* chrp_int_ack_special = NULL;
         unsigned char init_senses[NR_IRQS - NUM_ISA_INTERRUPTS];
         int nmi_irq = -1;
 #if defined(CONFIG_VT) && defined(CONFIG_ADB_KEYBOARD) && defined(XMON)
@@ -642,13 +642,13 @@ void openpic_request_IPIs(void)
 
        /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
        request_irq(openpic_vec_ipi, openpic_ipi_action, SA_INTERRUPT,
-                   "IPI0 (call function)", 0);
+                   "IPI0 (call function)", NULL);
        request_irq(openpic_vec_ipi+1, openpic_ipi_action, SA_INTERRUPT,
-                  "IPI1 (reschedule)", 0);
+                  "IPI1 (reschedule)", NULL);
        request_irq(openpic_vec_ipi+2, openpic_ipi_action, SA_INTERRUPT,
-                  "IPI2 (unused)", 0);
+                  "IPI2 (unused)", NULL);
        request_irq(openpic_vec_ipi+3, openpic_ipi_action, SA_INTERRUPT,
-                  "IPI3 (debugger break)", 0);
+                  "IPI3 (debugger break)", NULL);
 
        for ( i = 0; i < OPENPIC_NUM_IPI ; i++ )
                openpic_enable_ipi(openpic_vec_ipi+i);
index 73d5b7e..92bc868 100644 (file)
@@ -284,10 +284,10 @@ static void __init pci_process_bridge_OF_ranges(struct pci_controller *hose,
                                isa_dn = of_find_node_by_type(NULL, "isa");
                                if (isa_dn) {
                                        isa_io_base = pci_io_base;
-                                       of_node_put(isa_dn);
                                        pci_process_ISA_OF_ranges(isa_dn,
                                                hose->io_base_phys,
                                                hose->io_base_virt);
+                                       of_node_put(isa_dn);
                                         /* Allow all IO */
                                         io_page_mask = -1;
                                }
@@ -600,8 +600,9 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
                        BUG();  /* No I/O resource for this PHB? */
 
                if (request_resource(&ioport_resource, res))
-                       printk(KERN_ERR "Failed to request IO"
-                                       "on hose %d\n", 0 /* FIXME */);
+                       printk(KERN_ERR "Failed to request IO on "
+                                       "PCI domain %d\n", pci_domain_nr(bus));
+
 
                for (i = 0; i < 3; ++i) {
                        res = &hose->mem_resources[i];
@@ -609,8 +610,9 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
                                BUG();  /* No memory resource for this PHB? */
                        bus->resource[i+1] = res;
                        if (res->flags && request_resource(&iomem_resource, res))
-                               printk(KERN_ERR "Failed to request MEM"
-                                               "on hose %d\n", 0 /* FIXME */);
+                               printk(KERN_ERR "Failed to request MEM on "
+                                               "PCI domain %d\n",
+                                               pci_domain_nr(bus));
                }
        } else if (pci_probe_only &&
                   (dev->class >> 8) == PCI_CLASS_BRIDGE_PCI) {
index 2910537..0e42283 100644 (file)
@@ -29,8 +29,10 @@ extern unsigned long __toc_start;
 
 /* Stack space used when we detect a bad kernel stack pointer, and
  * early in SMP boots before relocation is enabled.
+ *
+ * ABI requires stack to be 128-byte aligned
  */
-char emergency_stack[PAGE_SIZE * NR_CPUS];
+char emergency_stack[PAGE_SIZE * NR_CPUS] __attribute__((aligned(128)));
 
 /* The Paca is an array with one entry per processor.  Each contains an 
  * ItLpPaca, which contains the information shared between the 
@@ -55,7 +57,6 @@ char emergency_stack[PAGE_SIZE * NR_CPUS];
        .stab_addr = (asrv),            /* Virt pointer to segment table */ \
        .emergency_sp = &emergency_stack[((number)+1) * PAGE_SIZE],         \
        .cpu_start = (start),           /* Processor start */               \
-       .stab_next_rr = 1,                                                  \
        .lppaca = {                                                         \
                .xDesc = 0xd397d781,    /* "LpPa" */                        \
                .xSize = sizeof(struct ItLpPaca),                           \
@@ -75,137 +76,137 @@ struct paca_struct paca[] __page_aligned = {
 #ifdef CONFIG_PPC_ISERIES
        PACAINITDATA( 0, 1, &xItLpQueue, 0, STAB0_VIRT_ADDR),
 #else
-       PACAINITDATA( 0, 1, 0, STAB0_PHYS_ADDR, STAB0_VIRT_ADDR),
+       PACAINITDATA( 0, 1, NULL, STAB0_PHYS_ADDR, STAB0_VIRT_ADDR),
 #endif
-       PACAINITDATA( 1, 0, 0, 0, 0),
-       PACAINITDATA( 2, 0, 0, 0, 0),
-       PACAINITDATA( 3, 0, 0, 0, 0),
-       PACAINITDATA( 4, 0, 0, 0, 0),
-       PACAINITDATA( 5, 0, 0, 0, 0),
-       PACAINITDATA( 6, 0, 0, 0, 0),
-       PACAINITDATA( 7, 0, 0, 0, 0),
-       PACAINITDATA( 8, 0, 0, 0, 0),
-       PACAINITDATA( 9, 0, 0, 0, 0),
-       PACAINITDATA(10, 0, 0, 0, 0),
-       PACAINITDATA(11, 0, 0, 0, 0),
-       PACAINITDATA(12, 0, 0, 0, 0),
-       PACAINITDATA(13, 0, 0, 0, 0),
-       PACAINITDATA(14, 0, 0, 0, 0),
-       PACAINITDATA(15, 0, 0, 0, 0),
-       PACAINITDATA(16, 0, 0, 0, 0),
-       PACAINITDATA(17, 0, 0, 0, 0),
-       PACAINITDATA(18, 0, 0, 0, 0),
-       PACAINITDATA(19, 0, 0, 0, 0),
-       PACAINITDATA(20, 0, 0, 0, 0),
-       PACAINITDATA(21, 0, 0, 0, 0),
-       PACAINITDATA(22, 0, 0, 0, 0),
-       PACAINITDATA(23, 0, 0, 0, 0),
-       PACAINITDATA(24, 0, 0, 0, 0),
-       PACAINITDATA(25, 0, 0, 0, 0),
-       PACAINITDATA(26, 0, 0, 0, 0),
-       PACAINITDATA(27, 0, 0, 0, 0),
-       PACAINITDATA(28, 0, 0, 0, 0),
-       PACAINITDATA(29, 0, 0, 0, 0),
-       PACAINITDATA(30, 0, 0, 0, 0),
-       PACAINITDATA(31, 0, 0, 0, 0),
+       PACAINITDATA( 1, 0, NULL, 0, 0),
+       PACAINITDATA( 2, 0, NULL, 0, 0),
+       PACAINITDATA( 3, 0, NULL, 0, 0),
+       PACAINITDATA( 4, 0, NULL, 0, 0),
+       PACAINITDATA( 5, 0, NULL, 0, 0),
+       PACAINITDATA( 6, 0, NULL, 0, 0),
+       PACAINITDATA( 7, 0, NULL, 0, 0),
+       PACAINITDATA( 8, 0, NULL, 0, 0),
+       PACAINITDATA( 9, 0, NULL, 0, 0),
+       PACAINITDATA(10, 0, NULL, 0, 0),
+       PACAINITDATA(11, 0, NULL, 0, 0),
+       PACAINITDATA(12, 0, NULL, 0, 0),
+       PACAINITDATA(13, 0, NULL, 0, 0),
+       PACAINITDATA(14, 0, NULL, 0, 0),
+       PACAINITDATA(15, 0, NULL, 0, 0),
+       PACAINITDATA(16, 0, NULL, 0, 0),
+       PACAINITDATA(17, 0, NULL, 0, 0),
+       PACAINITDATA(18, 0, NULL, 0, 0),
+       PACAINITDATA(19, 0, NULL, 0, 0),
+       PACAINITDATA(20, 0, NULL, 0, 0),
+       PACAINITDATA(21, 0, NULL, 0, 0),
+       PACAINITDATA(22, 0, NULL, 0, 0),
+       PACAINITDATA(23, 0, NULL, 0, 0),
+       PACAINITDATA(24, 0, NULL, 0, 0),
+       PACAINITDATA(25, 0, NULL, 0, 0),
+       PACAINITDATA(26, 0, NULL, 0, 0),
+       PACAINITDATA(27, 0, NULL, 0, 0),
+       PACAINITDATA(28, 0, NULL, 0, 0),
+       PACAINITDATA(29, 0, NULL, 0, 0),
+       PACAINITDATA(30, 0, NULL, 0, 0),
+       PACAINITDATA(31, 0, NULL, 0, 0),
 #if NR_CPUS > 32
-       PACAINITDATA(32, 0, 0, 0, 0),
-       PACAINITDATA(33, 0, 0, 0, 0),
-       PACAINITDATA(34, 0, 0, 0, 0),
-       PACAINITDATA(35, 0, 0, 0, 0),
-       PACAINITDATA(36, 0, 0, 0, 0),
-       PACAINITDATA(37, 0, 0, 0, 0),
-       PACAINITDATA(38, 0, 0, 0, 0),
-       PACAINITDATA(39, 0, 0, 0, 0),
-       PACAINITDATA(40, 0, 0, 0, 0),
-       PACAINITDATA(41, 0, 0, 0, 0),
-       PACAINITDATA(42, 0, 0, 0, 0),
-       PACAINITDATA(43, 0, 0, 0, 0),
-       PACAINITDATA(44, 0, 0, 0, 0),
-       PACAINITDATA(45, 0, 0, 0, 0),
-       PACAINITDATA(46, 0, 0, 0, 0),
-       PACAINITDATA(47, 0, 0, 0, 0),
-       PACAINITDATA(48, 0, 0, 0, 0),
-       PACAINITDATA(49, 0, 0, 0, 0),
-       PACAINITDATA(50, 0, 0, 0, 0),
-       PACAINITDATA(51, 0, 0, 0, 0),
-       PACAINITDATA(52, 0, 0, 0, 0),
-       PACAINITDATA(53, 0, 0, 0, 0),
-       PACAINITDATA(54, 0, 0, 0, 0),
-       PACAINITDATA(55, 0, 0, 0, 0),
-       PACAINITDATA(56, 0, 0, 0, 0),
-       PACAINITDATA(57, 0, 0, 0, 0),
-       PACAINITDATA(58, 0, 0, 0, 0),
-       PACAINITDATA(59, 0, 0, 0, 0),
-       PACAINITDATA(60, 0, 0, 0, 0),
-       PACAINITDATA(61, 0, 0, 0, 0),
-       PACAINITDATA(62, 0, 0, 0, 0),
-       PACAINITDATA(63, 0, 0, 0, 0),
+       PACAINITDATA(32, 0, NULL, 0, 0),
+       PACAINITDATA(33, 0, NULL, 0, 0),
+       PACAINITDATA(34, 0, NULL, 0, 0),
+       PACAINITDATA(35, 0, NULL, 0, 0),
+       PACAINITDATA(36, 0, NULL, 0, 0),
+       PACAINITDATA(37, 0, NULL, 0, 0),
+       PACAINITDATA(38, 0, NULL, 0, 0),
+       PACAINITDATA(39, 0, NULL, 0, 0),
+       PACAINITDATA(40, 0, NULL, 0, 0),
+       PACAINITDATA(41, 0, NULL, 0, 0),
+       PACAINITDATA(42, 0, NULL, 0, 0),
+       PACAINITDATA(43, 0, NULL, 0, 0),
+       PACAINITDATA(44, 0, NULL, 0, 0),
+       PACAINITDATA(45, 0, NULL, 0, 0),
+       PACAINITDATA(46, 0, NULL, 0, 0),
+       PACAINITDATA(47, 0, NULL, 0, 0),
+       PACAINITDATA(48, 0, NULL, 0, 0),
+       PACAINITDATA(49, 0, NULL, 0, 0),
+       PACAINITDATA(50, 0, NULL, 0, 0),
+       PACAINITDATA(51, 0, NULL, 0, 0),
+       PACAINITDATA(52, 0, NULL, 0, 0),
+       PACAINITDATA(53, 0, NULL, 0, 0),
+       PACAINITDATA(54, 0, NULL, 0, 0),
+       PACAINITDATA(55, 0, NULL, 0, 0),
+       PACAINITDATA(56, 0, NULL, 0, 0),
+       PACAINITDATA(57, 0, NULL, 0, 0),
+       PACAINITDATA(58, 0, NULL, 0, 0),
+       PACAINITDATA(59, 0, NULL, 0, 0),
+       PACAINITDATA(60, 0, NULL, 0, 0),
+       PACAINITDATA(61, 0, NULL, 0, 0),
+       PACAINITDATA(62, 0, NULL, 0, 0),
+       PACAINITDATA(63, 0, NULL, 0, 0),
 #if NR_CPUS > 64
-       PACAINITDATA(64, 0, 0, 0, 0),
-       PACAINITDATA(65, 0, 0, 0, 0),
-       PACAINITDATA(66, 0, 0, 0, 0),
-       PACAINITDATA(67, 0, 0, 0, 0),
-       PACAINITDATA(68, 0, 0, 0, 0),
-       PACAINITDATA(69, 0, 0, 0, 0),
-       PACAINITDATA(70, 0, 0, 0, 0),
-       PACAINITDATA(71, 0, 0, 0, 0),
-       PACAINITDATA(72, 0, 0, 0, 0),
-       PACAINITDATA(73, 0, 0, 0, 0),
-       PACAINITDATA(74, 0, 0, 0, 0),
-       PACAINITDATA(75, 0, 0, 0, 0),
-       PACAINITDATA(76, 0, 0, 0, 0),
-       PACAINITDATA(77, 0, 0, 0, 0),
-       PACAINITDATA(78, 0, 0, 0, 0),
-       PACAINITDATA(79, 0, 0, 0, 0),
-       PACAINITDATA(80, 0, 0, 0, 0),
-       PACAINITDATA(81, 0, 0, 0, 0),
-       PACAINITDATA(82, 0, 0, 0, 0),
-       PACAINITDATA(83, 0, 0, 0, 0),
-       PACAINITDATA(84, 0, 0, 0, 0),
-       PACAINITDATA(85, 0, 0, 0, 0),
-       PACAINITDATA(86, 0, 0, 0, 0),
-       PACAINITDATA(87, 0, 0, 0, 0),
-       PACAINITDATA(88, 0, 0, 0, 0),
-       PACAINITDATA(89, 0, 0, 0, 0),
-       PACAINITDATA(90, 0, 0, 0, 0),
-       PACAINITDATA(91, 0, 0, 0, 0),
-       PACAINITDATA(92, 0, 0, 0, 0),
-       PACAINITDATA(93, 0, 0, 0, 0),
-       PACAINITDATA(94, 0, 0, 0, 0),
-       PACAINITDATA(95, 0, 0, 0, 0),
-       PACAINITDATA(96, 0, 0, 0, 0),
-       PACAINITDATA(97, 0, 0, 0, 0),
-       PACAINITDATA(98, 0, 0, 0, 0),
-       PACAINITDATA(99, 0, 0, 0, 0),
-       PACAINITDATA(100, 0, 0, 0, 0),
-       PACAINITDATA(101, 0, 0, 0, 0),
-       PACAINITDATA(102, 0, 0, 0, 0),
-       PACAINITDATA(103, 0, 0, 0, 0),
-       PACAINITDATA(104, 0, 0, 0, 0),
-       PACAINITDATA(105, 0, 0, 0, 0),
-       PACAINITDATA(106, 0, 0, 0, 0),
-       PACAINITDATA(107, 0, 0, 0, 0),
-       PACAINITDATA(108, 0, 0, 0, 0),
-       PACAINITDATA(109, 0, 0, 0, 0),
-       PACAINITDATA(110, 0, 0, 0, 0),
-       PACAINITDATA(111, 0, 0, 0, 0),
-       PACAINITDATA(112, 0, 0, 0, 0),
-       PACAINITDATA(113, 0, 0, 0, 0),
-       PACAINITDATA(114, 0, 0, 0, 0),
-       PACAINITDATA(115, 0, 0, 0, 0),
-       PACAINITDATA(116, 0, 0, 0, 0),
-       PACAINITDATA(117, 0, 0, 0, 0),
-       PACAINITDATA(118, 0, 0, 0, 0),
-       PACAINITDATA(119, 0, 0, 0, 0),
-       PACAINITDATA(120, 0, 0, 0, 0),
-       PACAINITDATA(121, 0, 0, 0, 0),
-       PACAINITDATA(122, 0, 0, 0, 0),
-       PACAINITDATA(123, 0, 0, 0, 0),
-       PACAINITDATA(124, 0, 0, 0, 0),
-       PACAINITDATA(125, 0, 0, 0, 0),
-       PACAINITDATA(126, 0, 0, 0, 0),
-       PACAINITDATA(127, 0, 0, 0, 0),
+       PACAINITDATA(64, 0, NULL, 0, 0),
+       PACAINITDATA(65, 0, NULL, 0, 0),
+       PACAINITDATA(66, 0, NULL, 0, 0),
+       PACAINITDATA(67, 0, NULL, 0, 0),
+       PACAINITDATA(68, 0, NULL, 0, 0),
+       PACAINITDATA(69, 0, NULL, 0, 0),
+       PACAINITDATA(70, 0, NULL, 0, 0),
+       PACAINITDATA(71, 0, NULL, 0, 0),
+       PACAINITDATA(72, 0, NULL, 0, 0),
+       PACAINITDATA(73, 0, NULL, 0, 0),
+       PACAINITDATA(74, 0, NULL, 0, 0),
+       PACAINITDATA(75, 0, NULL, 0, 0),
+       PACAINITDATA(76, 0, NULL, 0, 0),
+       PACAINITDATA(77, 0, NULL, 0, 0),
+       PACAINITDATA(78, 0, NULL, 0, 0),
+       PACAINITDATA(79, 0, NULL, 0, 0),
+       PACAINITDATA(80, 0, NULL, 0, 0),
+       PACAINITDATA(81, 0, NULL, 0, 0),
+       PACAINITDATA(82, 0, NULL, 0, 0),
+       PACAINITDATA(83, 0, NULL, 0, 0),
+       PACAINITDATA(84, 0, NULL, 0, 0),
+       PACAINITDATA(85, 0, NULL, 0, 0),
+       PACAINITDATA(86, 0, NULL, 0, 0),
+       PACAINITDATA(87, 0, NULL, 0, 0),
+       PACAINITDATA(88, 0, NULL, 0, 0),
+       PACAINITDATA(89, 0, NULL, 0, 0),
+       PACAINITDATA(90, 0, NULL, 0, 0),
+       PACAINITDATA(91, 0, NULL, 0, 0),
+       PACAINITDATA(92, 0, NULL, 0, 0),
+       PACAINITDATA(93, 0, NULL, 0, 0),
+       PACAINITDATA(94, 0, NULL, 0, 0),
+       PACAINITDATA(95, 0, NULL, 0, 0),
+       PACAINITDATA(96, 0, NULL, 0, 0),
+       PACAINITDATA(97, 0, NULL, 0, 0),
+       PACAINITDATA(98, 0, NULL, 0, 0),
+       PACAINITDATA(99, 0, NULL, 0, 0),
+       PACAINITDATA(100, 0, NULL, 0, 0),
+       PACAINITDATA(101, 0, NULL, 0, 0),
+       PACAINITDATA(102, 0, NULL, 0, 0),
+       PACAINITDATA(103, 0, NULL, 0, 0),
+       PACAINITDATA(104, 0, NULL, 0, 0),
+       PACAINITDATA(105, 0, NULL, 0, 0),
+       PACAINITDATA(106, 0, NULL, 0, 0),
+       PACAINITDATA(107, 0, NULL, 0, 0),
+       PACAINITDATA(108, 0, NULL, 0, 0),
+       PACAINITDATA(109, 0, NULL, 0, 0),
+       PACAINITDATA(110, 0, NULL, 0, 0),
+       PACAINITDATA(111, 0, NULL, 0, 0),
+       PACAINITDATA(112, 0, NULL, 0, 0),
+       PACAINITDATA(113, 0, NULL, 0, 0),
+       PACAINITDATA(114, 0, NULL, 0, 0),
+       PACAINITDATA(115, 0, NULL, 0, 0),
+       PACAINITDATA(116, 0, NULL, 0, 0),
+       PACAINITDATA(117, 0, NULL, 0, 0),
+       PACAINITDATA(118, 0, NULL, 0, 0),
+       PACAINITDATA(119, 0, NULL, 0, 0),
+       PACAINITDATA(120, 0, NULL, 0, 0),
+       PACAINITDATA(121, 0, NULL, 0, 0),
+       PACAINITDATA(122, 0, NULL, 0, 0),
+       PACAINITDATA(123, 0, NULL, 0, 0),
+       PACAINITDATA(124, 0, NULL, 0, 0),
+       PACAINITDATA(125, 0, NULL, 0, 0),
+       PACAINITDATA(126, 0, NULL, 0, 0),
+       PACAINITDATA(127, 0, NULL, 0, 0),
 #endif
 #endif
 };
index 50c3bf6..2ca27cc 100644 (file)
@@ -34,8 +34,8 @@ extern struct pci_dev *ppc64_isabridge_dev;   /* may be NULL if no ISA bus */
  *******************************************************************/
 struct device_node;
 typedef void *(*traverse_func)(struct device_node *me, void *data);
-void *traverse_pci_devices(struct device_node *start, traverse_func pre, traverse_func post, void *data);
-void *traverse_all_pci_devices(traverse_func pre);
+void *traverse_pci_devices(struct device_node *start, traverse_func pre,
+               void *data);
 
 void pci_devs_phb_init(void);
 void pci_fix_bus_sysdata(void);
index a4318c3..bdf5e3a 100644 (file)
@@ -133,10 +133,10 @@ typedef unsigned long interpret_func(struct device_node *, unsigned long,
 /* prom structure */
 struct prom_t prom;
 
-char *prom_display_paths[FB_MAX] __initdata = { 0, };
+char *prom_display_paths[FB_MAX] __initdata = { NULL, };
 phandle prom_display_nodes[FB_MAX] __initdata;
 unsigned int prom_num_displays = 0;
-char *of_stdout_device = 0;
+char *of_stdout_device = NULL;
 
 static int iommu_force_on;
 int ppc64_iommu_off;
@@ -148,13 +148,13 @@ extern struct lmb lmb;
 #define MAX_PHB (32 * 6)  /* 32 drawers * 6 PHBs/drawer */
 struct of_tce_table of_tce_table[MAX_PHB + 1];
 
-char *bootpath = 0;
-char *bootdevice = 0;
+char *bootpath = NULL;
+char *bootdevice = NULL;
 
 int boot_cpuid = 0;
 #define MAX_CPU_THREADS 2
 
-struct device_node *allnodes = 0;
+struct device_node *allnodes = NULL;
 /* use when traversing tree through the allnext, child, sibling,
  * or parent members of struct device_node.
  */
@@ -199,16 +199,16 @@ static int __init call_prom(const char *service, int nargs, int nret, ...)
        unsigned long offset = reloc_offset();
        struct prom_t *_prom = PTRRELOC(&prom);
        va_list list;
-        
+
        _prom->args.service = ADDR(service);
        _prom->args.nargs = nargs;
        _prom->args.nret = nret;
-        _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]);
+       _prom->args.rets = (prom_arg_t *)&(_prom->args.args[nargs]);
 
-        va_start(list, nret);
+       va_start(list, nret);
        for (i=0; i < nargs; i++)
                _prom->args.args[i] = va_arg(list, prom_arg_t);
-        va_end(list);
+       va_end(list);
 
        for (i=0; i < nret ;i++)
                _prom->args.rets[i] = 0;
@@ -244,17 +244,17 @@ static void __init prom_print(const char *msg)
 static void __init prom_print_hex(unsigned long val)
 {
        unsigned long offset = reloc_offset();
-        int i, nibbles = sizeof(val)*2;
-        char buf[sizeof(val)*2+1];
+       int i, nibbles = sizeof(val)*2;
+       char buf[sizeof(val)*2+1];
        struct prom_t *_prom = PTRRELOC(&prom);
 
-        for (i = nibbles-1;  i >= 0;  i--) {
-                buf[i] = (val & 0xf) + '0';
-                if (buf[i] > '9')
-                    buf[i] += ('a'-'0'-10);
-                val >>= 4;
-        }
-        buf[nibbles] = '\0';
+       for (i = nibbles-1;  i >= 0;  i--) {
+               buf[i] = (val & 0xf) + '0';
+               if (buf[i] > '9')
+                       buf[i] += ('a'-'0'-10);
+               val >>= 4;
+       }
+       buf[nibbles] = '\0';
        call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
 }
 
@@ -343,22 +343,22 @@ static void __init prom_initialize_naca(void)
 {
        phandle node;
        char type[64];
-        unsigned long num_cpus = 0;
-        unsigned long offset = reloc_offset();
+       unsigned long num_cpus = 0;
+       unsigned long offset = reloc_offset();
        struct prom_t *_prom = PTRRELOC(&prom);
-        struct naca_struct *_naca = RELOC(naca);
-        struct systemcfg *_systemcfg = RELOC(systemcfg);
+       struct naca_struct *_naca = RELOC(naca);
+       struct systemcfg *_systemcfg = RELOC(systemcfg);
 
        /* NOTE: _naca->debug_switch is already initialized. */
        prom_debug("prom_initialize_naca: start...\n");
 
        _naca->pftSize = 0;     /* ilog2 of htab size.  computed below. */
 
-        for (node = 0; prom_next_node(&node); ) {
-                type[0] = 0;
+       for (node = 0; prom_next_node(&node); ) {
+               type[0] = 0;
                prom_getprop(node, "device_type", type, sizeof(type));
 
-                if (!strcmp(type, RELOC("cpu"))) {
+               if (!strcmp(type, RELOC("cpu"))) {
                        num_cpus += 1;
 
                        /* We're assuming *all* of the CPUs have the same
@@ -404,7 +404,7 @@ static void __init prom_initialize_naca(void)
                                        _naca->pftSize = pft_size[1];
                                }
                        }
-                } else if (!strcmp(type, RELOC("serial"))) {
+               } else if (!strcmp(type, RELOC("serial"))) {
                        phandle isa, pci;
                        struct isa_reg_property reg;
                        union pci_range ranges;
@@ -435,7 +435,7 @@ static void __init prom_initialize_naca(void)
                                        ((((unsigned long)ranges.pci64.phys_hi) << 32) |
                                         (ranges.pci64.phys_lo)) + reg.address;
                        }
-                }
+               }
        }
 
        if (_systemcfg->platform == PLATFORM_POWERMAC)
@@ -465,8 +465,8 @@ static void __init prom_initialize_naca(void)
        }
 
        /* We gotta have at least 1 cpu... */
-        if ( (_systemcfg->processorCount = num_cpus) < 1 )
-                PROM_BUG();
+       if ( (_systemcfg->processorCount = num_cpus) < 1 )
+               PROM_BUG();
 
        _systemcfg->physicalMemorySize = lmb_phys_mem_size();
 
@@ -496,21 +496,21 @@ static void __init prom_initialize_naca(void)
        _systemcfg->version.minor = SYSTEMCFG_MINOR;
        _systemcfg->processor = _get_PVR();
 
-        prom_debug("systemcfg->processorCount       = 0x%x\n",
+       prom_debug("systemcfg->processorCount       = 0x%x\n",
                   _systemcfg->processorCount);
-        prom_debug("systemcfg->physicalMemorySize   = 0x%x\n",
+       prom_debug("systemcfg->physicalMemorySize   = 0x%x\n",
                   _systemcfg->physicalMemorySize);
-        prom_debug("naca->pftSize                   = 0x%x\n",
+       prom_debug("naca->pftSize                   = 0x%x\n",
                   _naca->pftSize);
-        prom_debug("systemcfg->dCacheL1LineSize     = 0x%x\n",
+       prom_debug("systemcfg->dCacheL1LineSize     = 0x%x\n",
                   _systemcfg->dCacheL1LineSize);
-        prom_debug("systemcfg->iCacheL1LineSize     = 0x%x\n",
+       prom_debug("systemcfg->iCacheL1LineSize     = 0x%x\n",
                   _systemcfg->iCacheL1LineSize);
-        prom_debug("naca->serialPortAddr            = 0x%x\n",
+       prom_debug("naca->serialPortAddr            = 0x%x\n",
                   _naca->serialPortAddr);
-        prom_debug("naca->interrupt_controller      = 0x%x\n",
+       prom_debug("naca->interrupt_controller      = 0x%x\n",
                   _naca->interrupt_controller);
-        prom_debug("systemcfg->platform             = 0x%x\n",
+       prom_debug("systemcfg->platform             = 0x%x\n",
                   _systemcfg->platform);
        prom_debug("prom_initialize_naca: end...\n");
 }
@@ -547,36 +547,36 @@ static void __init early_cmdline_parse(void)
 #ifdef DEBUG_PROM
 void prom_dump_lmb(void)
 {
-        unsigned long i;
-        unsigned long offset = reloc_offset();
+       unsigned long i;
+       unsigned long offset = reloc_offset();
        struct lmb *_lmb  = PTRRELOC(&lmb);
 
-        prom_printf("\nprom_dump_lmb:\n");
-        prom_printf("    memory.cnt                  = 0x%x\n",
+       prom_printf("\nprom_dump_lmb:\n");
+       prom_printf("    memory.cnt               = 0x%x\n",
                    _lmb->memory.cnt);
-        prom_printf("    memory.size                 = 0x%x\n",
+       prom_printf("    memory.size             = 0x%x\n",
                    _lmb->memory.size);
-        for (i=0; i < _lmb->memory.cnt ;i++) {
-                prom_printf("    memory.region[0x%x].base       = 0x%x\n",
+       for (i=0; i < _lmb->memory.cnt ;i++) {
+               prom_printf("    memory.region[0x%x].base       = 0x%x\n",
                            i, _lmb->memory.region[i].base);
-                prom_printf("                      .physbase = 0x%x\n",
+               prom_printf("                 .physbase = 0x%x\n",
                            _lmb->memory.region[i].physbase);
-                prom_printf("                      .size     = 0x%x\n",
+               prom_printf("                 .size     = 0x%x\n",
                            _lmb->memory.region[i].size);
-        }
+       }
 
-        prom_printf("\n    reserved.cnt                  = 0x%x\n",
+       prom_printf("\n    reserved.cnt           = 0x%x\n",
                    _lmb->reserved.cnt);
-        prom_printf("    reserved.size                 = 0x%x\n",
+       prom_printf("    reserved.size           = 0x%x\n",
                    _lmb->reserved.size);
-        for (i=0; i < _lmb->reserved.cnt ;i++) {
-                prom_printf("    reserved.region[0x%x\n].base       = 0x%x\n",
+       for (i=0; i < _lmb->reserved.cnt ;i++) {
+               prom_printf("    reserved.region[0x%x\n].base       = 0x%x\n",
                            i, _lmb->reserved.region[i].base);
-                prom_printf("                      .physbase = 0x%x\n",
+               prom_printf("                 .physbase = 0x%x\n",
                            _lmb->reserved.region[i].physbase);
-                prom_printf("                      .size     = 0x%x\n",
+               prom_printf("                 .size     = 0x%x\n",
                            _lmb->reserved.region[i].size);
-        }
+       }
 }
 #endif /* DEBUG_PROM */
 
@@ -584,9 +584,9 @@ static void __init prom_initialize_lmb(void)
 {
        phandle node;
        char type[64];
-        unsigned long i, offset = reloc_offset();
+       unsigned long i, offset = reloc_offset();
        struct prom_t *_prom = PTRRELOC(&prom);
-        struct systemcfg *_systemcfg = RELOC(systemcfg);
+       struct systemcfg *_systemcfg = RELOC(systemcfg);
        union lmb_reg_property reg;
        unsigned long lmb_base, lmb_size;
        unsigned long num_regs, bytes_per_reg = (_prom->encode_phys_size*2)/8;
@@ -599,11 +599,11 @@ static void __init prom_initialize_lmb(void)
        if (_systemcfg->platform == PLATFORM_POWERMAC)
                bytes_per_reg = 12;
 
-        for (node = 0; prom_next_node(&node); ) {
-                type[0] = 0;
-                prom_getprop(node, "device_type", type, sizeof(type));
+       for (node = 0; prom_next_node(&node); ) {
+               type[0] = 0;
+               prom_getprop(node, "device_type", type, sizeof(type));
 
-                if (strcmp(type, RELOC("memory")))
+               if (strcmp(type, RELOC("memory")))
                        continue;
 
                num_regs = prom_getprop(node, "reg", &reg, sizeof(reg))
@@ -651,7 +651,7 @@ prom_instantiate_rtas(void)
        struct rtas_t *_rtas = PTRRELOC(&rtas);
        struct systemcfg *_systemcfg = RELOC(systemcfg);
        ihandle prom_rtas;
-        u32 getprop_rval;
+       u32 getprop_rval;
        char hypertas_funcs[4];
 
        prom_debug("prom_instantiate_rtas: start...\n");
@@ -669,7 +669,7 @@ prom_instantiate_rtas(void)
 
                prom_getprop(prom_rtas, "rtas-size",
                             &getprop_rval, sizeof(getprop_rval));
-               _rtas->size = getprop_rval;
+               _rtas->size = getprop_rval;
                prom_printf("instantiating rtas");
                if (_rtas->size != 0) {
                        unsigned long rtas_region = RTAS_INSTANTIATE_MAX;
@@ -707,9 +707,9 @@ prom_instantiate_rtas(void)
                        prom_printf(" done\n");
                }
 
-               prom_debug("rtas->base                = 0x%x\n", _rtas->base);
-               prom_debug("rtas->entry               = 0x%x\n", _rtas->entry);
-               prom_debug("rtas->size                = 0x%x\n", _rtas->size);
+               prom_debug("rtas->base          = 0x%x\n", _rtas->base);
+               prom_debug("rtas->entry        = 0x%x\n", _rtas->entry);
+               prom_debug("rtas->size          = 0x%x\n", _rtas->size);
        }
        prom_debug("prom_instantiate_rtas: end...\n");
 }
@@ -744,7 +744,7 @@ static void __init prom_initialize_tce_table(void)
 {
        phandle node;
        ihandle phb_node;
-        unsigned long offset = reloc_offset();
+       unsigned long offset = reloc_offset();
        char compatible[64], path[64], type[64], model[64];
        unsigned long i, table = 0;
        unsigned long base, vbase, align;
@@ -775,9 +775,9 @@ static void __init prom_initialize_tce_table(void)
 
                /* Keep the old logic in tack to avoid regression. */
                if (compatible[0] != 0) {
-                       if((strstr(compatible, RELOC("python")) == NULL) &&
-                          (strstr(compatible, RELOC("Speedwagon")) == NULL) &&
-                          (strstr(compatible, RELOC("Winnipeg")) == NULL))
+                       if ((strstr(compatible, RELOC("python")) == NULL) &&
+                           (strstr(compatible, RELOC("Speedwagon")) == NULL) &&
+                           (strstr(compatible, RELOC("Winnipeg")) == NULL))
                                continue;
                } else if (model[0] != 0) {
                        if ((strstr(model, RELOC("ython")) == NULL) &&
@@ -853,21 +853,21 @@ static void __init prom_initialize_tce_table(void)
                /* Call OF to setup the TCE hardware */
                if (call_prom("package-to-path", 3, 1, node,
                              path, sizeof(path)-1) == PROM_ERROR) {
-                        prom_printf("package-to-path failed\n");
-                } else {
-                        prom_printf("opening PHB %s", path);
-                }
-
-                phb_node = call_prom("open", 1, 1, path);
-                if ( (long)phb_node <= 0) {
-                        prom_printf("... failed\n");
-                } else {
-                        prom_printf("... done\n");
-                }
-                call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"),
+                       prom_printf("package-to-path failed\n");
+               } else {
+                       prom_printf("opening PHB %s", path);
+               }
+
+               phb_node = call_prom("open", 1, 1, path);
+               if ( (long)phb_node <= 0) {
+                       prom_printf("... failed\n");
+               } else {
+                       prom_printf("... done\n");
+               }
+               call_prom("call-method", 6, 0, ADDR("set-64-bit-addressing"),
                          phb_node, -1, minsize,
                          (u32) base, (u32) (base >> 32));
-                call_prom("close", 1, 0, phb_node);
+               call_prom("close", 1, 0, phb_node);
 
                table++;
        }
@@ -910,15 +910,15 @@ static void __init prom_hold_cpus(unsigned long mem)
        unsigned int cpu_threads, hw_cpu_num;
        int propsize;
        extern void __secondary_hold(void);
-        extern unsigned long __secondary_hold_spinloop;
-        extern unsigned long __secondary_hold_acknowledge;
-        unsigned long *spinloop
+       extern unsigned long __secondary_hold_spinloop;
+       extern unsigned long __secondary_hold_acknowledge;
+       unsigned long *spinloop
                = (void *)virt_to_abs(&__secondary_hold_spinloop);
-        unsigned long *acknowledge
+       unsigned long *acknowledge
                = (void *)virt_to_abs(&__secondary_hold_acknowledge);
-        unsigned long secondary_hold
+       unsigned long secondary_hold
                = virt_to_abs(*PTRRELOC((unsigned long *)__secondary_hold));
-        struct systemcfg *_systemcfg = RELOC(systemcfg);
+       struct systemcfg *_systemcfg = RELOC(systemcfg);
        struct paca_struct *lpaca = PTRRELOC(&paca[0]);
        struct prom_t *_prom = PTRRELOC(&prom);
 #ifdef CONFIG_SMP
@@ -962,12 +962,12 @@ static void __init prom_hold_cpus(unsigned long mem)
        prom_debug("    1) *acknowledge   = 0x%x\n", *acknowledge);
        prom_debug("    1) secondary_hold = 0x%x\n", secondary_hold);
 
-        /* Set the common spinloop variable, so all of the secondary cpus
+       /* Set the common spinloop variable, so all of the secondary cpus
         * will block when they are awakened from their OF spinloop.
         * This must occur for both SMP and non SMP kernels, since OF will
         * be trashed when we move the kernel.
-         */
-        *spinloop = 0;
+        */
+       *spinloop = 0;
 
 #ifdef CONFIG_HMT
        for (i=0; i < NR_CPUS; i++) {
@@ -986,7 +986,7 @@ static void __init prom_hold_cpus(unsigned long mem)
                if (strcmp(type, RELOC("okay")) != 0)
                        continue;
 
-                reg = -1;
+               reg = -1;
                prom_getprop(node, "reg", &reg, sizeof(reg));
 
                path = (char *) mem;
@@ -1124,7 +1124,7 @@ static void __init smt_setup(void)
        ihandle prom_options = 0;
        char option[9];
        unsigned long offset = reloc_offset();
-        struct naca_struct *_naca = RELOC(naca);
+       struct naca_struct *_naca = RELOC(naca);
        char found = 0;
 
        if (strstr(RELOC(cmd_line), RELOC("smt-enabled="))) {
@@ -1253,10 +1253,10 @@ static void __init prom_init_stdout(void)
        struct prom_t *_prom = PTRRELOC(&prom);
        u32 val;
 
-        if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0)
-                prom_panic("cannot find stdout");
+       if (prom_getprop(_prom->chosen, "stdout", &val, sizeof(val)) <= 0)
+               prom_panic("cannot find stdout");
 
-        _prom->stdout = val;
+       _prom->stdout = val;
 }
 
 static int __init prom_find_machine_type(void)
@@ -1306,7 +1306,7 @@ static unsigned long __init check_display(unsigned long mem)
        ihandle ih;
        int i, j;
        unsigned long offset = reloc_offset();
-        struct prom_t *_prom = PTRRELOC(&prom);
+       struct prom_t *_prom = PTRRELOC(&prom);
        char type[16], *path;
        static unsigned char default_colors[] = {
                0x00, 0x00, 0x00,
@@ -1403,7 +1403,7 @@ static unsigned long __init check_display(unsigned long mem)
                                break;
 #endif /* CONFIG_LOGO_LINUX_CLUT224 */
        }
-       
+
        return DOUBLEWORD_ALIGN(mem);
 }
 
@@ -1412,11 +1412,11 @@ static void __init *__make_room(unsigned long *mem_start, unsigned long *mem_end
                                unsigned long needed, unsigned long align)
 {
        void *ret;
-       unsigned long offset = reloc_offset();
 
        *mem_start = ALIGN(*mem_start, align);
        if (*mem_start + needed > *mem_end) {
 #ifdef CONFIG_BLK_DEV_INITRD
+               unsigned long offset = reloc_offset();
                /* FIXME: Apple OF doesn't map unclaimed mem.  If this
                 * ever happened on G5, we'd need to fix. */
                unsigned long initrd_len;
@@ -1582,8 +1582,8 @@ copy_device_tree(unsigned long mem_start)
                prom_panic("couldn't get device tree root\n");
        }
        allnextp = &RELOC(allnodes);
-       inspect_node(root, 0, &mem_start, &mem_end, &allnextp);
-       *allnextp = 0;
+       inspect_node(root, NULL, &mem_start, &mem_end, &allnextp);
+       *allnextp = NULL;
        return mem_start;
 }
 
@@ -1592,7 +1592,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs)
 {
        struct bi_record *first, *last;
 
-       prom_debug("birec_verify: r6=0x%x\n", (unsigned long)bi_recs);
+       prom_debug("birec_verify: r6=0x%x\n", (unsigned long)bi_recs);
        if (bi_recs != NULL)
                prom_debug("  tag=0x%x\n", bi_recs->tag);
 
@@ -1601,7 +1601,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs)
 
        last = (struct bi_record *)(long)bi_recs->data[0];
 
-       prom_debug("  last=0x%x\n", (unsigned long)last);
+       prom_debug("  last=0x%x\n", (unsigned long)last);
        if (last != NULL)
                prom_debug("  last_tag=0x%x\n", last->tag);
 
@@ -1609,7 +1609,7 @@ static struct bi_record * __init prom_bi_rec_verify(struct bi_record *bi_recs)
                return NULL;
 
        first = (struct bi_record *)(long)last->data[0];
-       prom_debug("  first=0x%x\n", (unsigned long)first);
+       prom_debug("  first=0x%x\n", (unsigned long)first);
 
        if ( first == NULL || first != bi_recs )
                return NULL;
@@ -1681,9 +1681,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
        /* Init prom stdout device */
        prom_init_stdout();
 
-       prom_debug("klimit=0x%x\n", RELOC(klimit));
-       prom_debug("offset=0x%x\n", offset);
-       prom_debug("->mem=0x%x\n", RELOC(klimit) - offset);
+       prom_debug("klimit=0x%x\n", RELOC(klimit));
+       prom_debug("offset=0x%x\n", offset);
+       prom_debug("->mem=0x%x\n", RELOC(klimit) - offset);
 
        /* check out if we have bi_recs */
        _prom->bi_recs = prom_bi_rec_verify((struct bi_record *)r6);
@@ -1713,7 +1713,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
                copy_and_flush(0, KERNELBASE - offset, 0x100, 0);
 
        /* Start storing things at klimit */
-       mem = RELOC(klimit) - offset;
+       mem = RELOC(klimit) - offset;
 
        /* Get the full OF pathname of the stdout device */
        p = (char *) mem;
@@ -1728,9 +1728,9 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
        _prom->encode_phys_size = (getprop_rval == 1) ? 32 : 64;
 
        /* Determine which cpu is actually running right _now_ */
-        if (prom_getprop(_prom->chosen, "cpu",
+       if (prom_getprop(_prom->chosen, "cpu",
                         &prom_cpu, sizeof(prom_cpu)) <= 0)
-                prom_panic("cannot find boot cpu");
+               prom_panic("cannot find boot cpu");
 
        cpu_pkg = call_prom("instance-to-package", 1, 1, prom_cpu);
        prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval));
@@ -1739,7 +1739,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
 
        RELOC(boot_cpuid) = 0;
 
-       prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu);
+       prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu);
 
        /* Get the boot device and translate it to a full OF pathname. */
        p = (char *) mem;
@@ -1773,18 +1773,18 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
        if (_systemcfg->platform != PLATFORM_POWERMAC)
                prom_instantiate_rtas();
 
-        /* Initialize some system info into the Naca early... */
-        prom_initialize_naca();
+       /* Initialize some system info into the Naca early... */
+       prom_initialize_naca();
 
        smt_setup();
 
-        /* If we are on an SMP machine, then we *MUST* do the
-         * following, regardless of whether we have an SMP
-         * kernel or not.
-         */
+       /* If we are on an SMP machine, then we *MUST* do the
+        * following, regardless of whether we have an SMP
+        * kernel or not.
+        */
        prom_hold_cpus(mem);
 
-       prom_debug("after basic inits, mem=0x%x\n", mem);
+       prom_debug("after basic inits, mem=0x%x\n", mem);
 #ifdef CONFIG_BLK_DEV_INITRD
        prom_debug("initrd_start=0x%x\n", RELOC(initrd_start));
        prom_debug("initrd_end=0x%x\n", RELOC(initrd_end));
@@ -1796,7 +1796,7 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp,
        RELOC(klimit) = mem + offset;
 
        prom_debug("new klimit is\n");
-       prom_debug("klimit=0x%x\n", RELOC(klimit));
+       prom_debug("klimit=0x%x\n", RELOC(klimit));
        prom_debug(" ->mem=0x%x\n", mem);
 
        lmb_reserve(0, __pa(RELOC(klimit)));
@@ -1881,8 +1881,7 @@ intr_parent(struct device_node *p)
  * Find out the size of each entry of the interrupts property
  * for a node.
  */
-static int __devinit
-prom_n_intr_cells(struct device_node *np)
+int __devinit prom_n_intr_cells(struct device_node *np)
 {
        struct device_node *p;
        unsigned int *icp;
@@ -1896,7 +1895,7 @@ prom_n_intr_cells(struct device_node *np)
                    || get_property(p, "interrupt-map", NULL) != NULL) {
                        printk("oops, node %s doesn't have #interrupt-cells\n",
                               p->full_name);
-               return 1;
+                       return 1;
                }
        }
 #ifdef DEBUG_IRQ
@@ -2082,7 +2081,7 @@ interpret_pci_props(struct device_node *np, unsigned long mem_start,
                i = 0;
                adr = (struct address_range *) mem_start;
                while ((l -= sizeof(struct pci_reg_property)) >= 0) {
-                       if (!measure_only) {
+                       if (!measure_only) {
                                adr[i].space = pci_addrs[i].addr.a_hi;
                                adr[i].address = pci_addrs[i].addr.a_lo;
                                adr[i].size = pci_addrs[i].size_lo;
@@ -2121,7 +2120,7 @@ interpret_dbdma_props(struct device_node *np, unsigned long mem_start,
                i = 0;
                adr = (struct address_range *) mem_start;
                while ((l -= sizeof(struct reg_property32)) >= 0) {
-                       if (!measure_only) {
+                       if (!measure_only) {
                                adr[i].space = 2;
                                adr[i].address = rp[i].address + base_address;
                                adr[i].size = rp[i].size;
@@ -2161,7 +2160,7 @@ interpret_macio_props(struct device_node *np, unsigned long mem_start,
                i = 0;
                adr = (struct address_range *) mem_start;
                while ((l -= sizeof(struct reg_property32)) >= 0) {
-                       if (!measure_only) {
+                       if (!measure_only) {
                                adr[i].space = 2;
                                adr[i].address = rp[i].address + base_address;
                                adr[i].size = rp[i].size;
@@ -2189,7 +2188,7 @@ interpret_isa_props(struct device_node *np, unsigned long mem_start,
                i = 0;
                adr = (struct address_range *) mem_start;
                while ((l -= sizeof(struct reg_property)) >= 0) {
-                       if (!measure_only) {
+                       if (!measure_only) {
                                adr[i].space = rp[i].space;
                                adr[i].address = rp[i].address;
                                adr[i].size = rp[i].size;
@@ -2218,7 +2217,7 @@ interpret_root_props(struct device_node *np, unsigned long mem_start,
                i = 0;
                adr = (struct address_range *) mem_start;
                while ((l -= rpsize) >= 0) {
-                       if (!measure_only) {
+                       if (!measure_only) {
                                adr[i].space = 0;
                                adr[i].address = rp[naddrc - 1];
                                adr[i].size = rp[naddrc + nsizec - 1];
@@ -2241,8 +2240,8 @@ finish_node(struct device_node *np, unsigned long mem_start,
        struct device_node *child;
        int *ip;
 
-       np->name = get_property(np, "name", 0);
-       np->type = get_property(np, "device_type", 0);
+       np->name = get_property(np, "name", NULL);
+       np->type = get_property(np, "device_type", NULL);
 
        if (!np->name)
                np->name = "<NULL>";
@@ -2256,10 +2255,10 @@ finish_node(struct device_node *np, unsigned long mem_start,
        mem_start = finish_node_interrupts(np, mem_start, measure_only);
 
        /* Look for #address-cells and #size-cells properties. */
-       ip = (int *) get_property(np, "#address-cells", 0);
+       ip = (int *) get_property(np, "#address-cells", NULL);
        if (ip != NULL)
                naddrc = *ip;
-       ip = (int *) get_property(np, "#size-cells", 0);
+       ip = (int *) get_property(np, "#size-cells", NULL);
        if (ip != NULL)
                nsizec = *ip;
 
@@ -2267,7 +2266,7 @@ finish_node(struct device_node *np, unsigned long mem_start,
         * expect for the name -- Cort
         */
        if (!strcmp(np->name, "display"))
-               np->name = get_property(np, "compatible", 0);
+               np->name = get_property(np, "compatible", NULL);
 
        if (!strcmp(np->name, "device-tree") || np->parent == NULL)
                ifunc = interpret_root_props;
@@ -2296,7 +2295,7 @@ finish_node(struct device_node *np, unsigned long mem_start,
        return mem_start;
 }
 
-/*
+/**
  * finish_device_tree is called once things are running normally
  * (i.e. with text and data mapped to the address they were linked at).
  * It traverses the device tree and fills in the name, type,
@@ -2324,7 +2323,7 @@ prom_n_addr_cells(struct device_node* np)
        do {
                if (np->parent)
                        np = np->parent;
-               ip = (int *) get_property(np, "#address-cells", 0);
+               ip = (int *) get_property(np, "#address-cells", NULL);
                if (ip != NULL)
                        return *ip;
        } while (np->parent);
@@ -2339,7 +2338,7 @@ prom_n_size_cells(struct device_node* np)
        do {
                if (np->parent)
                        np = np->parent;
-               ip = (int *) get_property(np, "#size-cells", 0);
+               ip = (int *) get_property(np, "#size-cells", NULL);
                if (ip != NULL)
                        return *ip;
        } while (np->parent);
@@ -2347,7 +2346,7 @@ prom_n_size_cells(struct device_node* np)
        return 1;
 }
 
-/*
+/**
  * Work out the sense (active-low level / active-high edge)
  * of each interrupt from the device tree.
  */
@@ -2369,7 +2368,7 @@ prom_get_irq_senses(unsigned char *senses, int off, int max)
        }
 }
 
-/*
+/**
  * Construct and return a list of the device_nodes with a given name.
  */
 struct device_node *
@@ -2384,11 +2383,11 @@ find_devices(const char *name)
                        prevp = &np->next;
                }
        }
-       *prevp = 0;
+       *prevp = NULL;
        return head;
 }
 
-/*
+/**
  * Construct and return a list of the device_nodes with a given type.
  */
 struct device_node *
@@ -2403,11 +2402,11 @@ find_type_devices(const char *type)
                        prevp = &np->next;
                }
        }
-       *prevp = 0;
+       *prevp = NULL;
        return head;
 }
 
-/*
+/**
  * Returns all nodes linked together
  */
 struct device_node *
@@ -2420,11 +2419,11 @@ find_all_nodes(void)
                *prevp = np;
                prevp = &np->next;
        }
-       *prevp = 0;
+       *prevp = NULL;
        return head;
 }
 
-/* Checks if the given "compat" string matches one of the strings in
+/** Checks if the given "compat" string matches one of the strings in
  * the device's "compatible" property
  */
 int
@@ -2448,7 +2447,7 @@ device_is_compatible(struct device_node *device, const char *compat)
 }
 
 
-/*
+/**
  * Indicates whether the root node has a given value in its
  * compatible property.
  */
@@ -2457,7 +2456,7 @@ machine_is_compatible(const char *compat)
 {
        struct device_node *root;
        int rc = 0;
-  
+
        root = of_find_node_by_path("/");
        if (root) {
                rc = device_is_compatible(root, compat);
@@ -2466,7 +2465,7 @@ machine_is_compatible(const char *compat)
        return rc;
 }
 
-/*
+/**
  * Construct and return a list of the device_nodes with a given type
  * and compatible property.
  */
@@ -2485,11 +2484,11 @@ find_compatible_devices(const char *type, const char *compat)
                        prevp = &np->next;
                }
        }
-       *prevp = 0;
+       *prevp = NULL;
        return head;
 }
 
-/*
+/**
  * Find the device_node with a given full_name.
  */
 struct device_node *
@@ -2904,9 +2903,9 @@ static int of_finish_dynamic_node(struct device_node *node)
        u32 *regs;
        int err = 0;
        phandle *ibm_phandle;
-       node->name = get_property(node, "name", 0);
-       node->type = get_property(node, "device_type", 0);
+
+       node->name = get_property(node, "name", NULL);
+       node->type = get_property(node, "device_type", NULL);
 
        if (!parent) {
                err = -ENODEV;
@@ -2952,32 +2951,31 @@ static int of_finish_dynamic_node(struct device_node *node)
        }
 
        /* now do the work of finish_node_interrupts */
-       if (get_property(node, "interrupts", 0)) {
+       if (get_property(node, "interrupts", NULL)) {
                err = of_finish_dynamic_node_interrupts(node);
                if (err) goto out;
        }
 
-       /* now do the rough equivalent of update_dn_pci_info, this
-        * probably is not correct for phb's, but should work for
-       * IOAs and slots.
-        */
+       /* now do the rough equivalent of update_dn_pci_info, this
+        * probably is not correct for phb's, but should work for
+        * IOAs and slots.
+        */
 
-       node->phb = parent->phb;
+       node->phb = parent->phb;
 
-       regs = (u32 *)get_property(node, "reg", 0);
-       if (regs) {
-               node->busno = (regs[0] >> 16) & 0xff;
-               node->devfn = (regs[0] >> 8) & 0xff;
-       }
+       regs = (u32 *)get_property(node, "reg", NULL);
+       if (regs) {
+               node->busno = (regs[0] >> 16) & 0xff;
+               node->devfn = (regs[0] >> 8) & 0xff;
+       }
 
        /* fixing up iommu_table */
 
-       if(strcmp(node->name, "pci") == 0 &&
-                get_property(node, "ibm,dma-window", NULL)) {
-                node->bussubno = node->busno;
-                iommu_devnode_init(node);
-        }
-       else
+       if (strcmp(node->name, "pci") == 0 &&
+           get_property(node, "ibm,dma-window", NULL)) {
+               node->bussubno = node->busno;
+               iommu_devnode_init(node);
+       } else
                node->iommu_table = parent->iommu_table;
 
 out:
@@ -3097,7 +3095,7 @@ get_property(struct device_node *np, const char *name, int *lenp)
                                *lenp = pp->length;
                        return pp->value;
                }
-       return 0;
+       return NULL;
 }
 
 /*
index 3484e48..e0ab44d 100644 (file)
@@ -404,7 +404,9 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
                break;
        }
 
-
+       case PTRACE_GETEVENTMSG:
+                ret = put_user(child->ptrace_message, (unsigned int __user *) data);
+                break;
 
        default:
                ret = ptrace_request(child, request, addr, data);
index 9ed9ab0..595ae6e 100644 (file)
 #include <asm/rtas.h>
 #include <asm/ppcdebug.h>
 
+static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
+static spinlock_t ras_log_buf_lock = SPIN_LOCK_UNLOCKED;
+
+static int ras_get_sensor_state_token;
+static int ras_check_exception_token;
+
+#define EPOW_SENSOR_TOKEN      9
+#define EPOW_SENSOR_INDEX      0
+#define RAS_VECTOR_OFFSET      0x500
+
 static irqreturn_t ras_epow_interrupt(int irq, void *dev_id,
                                        struct pt_regs * regs);
 static irqreturn_t ras_error_interrupt(int irq, void *dev_id,
@@ -59,6 +69,35 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id,
 
 /* #define DEBUG */
 
+static void request_ras_irqs(struct device_node *np, char *propname,
+                       irqreturn_t (*handler)(int, void *, struct pt_regs *),
+                       const char *name)
+{
+       unsigned int *ireg, len, i;
+       int virq, n_intr;
+
+       ireg = (unsigned int *)get_property(np, propname, &len);
+       if (ireg == NULL)
+               return;
+       n_intr = prom_n_intr_cells(np);
+       len /= n_intr * sizeof(*ireg);
+
+       for (i = 0; i < len; i++) {
+               virq = virt_irq_create_mapping(*ireg);
+               if (virq == NO_IRQ) {
+                       printk(KERN_ERR "Unable to allocate interrupt "
+                              "number for %s\n", np->full_name);
+                       return;
+               }
+               if (request_irq(irq_offset_up(virq), handler, 0, name, NULL)) {
+                       printk(KERN_ERR "Unable to request interrupt %d for "
+                              "%s\n", irq_offset_up(virq), np->full_name);
+                       return;
+               }
+               ireg += n_intr;
+       }
+}
+
 /*
  * Initialize handlers for the set of interrupts caused by hardware errors
  * and power system events.
@@ -66,52 +105,34 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id,
 static int __init init_ras_IRQ(void)
 {
        struct device_node *np;
-       unsigned int *ireg, len, i;
-       int virq;
-
-       if ((np = of_find_node_by_path("/event-sources/internal-errors")) &&
-           (ireg = (unsigned int *)get_property(np, "open-pic-interrupt",
-                                                &len))) {
-               for (i=0; i<(len / sizeof(*ireg)); i++) {
-                       virq = virt_irq_create_mapping(*(ireg));
-                       if (virq == NO_IRQ) {
-                               printk(KERN_ERR "Unable to allocate interrupt "
-                                      "number for %s\n", np->full_name);
-                               break;
-                       }
-                       request_irq(irq_offset_up(virq),
-                                   ras_error_interrupt, 0, 
-                                   "RAS_ERROR", NULL);
-                       ireg++;
-               }
+
+       ras_get_sensor_state_token = rtas_token("get-sensor-state");
+       ras_check_exception_token = rtas_token("check-exception");
+
+       /* Internal Errors */
+       np = of_find_node_by_path("/event-sources/internal-errors");
+       if (np != NULL) {
+               request_ras_irqs(np, "open-pic-interrupt", ras_error_interrupt,
+                                "RAS_ERROR");
+               request_ras_irqs(np, "interrupts", ras_error_interrupt,
+                                "RAS_ERROR");
+               of_node_put(np);
        }
-       of_node_put(np);
-
-       if ((np = of_find_node_by_path("/event-sources/epow-events")) &&
-           (ireg = (unsigned int *)get_property(np, "open-pic-interrupt",
-                                                &len))) {
-               for (i=0; i<(len / sizeof(*ireg)); i++) {
-                       virq = virt_irq_create_mapping(*(ireg));
-                       if (virq == NO_IRQ) {
-                               printk(KERN_ERR "Unable to allocate interrupt "
-                                      " number for %s\n", np->full_name);
-                               break;
-                       }
-                       request_irq(irq_offset_up(virq),
-                                   ras_epow_interrupt, 0, 
-                                   "RAS_EPOW", NULL);
-                       ireg++;
-               }
+
+       /* EPOW Events */
+       np = of_find_node_by_path("/event-sources/epow-events");
+       if (np != NULL) {
+               request_ras_irqs(np, "open-pic-interrupt", ras_epow_interrupt,
+                                "RAS_EPOW");
+               request_ras_irqs(np, "interrupts", ras_epow_interrupt,
+                                "RAS_EPOW");
+               of_node_put(np);
        }
-       of_node_put(np);
 
        return 1;
 }
 __initcall(init_ras_IRQ);
 
-static struct rtas_error_log log_buf;
-static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
-
 /*
  * Handle power subsystem events (EPOW).
  *
@@ -122,30 +143,35 @@ static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
 static irqreturn_t
 ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-       struct rtas_error_log log_entry;
-       unsigned int size = sizeof(log_entry);
        int status = 0xdeadbeef;
+       int state = 0;
+       int critical;
 
-       spin_lock(&log_lock);
+       status = rtas_call(ras_get_sensor_state_token, 2, 2, &state,
+                          EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX);
 
-       status = rtas_call(rtas_token("check-exception"), 6, 1, NULL, 
-                          0x500, irq, 
-                          RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, 
-                          1,  /* Time Critical */
-                          __pa(&log_buf), size);
+       if (state > 3)
+               critical = 1;  /* Time Critical */
+       else
+               critical = 0;
 
-       log_entry = log_buf;
+       spin_lock(&ras_log_buf_lock);
 
-       spin_unlock(&log_lock);
+       status = rtas_call(ras_check_exception_token, 6, 1, NULL,
+                          RAS_VECTOR_OFFSET,
+                          virt_irq_to_real(irq_offset_down(irq)),
+                          RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
+                          critical, __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX);
 
-       udbg_printf("EPOW <0x%lx 0x%x>\n",
-                   *((unsigned long *)&log_entry), status); 
-       printk(KERN_WARNING 
-               "EPOW <0x%lx 0x%x>\n",*((unsigned long *)&log_entry), status);
+       udbg_printf("EPOW <0x%lx 0x%x 0x%x>\n",
+                   *((unsigned long *)&ras_log_buf), status, state);
+       printk(KERN_WARNING "EPOW <0x%lx 0x%x 0x%x>\n",
+              *((unsigned long *)&ras_log_buf), status, state);
 
        /* format and print the extended information */
-       log_error((char *)&log_entry, ERR_TYPE_RTAS_LOG, 0);
-       
+       log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0);
+
+       spin_unlock(&ras_log_buf_lock);
        return IRQ_HANDLED;
 }
 
@@ -160,37 +186,33 @@ ras_epow_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 static irqreturn_t
 ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 {
-       struct rtas_error_log log_entry;
-       unsigned int size = sizeof(log_entry);
+       struct rtas_error_log *rtas_elog;
        int status = 0xdeadbeef;
        int fatal;
 
-       spin_lock(&log_lock);
+       spin_lock(&ras_log_buf_lock);
 
-       status = rtas_call(rtas_token("check-exception"), 6, 1, NULL, 
-                          0x500, irq, 
-                          RTAS_INTERNAL_ERROR, 
-                          1, /* Time Critical */
-                          __pa(&log_buf), size);
+       status = rtas_call(ras_check_exception_token, 6, 1, NULL,
+                          RAS_VECTOR_OFFSET,
+                          virt_irq_to_real(irq_offset_down(irq)),
+                          RTAS_INTERNAL_ERROR, 1 /*Time Critical */,
+                          __pa(&ras_log_buf), RTAS_ERROR_LOG_MAX);
 
-       log_entry = log_buf;
+       rtas_elog = (struct rtas_error_log *)ras_log_buf;
 
-       spin_unlock(&log_lock);
-
-       if ((status == 0) && (log_entry.severity >= SEVERITY_ERROR_SYNC)) 
+       if ((status == 0) && (rtas_elog->severity >= SEVERITY_ERROR_SYNC))
                fatal = 1;
        else
                fatal = 0;
 
        /* format and print the extended information */
-       log_error((char *)&log_entry, ERR_TYPE_RTAS_LOG, fatal); 
+       log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, fatal);
 
        if (fatal) {
-               udbg_printf("HW Error <0x%lx 0x%x>\n",
-                           *((unsigned long *)&log_entry), status);
-               printk(KERN_EMERG 
-                      "Error: Fatal hardware error <0x%lx 0x%x>\n",
-                      *((unsigned long *)&log_entry), status);
+               udbg_printf("Fatal HW Error <0x%lx 0x%x>\n",
+                           *((unsigned long *)&ras_log_buf), status);
+               printk(KERN_EMERG "Error: Fatal hardware error <0x%lx 0x%x>\n",
+                      *((unsigned long *)&ras_log_buf), status);
 
 #ifndef DEBUG
                /* Don't actually power off when debugging so we can test
@@ -201,10 +223,12 @@ ras_error_interrupt(int irq, void *dev_id, struct pt_regs * regs)
 #endif
        } else {
                udbg_printf("Recoverable HW Error <0x%lx 0x%x>\n",
-                           *((unsigned long *)&log_entry), status); 
-               printk(KERN_WARNING 
+                           *((unsigned long *)&ras_log_buf), status);
+               printk(KERN_WARNING
                       "Warning: Recoverable hardware error <0x%lx 0x%x>\n",
-                      *((unsigned long *)&log_entry), status);
+                      *((unsigned long *)&ras_log_buf), status);
        }
+
+       spin_unlock(&ras_log_buf_lock);
        return IRQ_HANDLED;
 }
index b7d1c94..a055759 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/time.h>
 #include <linux/string.h>
 #include <linux/init.h>
+#include <linux/seq_file.h>
 
 #include <asm/uaccess.h>
 #include <asm/bitops.h>
@@ -137,66 +138,122 @@ struct rtas_sensors {
 
 /* ****************************************************************** */
 /* Declarations */
-static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
-               int count, int *eof, void *data);
-static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, 
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_clock_write(struct file * file, const char * buf, 
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_progress_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_poweron_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-
-static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos);
-static ssize_t ppc_rtas_rmo_buf_read(struct file *file, char *buf,
-                                   size_t count, loff_t *ppos);
+static int ppc_rtas_sensors_show(struct seq_file *m, void *v);
+static int ppc_rtas_clock_show(struct seq_file *m, void *v);
+static ssize_t ppc_rtas_clock_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos);
+static int ppc_rtas_progress_show(struct seq_file *m, void *v);
+static ssize_t ppc_rtas_progress_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos);
+static int ppc_rtas_poweron_show(struct seq_file *m, void *v);
+static ssize_t ppc_rtas_poweron_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos);
+
+static ssize_t ppc_rtas_tone_freq_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos);
+static int ppc_rtas_tone_freq_show(struct seq_file *m, void *v);
+static ssize_t ppc_rtas_tone_volume_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos);
+static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v);
+static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v);
+
+static int sensors_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_sensors_show, NULL);
+}
+
+struct file_operations ppc_rtas_sensors_operations = {
+       .open           = sensors_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
+
+static int poweron_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_poweron_show, NULL);
+}
 
 struct file_operations ppc_rtas_poweron_operations = {
-       .read =         ppc_rtas_poweron_read,
-       .write =        ppc_rtas_poweron_write
+       .open           = poweron_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .write          = ppc_rtas_poweron_write,
+       .release        = single_release,
 };
+
+static int progress_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_progress_show, NULL);
+}
+
 struct file_operations ppc_rtas_progress_operations = {
-       .read =         ppc_rtas_progress_read,
-       .write =        ppc_rtas_progress_write
+       .open           = progress_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .write          = ppc_rtas_progress_write,
+       .release        = single_release,
 };
 
+static int clock_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_clock_show, NULL);
+}
+
 struct file_operations ppc_rtas_clock_operations = {
-       .read =         ppc_rtas_clock_read,
-       .write =        ppc_rtas_clock_write
+       .open           = clock_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .write          = ppc_rtas_clock_write,
+       .release        = single_release,
 };
 
+static int tone_freq_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_tone_freq_show, NULL);
+}
+
 struct file_operations ppc_rtas_tone_freq_operations = {
-       .read =         ppc_rtas_tone_freq_read,
-       .write =        ppc_rtas_tone_freq_write
+       .open           = tone_freq_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .write          = ppc_rtas_tone_freq_write,
+       .release        = single_release,
 };
+
+static int tone_volume_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_tone_volume_show, NULL);
+}
+
 struct file_operations ppc_rtas_tone_volume_operations = {
-       .read =         ppc_rtas_tone_volume_read,
-       .write =        ppc_rtas_tone_volume_write
+       .open           = tone_volume_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .write          = ppc_rtas_tone_volume_write,
+       .release        = single_release,
 };
 
-static struct file_operations ppc_rtas_rmo_buf_ops = {
-       .read =         ppc_rtas_rmo_buf_read,
+static int rmo_buf_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, ppc_rtas_rmo_buf_show, NULL);
+}
+
+struct file_operations ppc_rtas_rmo_buf_ops = {
+       .open           = rmo_buf_open,
+       .read           = seq_read,
+       .llseek         = seq_lseek,
+       .release        = single_release,
 };
 
-int ppc_rtas_find_all_sensors (void);
-int ppc_rtas_process_sensor(struct individual_sensor s, int state, 
-               int error, char * buf);
-char * ppc_rtas_process_error(int error);
-int get_location_code(struct individual_sensor s, char * buf);
-int check_location_string (char *c, char * buf);
-int check_location (char *c, int idx, char * buf);
+static int ppc_rtas_find_all_sensors(void);
+static void ppc_rtas_process_sensor(struct seq_file *m,
+       struct individual_sensor *s, int state, int error, char *loc);
+static char *ppc_rtas_process_error(int error);
+static void get_location_code(struct seq_file *m,
+       struct individual_sensor *s, char *loc);
+static void check_location_string(struct seq_file *m, char *c);
+static void check_location(struct seq_file *m, char *c);
 
 static int __init proc_rtas_init(void)
 {
@@ -221,8 +278,9 @@ static int __init proc_rtas_init(void)
        if (entry)
                entry->proc_fops = &ppc_rtas_poweron_operations;
 
-       create_proc_read_entry("ppc64/rtas/sensors", S_IRUGO, NULL,
-                              ppc_rtas_sensor_read, NULL);
+       entry = create_proc_entry("ppc64/rtas/sensors", S_IRUGO, NULL);
+       if (entry)
+               entry->proc_fops = &ppc_rtas_sensors_operations;
 
        entry = create_proc_entry("ppc64/rtas/frequency", S_IWUSR|S_IRUGO,
                                  NULL);
@@ -242,28 +300,38 @@ static int __init proc_rtas_init(void)
 
 __initcall(proc_rtas_init);
 
+static int parse_number(const char __user *p, size_t count, unsigned long *val)
+{
+       char buf[40];
+       char *end;
+
+       if (count > 39)
+               return -EINVAL;
+
+       if (copy_from_user(buf, p, count))
+               return -EFAULT;
+
+       buf[count] = 0;
+
+       *val = simple_strtoul(buf, &end, 10);
+       if (*end && *end != '\n')
+               return -EINVAL;
+
+       return 0;
+}
+
 /* ****************************************************************** */
 /* POWER-ON-TIME                                                      */
 /* ****************************************************************** */
-static ssize_t ppc_rtas_poweron_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
+static ssize_t ppc_rtas_poweron_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos)
 {
-       char stkbuf[40];  /* its small, its on stack */
        struct rtc_time tm;
        unsigned long nowtime;
-       char *dest;
-       int error;
+       int error = parse_number(buf, count, &nowtime);
+       if (error)
+               return error;
 
-       if (39 < count) count = 39;
-       if (copy_from_user (stkbuf, buf, count)) {
-               return -EFAULT;
-       }
-       stkbuf[count] = 0;
-       nowtime = simple_strtoul(stkbuf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_poweron_write: Invalid time\n");
-               return count;
-       }
        power_on_time = nowtime; /* save the time */
 
        to_tm(nowtime, &tm);
@@ -271,46 +339,32 @@ static ssize_t ppc_rtas_poweron_write(struct file * file, const char * buf,
        error = rtas_call(rtas_token("set-time-for-power-on"), 7, 1, NULL, 
                        tm.tm_year, tm.tm_mon, tm.tm_mday, 
                        tm.tm_hour, tm.tm_min, tm.tm_sec, 0 /* nano */);
-       if (error != 0)
+       if (error)
                printk(KERN_WARNING "error: setting poweron time returned: %s\n", 
                                ppc_rtas_process_error(error));
        return count;
 }
 /* ****************************************************************** */
-static ssize_t ppc_rtas_poweron_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
+static int ppc_rtas_poweron_show(struct seq_file *m, void *v)
 {
-       char stkbuf[40];  /* its small, its on stack */
-       int n, sn;
        if (power_on_time == 0)
-               n = scnprintf(stkbuf,sizeof(stkbuf),"Power on time not set\n");
+               seq_printf(m, "Power on time not set\n");
        else
-               n = scnprintf(stkbuf,sizeof(stkbuf),"%lu\n",power_on_time);
-
-       sn = strlen (stkbuf) +1;
-       if (*ppos >= sn)
-               return 0;
-       if (n > sn - *ppos)
-               n = sn - *ppos;
-       if (n > count)
-               n = count;
-       if (copy_to_user (buf, stkbuf + (*ppos), n)) {
-               return -EFAULT;
-       }
-       *ppos += n;
-       return n;
+               seq_printf(m, "%lu\n",power_on_time);
+       return 0;
 }
 
 /* ****************************************************************** */
 /* PROGRESS                                                           */
 /* ****************************************************************** */
-static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
+static ssize_t ppc_rtas_progress_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos)
 {
        unsigned long hex;
 
-       if (count >= MAX_LINELENGTH) count = MAX_LINELENGTH -1;
-       if (copy_from_user (progress_led, buf, count)) { /* save the string */
+       if (count >= MAX_LINELENGTH)
+               count = MAX_LINELENGTH -1;
+       if (copy_from_user(progress_led, buf, count)) { /* save the string */
                return -EFAULT;
        }
        progress_led[count] = 0;
@@ -321,180 +375,106 @@ static ssize_t ppc_rtas_progress_write(struct file * file, const char * buf,
        ppc_md.progress ((char *)progress_led, hex);
        return count;
 
-       /* clear the line */ /* ppc_md.progress("                   ", 0xffff);*/
+       /* clear the line */
+       /* ppc_md.progress("                   ", 0xffff);*/
 }
 /* ****************************************************************** */
-static ssize_t ppc_rtas_progress_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
+static int ppc_rtas_progress_show(struct seq_file *m, void *v)
 {
-       int sn, n = 0;
-       char *tmpbuf;
-
-       if (progress_led == NULL) return 0;
-
-       tmpbuf = kmalloc (MAX_LINELENGTH, GFP_KERNEL);
-       if (!tmpbuf) {
-               printk(KERN_ERR "error: kmalloc failed\n");
-               return -ENOMEM;
-       }
-       n = sprintf (tmpbuf, "%s\n", progress_led);
-
-       sn = strlen (tmpbuf) +1;
-       if (*ppos >= sn) {
-               kfree (tmpbuf);
-               return 0;
-       }
-       if (n > sn - *ppos)
-               n = sn - *ppos;
-       if (n > count)
-               n = count;
-       if (copy_to_user (buf, tmpbuf + (*ppos), n)) {
-               kfree (tmpbuf);
-               return -EFAULT;
-       }
-       kfree (tmpbuf);
-       *ppos += n;
-       return n;
+       if (progress_led)
+               seq_printf(m, "%s\n", progress_led);
+       return 0;
 }
 
 /* ****************************************************************** */
 /* CLOCK                                                              */
 /* ****************************************************************** */
-static ssize_t ppc_rtas_clock_write(struct file * file, const char * buf, 
-               size_t count, loff_t *ppos)
+static ssize_t ppc_rtas_clock_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos)
 {
-       char stkbuf[40];  /* its small, its on stack */
        struct rtc_time tm;
        unsigned long nowtime;
-       char *dest;
-       int error;
-
-       if (39 < count) count = 39;
-       if (copy_from_user (stkbuf, buf, count)) {
-               return -EFAULT;
-       }
-       stkbuf[count] = 0;
-       nowtime = simple_strtoul(stkbuf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_clock_write: Invalid time\n");
-               return count;
-       }
+       int error = parse_number(buf, count, &nowtime);
+       if (error)
+               return error;
 
        to_tm(nowtime, &tm);
        error = rtas_call(rtas_token("set-time-of-day"), 7, 1, NULL, 
                        tm.tm_year, tm.tm_mon, tm.tm_mday, 
                        tm.tm_hour, tm.tm_min, tm.tm_sec, 0);
-       if (error != 0)
+       if (error)
                printk(KERN_WARNING "error: setting the clock returned: %s\n", 
                                ppc_rtas_process_error(error));
        return count;
 }
 /* ****************************************************************** */
-static ssize_t ppc_rtas_clock_read(struct file * file, char * buf, 
-               size_t count, loff_t *ppos)
+static int ppc_rtas_clock_show(struct seq_file *m, void *v)
 {
-       unsigned int year, mon, day, hour, min, sec;
        int ret[8];
-       int n, sn, error;
-       char stkbuf[40];  /* its small, its on stack */
+       int error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
 
-       error = rtas_call(rtas_token("get-time-of-day"), 0, 8, ret);
-       
-       year = ret[0]; mon  = ret[1]; day  = ret[2];
-       hour = ret[3]; min  = ret[4]; sec  = ret[5];
-
-       if (error != 0){
+       if (error) {
                printk(KERN_WARNING "error: reading the clock returned: %s\n", 
                                ppc_rtas_process_error(error));
-               n = scnprintf (stkbuf, sizeof(stkbuf), "0");
+               seq_printf(m, "0");
        } else { 
-               n = scnprintf (stkbuf, sizeof(stkbuf), "%lu\n",
+               unsigned int year, mon, day, hour, min, sec;
+               year = ret[0]; mon  = ret[1]; day  = ret[2];
+               hour = ret[3]; min  = ret[4]; sec  = ret[5];
+               seq_printf(m, "%lu\n",
                                mktime(year, mon, day, hour, min, sec));
        }
-
-       sn = strlen (stkbuf) +1;
-       if (*ppos >= sn)
-               return 0;
-       if (n > sn - *ppos)
-               n = sn - *ppos;
-       if (n > count)
-               n = count;
-       if (copy_to_user (buf, stkbuf + (*ppos), n)) {
-               return -EFAULT;
-       }
-       *ppos += n;
-       return n;
+       return 0;
 }
 
 /* ****************************************************************** */
 /* SENSOR STUFF                                                       */
 /* ****************************************************************** */
-static int ppc_rtas_sensor_read(char * buf, char ** start, off_t off,
-               int count, int *eof, void *data)
+static int ppc_rtas_sensors_show(struct seq_file *m, void *v)
 {
-       int i,j,n;
+       int i,j;
        int state, error;
-       char *buffer;
        int get_sensor_state = rtas_token("get-sensor-state");
 
-       if (count < 0)
-               return -EINVAL;
-
-       /* May not be enough */
-       buffer = kmalloc(MAX_LINELENGTH*MAX_SENSORS, GFP_KERNEL);
-
-       if (!buffer)
-               return -ENOMEM;
-
-       memset(buffer, 0, MAX_LINELENGTH*MAX_SENSORS);
-
-       n  = sprintf ( buffer  , "RTAS (RunTime Abstraction Services) Sensor Information\n");
-       n += sprintf ( buffer+n, "Sensor\t\tValue\t\tCondition\tLocation\n");
-       n += sprintf ( buffer+n, "********************************************************\n");
+       seq_printf(m, "RTAS (RunTime Abstraction Services) Sensor Information\n");
+       seq_printf(m, "Sensor\t\tValue\t\tCondition\tLocation\n");
+       seq_printf(m, "********************************************************\n");
 
        if (ppc_rtas_find_all_sensors() != 0) {
-               n += sprintf ( buffer+n, "\nNo sensors are available\n");
-               goto return_string;
+               seq_printf(m, "\nNo sensors are available\n");
+               return 0;
        }
 
        for (i=0; i<sensors.quant; i++) {
-               j = sensors.sensor[i].quant;
-               /* A sensor may have multiple instances */
-               while (j >= 0) {
+               struct individual_sensor *p = &sensors.sensor[i];
+               char rstr[64];
+               char *loc;
+               int llen, offs;
+
+               sprintf (rstr, SENSOR_PREFIX"%04d", p->token);
+               loc = (char *) get_property(rtas_node, rstr, &llen);
 
+               /* A sensor may have multiple instances */
+               for (j = 0, offs = 0; j <= p->quant; j++) {
                        error = rtas_call(get_sensor_state, 2, 2, &state, 
-                                         sensors.sensor[i].token, 
-                                         sensors.sensor[i].quant - j);
-
-                       n += ppc_rtas_process_sensor(sensors.sensor[i], state, 
-                                                    error, buffer+n );
-                       n += sprintf (buffer+n, "\n");
-                       j--;
-               } /* while */
-       } /* for */
-
-return_string:
-       if (off >= strlen(buffer)) {
-               *eof = 1;
-               kfree(buffer);
-               return 0;
+                                         p->token, j);
+
+                       ppc_rtas_process_sensor(m, p, state, error, loc);
+                       seq_putc(m, '\n');
+                       if (loc) {
+                               offs += strlen(loc) + 1;
+                               loc += strlen(loc) + 1;
+                               if (offs >= llen)
+                                       loc = NULL;
+                       }
+               }
        }
-       if (n > strlen(buffer) - off)
-               n = strlen(buffer) - off;
-       if (n > count)
-               n = count;
-       else
-               *eof = 1;
-
-       memcpy(buf, buffer + off, n);
-       *start = buf;
-       kfree(buffer);
-       return n;
+       return 0;
 }
 
 /* ****************************************************************** */
 
-int ppc_rtas_find_all_sensors (void)
+static int ppc_rtas_find_all_sensors(void)
 {
        unsigned int *utmp;
        int len, i;
@@ -518,7 +498,7 @@ int ppc_rtas_find_all_sensors (void)
 /*
  * Builds a string of what rtas returned
  */
-char * ppc_rtas_process_error(int error)
+static char *ppc_rtas_process_error(int error)
 {
        switch (error) {
                case SENSOR_CRITICAL_HIGH:
@@ -551,8 +531,8 @@ char * ppc_rtas_process_error(int error)
  * Builds a string out of what the sensor said
  */
 
-int ppc_rtas_process_sensor(struct individual_sensor s, int state, 
-               int error, char * buf) 
+static void ppc_rtas_process_sensor(struct seq_file *m,
+       struct individual_sensor *s, int state, int error, char *loc)
 {
        /* Defined return vales */
        const char * key_switch[]        = { "Off\t", "Normal\t", "Secure\t", 
@@ -578,174 +558,170 @@ int ppc_rtas_process_sensor(struct individual_sensor s, int state,
        int num_states = 0;
        int temperature = 0;
        int unknown = 0;
-       int n = 0;
 
        /* What kind of sensor do we have here? */
        
-       switch (s.token) {
+       switch (s->token) {
                case KEY_SWITCH:
-                       n += sprintf(buf+n, "Key switch:\t");
+                       seq_printf(m, "Key switch:\t");
                        num_states = sizeof(key_switch) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", key_switch[state]);
+                               seq_printf(m, "%s\t", key_switch[state]);
                                have_strings = 1;
                        }
                        break;
                case ENCLOSURE_SWITCH:
-                       n += sprintf(buf+n, "Enclosure switch:\t");
+                       seq_printf(m, "Enclosure switch:\t");
                        num_states = sizeof(enclosure_switch) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                enclosure_switch[state]);
                                have_strings = 1;
                        }
                        break;
                case THERMAL_SENSOR:
-                       n += sprintf(buf+n, "Temp. (°C/°F):\t");
+                       seq_printf(m, "Temp. (°C/°F):\t");
                        temperature = 1;
                        break;
                case LID_STATUS:
-                       n += sprintf(buf+n, "Lid status:\t");
+                       seq_printf(m, "Lid status:\t");
                        num_states = sizeof(lid_status) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", lid_status[state]);
+                               seq_printf(m, "%s\t", lid_status[state]);
                                have_strings = 1;
                        }
                        break;
                case POWER_SOURCE:
-                       n += sprintf(buf+n, "Power source:\t");
+                       seq_printf(m, "Power source:\t");
                        num_states = sizeof(power_source) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                power_source[state]);
                                have_strings = 1;
                        }
                        break;
                case BATTERY_VOLTAGE:
-                       n += sprintf(buf+n, "Battery voltage:\t");
+                       seq_printf(m, "Battery voltage:\t");
                        break;
                case BATTERY_REMAINING:
-                       n += sprintf(buf+n, "Battery remaining:\t");
+                       seq_printf(m, "Battery remaining:\t");
                        num_states = sizeof(battery_remaining) / sizeof(char *);
                        if (state < num_states)
                        {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                battery_remaining[state]);
                                have_strings = 1;
                        }
                        break;
                case BATTERY_PERCENTAGE:
-                       n += sprintf(buf+n, "Battery percentage:\t");
+                       seq_printf(m, "Battery percentage:\t");
                        break;
                case EPOW_SENSOR:
-                       n += sprintf(buf+n, "EPOW Sensor:\t");
+                       seq_printf(m, "EPOW Sensor:\t");
                        num_states = sizeof(epow_sensor) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", epow_sensor[state]);
+                               seq_printf(m, "%s\t", epow_sensor[state]);
                                have_strings = 1;
                        }
                        break;
                case BATTERY_CYCLESTATE:
-                       n += sprintf(buf+n, "Battery cyclestate:\t");
+                       seq_printf(m, "Battery cyclestate:\t");
                        num_states = sizeof(battery_cyclestate) / 
                                        sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                battery_cyclestate[state]);
                                have_strings = 1;
                        }
                        break;
                case BATTERY_CHARGING:
-                       n += sprintf(buf+n, "Battery Charging:\t");
+                       seq_printf(m, "Battery Charging:\t");
                        num_states = sizeof(battery_charging) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                battery_charging[state]);
                                have_strings = 1;
                        }
                        break;
                case IBM_SURVEILLANCE:
-                       n += sprintf(buf+n, "Surveillance:\t");
+                       seq_printf(m, "Surveillance:\t");
                        break;
                case IBM_FANRPM:
-                       n += sprintf(buf+n, "Fan (rpm):\t");
+                       seq_printf(m, "Fan (rpm):\t");
                        break;
                case IBM_VOLTAGE:
-                       n += sprintf(buf+n, "Voltage (mv):\t");
+                       seq_printf(m, "Voltage (mv):\t");
                        break;
                case IBM_DRCONNECTOR:
-                       n += sprintf(buf+n, "DR connector:\t");
+                       seq_printf(m, "DR connector:\t");
                        num_states = sizeof(ibm_drconnector) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                ibm_drconnector[state]);
                                have_strings = 1;
                        }
                        break;
                case IBM_POWERSUPPLY:
-                       n += sprintf(buf+n, "Powersupply:\t");
+                       seq_printf(m, "Powersupply:\t");
                        break;
                case IBM_INTQUEUE:
-                       n += sprintf(buf+n, "Interrupt queue:\t");
+                       seq_printf(m, "Interrupt queue:\t");
                        num_states = sizeof(ibm_intqueue) / sizeof(char *);
                        if (state < num_states) {
-                               n += sprintf(buf+n, "%s\t", 
+                               seq_printf(m, "%s\t", 
                                                ibm_intqueue[state]);
                                have_strings = 1;
                        }
                        break;
                default:
-                       n += sprintf(buf+n,  "Unknown sensor (type %d), ignoring it\n",
-                                       s.token);
+                       seq_printf(m,  "Unknown sensor (type %d), ignoring it\n",
+                                       s->token);
                        unknown = 1;
                        have_strings = 1;
                        break;
        }
        if (have_strings == 0) {
                if (temperature) {
-                       n += sprintf(buf+n, "%4d /%4d\t", state, cel_to_fahr(state));
+                       seq_printf(m, "%4d /%4d\t", state, cel_to_fahr(state));
                } else
-                       n += sprintf(buf+n, "%10d\t", state);
+                       seq_printf(m, "%10d\t", state);
        }
        if (unknown == 0) {
-               n += sprintf ( buf+n, "%s\t", ppc_rtas_process_error(error));
-               n += get_location_code(s, buf+n);
+               seq_printf(m, "%s\t", ppc_rtas_process_error(error));
+               get_location_code(m, s, loc);
        }
-       return n;
 }
 
 /* ****************************************************************** */
 
-int check_location (char *c, int idx, char * buf)
+static void check_location(struct seq_file *m, char *c)
 {
-       int n = 0;
-
-       switch (*(c+idx)) {
+       switch (c[0]) {
                case LOC_PLANAR:
-                       n += sprintf ( buf, "Planar #%c", *(c+idx+1));
+                       seq_printf(m, "Planar #%c", c[1]);
                        break;
                case LOC_CPU:
-                       n += sprintf ( buf, "CPU #%c", *(c+idx+1));
+                       seq_printf(m, "CPU #%c", c[1]);
                        break;
                case LOC_FAN:
-                       n += sprintf ( buf, "Fan #%c", *(c+idx+1));
+                       seq_printf(m, "Fan #%c", c[1]);
                        break;
                case LOC_RACKMOUNTED:
-                       n += sprintf ( buf, "Rack #%c", *(c+idx+1));
+                       seq_printf(m, "Rack #%c", c[1]);
                        break;
                case LOC_VOLTAGE:
-                       n += sprintf ( buf, "Voltage #%c", *(c+idx+1));
+                       seq_printf(m, "Voltage #%c", c[1]);
                        break;
                case LOC_LCD:
-                       n += sprintf ( buf, "LCD #%c", *(c+idx+1));
+                       seq_printf(m, "LCD #%c", c[1]);
                        break;
                case '.':
-                       n += sprintf ( buf, "- %c", *(c+idx+1));
+                       seq_printf(m, "- %c", c[1]);
+                       break;
                default:
-                       n += sprintf ( buf, "Unknown location");
+                       seq_printf(m, "Unknown location");
                        break;
        }
-       return n;
 }
 
 
@@ -755,199 +731,88 @@ int check_location (char *c, int idx, char * buf)
  * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ]
  * the '.' may be an abbrevation
  */
-int check_location_string (char *c, char *buf)
+static void check_location_string(struct seq_file *m, char *c)
 {
-       int n=0,i=0;
-
-       while (c[i]) {
-               if (isalpha(c[i]) || c[i] == '.') {
-                        n += check_location(c, i, buf+n);
-               }
-               else if (c[i] == '/' || c[i] == '-')
-                       n += sprintf(buf+n, " at ");
-               i++;
+       while (*c) {
+               if (isalpha(*c) || *c == '.')
+                       check_location(m, c);
+               else if (*c == '/' || *c == '-')
+                       seq_printf(m, " at ");
+               c++;
        }
-       return n;
 }
 
 
 /* ****************************************************************** */
 
-int get_location_code(struct individual_sensor s, char * buffer)
+static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc)
 {
-       char rstr[512], tmp[10], tmp2[10];
-       int n=0, i=0, llen, len;
-       /* char *buf = kmalloc(MAX_LINELENGTH, GFP_KERNEL); */
-       char *ret;
-
-       static int pos = 0; /* remember position where buffer was */
-
-       /* construct the sensor number like 0003 */
-       /* fill with zeros */
-       n = sprintf(tmp, "%d", s.token);
-       len = strlen(tmp);
-       while (strlen(tmp) < 4)
-               n += sprintf (tmp+n, "0");
-       
-       /* invert the string */
-       while (tmp[i]) {
-               if (i<len)
-                       tmp2[4-len+i] = tmp[i];
-               else
-                       tmp2[3-i] = tmp[i];
-               i++;
-       }
-       tmp2[4] = '\0';
-
-       sprintf (rstr, SENSOR_PREFIX"%s", tmp2);
-
-       ret = (char *) get_property(rtas_node, rstr, &llen);
-
-       n=0;
-       if (ret == NULL || ret[0] == '\0') {
-               n += sprintf ( buffer+n, "--- ");/* does not have a location */
+       if (!loc || !*loc) {
+               seq_printf(m, "---");/* does not have a location */
        } else {
-               char t[50];
-               ret += pos;
-
-               n += check_location_string(ret, buffer + n);
-               n += sprintf ( buffer+n, " ");
-               /* see how many characters we have printed */
-               scnprintf(t, sizeof(t), "%s ", ret);
-
-               pos += strlen(t);
-               if (pos >= llen) pos=0;
+               check_location_string(m, loc);
        }
-       return n;
+       seq_putc(m, ' ');
 }
 /* ****************************************************************** */
 /* INDICATORS - Tone Frequency                                        */
 /* ****************************************************************** */
-static ssize_t ppc_rtas_tone_freq_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
+static ssize_t ppc_rtas_tone_freq_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos)
 {
-       char stkbuf[40];  /* its small, its on stack */
        unsigned long freq;
-       char *dest;
-       int error;
+       int error = parse_number(buf, count, &freq);
+       if (error)
+               return error;
 
-       if (39 < count) count = 39;
-       if (copy_from_user (stkbuf, buf, count)) {
-               return -EFAULT;
-       }
-       stkbuf[count] = 0;
-       freq = simple_strtoul(stkbuf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_tone_freq_write: Invalid tone freqency\n");
-               return count;
-       }
-       if (freq < 0) freq = 0;
        rtas_tone_frequency = freq; /* save it for later */
        error = rtas_call(rtas_token("set-indicator"), 3, 1, NULL,
                        TONE_FREQUENCY, 0, freq);
-       if (error != 0)
+       if (error)
                printk(KERN_WARNING "error: setting tone frequency returned: %s\n", 
                                ppc_rtas_process_error(error));
        return count;
 }
 /* ****************************************************************** */
-static ssize_t ppc_rtas_tone_freq_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
+static int ppc_rtas_tone_freq_show(struct seq_file *m, void *v)
 {
-       int n, sn;
-       char stkbuf[40];  /* its small, its on stack */
-
-       n = scnprintf(stkbuf, 40, "%lu\n", rtas_tone_frequency);
-
-       sn = strlen (stkbuf) +1;
-       if (*ppos >= sn)
-               return 0;
-       if (n > sn - *ppos)
-               n = sn - *ppos;
-       if (n > count)
-               n = count;
-       if (copy_to_user (buf, stkbuf + (*ppos), n)) {
-               return -EFAULT;
-       }
-       *ppos += n;
-       return n;
+       seq_printf(m, "%lu\n", rtas_tone_frequency);
+       return 0;
 }
 /* ****************************************************************** */
 /* INDICATORS - Tone Volume                                           */
 /* ****************************************************************** */
-static ssize_t ppc_rtas_tone_volume_write(struct file * file, const char * buf,
-               size_t count, loff_t *ppos)
+static ssize_t ppc_rtas_tone_volume_write(struct file *file,
+               const char __user *buf, size_t count, loff_t *ppos)
 {
-       char stkbuf[40];  /* its small, its on stack */
        unsigned long volume;
-       char *dest;
-       int error;
+       int error = parse_number(buf, count, &volume);
+       if (error)
+               return error;
 
-       if (39 < count) count = 39;
-       if (copy_from_user (stkbuf, buf, count)) {
-               return -EFAULT;
-       }
-       stkbuf[count] = 0;
-       volume = simple_strtoul(stkbuf, &dest, 10);
-       if (*dest != '\0' && *dest != '\n') {
-               printk("ppc_rtas_tone_volume_write: Invalid tone volume\n");
-               return count;
-       }
-       if (volume < 0) volume = 0;
-       if (volume > 100) volume = 100;
+       if (volume > 100)
+               volume = 100;
        
         rtas_tone_volume = volume; /* save it for later */
        error = rtas_call(rtas_token("set-indicator"), 3, 1, NULL,
                        TONE_VOLUME, 0, volume);
-       if (error != 0)
+       if (error)
                printk(KERN_WARNING "error: setting tone volume returned: %s\n", 
                                ppc_rtas_process_error(error));
        return count;
 }
 /* ****************************************************************** */
-static ssize_t ppc_rtas_tone_volume_read(struct file * file, char * buf,
-               size_t count, loff_t *ppos)
+static int ppc_rtas_tone_volume_show(struct seq_file *m, void *v)
 {
-       int n, sn;
-       char stkbuf[40];  /* its small, its on stack */
-
-       n = scnprintf(stkbuf, 40, "%lu\n", rtas_tone_volume);
-
-       sn = strlen (stkbuf) +1;
-       if (*ppos >= sn)
-               return 0;
-       if (n > sn - *ppos)
-               n = sn - *ppos;
-       if (n > count)
-               n = count;
-       if (copy_to_user (buf, stkbuf + (*ppos), n)) {
-               return -EFAULT;
-       }
-       *ppos += n;
-       return n;
+       seq_printf(m, "%lu\n", rtas_tone_volume);
+       return 0;
 }
 
 #define RMO_READ_BUF_MAX 30
 
 /* RTAS Userspace access */
-static ssize_t ppc_rtas_rmo_buf_read(struct file *file, char __user *buf,
-                                   size_t count, loff_t *ppos)
+static int ppc_rtas_rmo_buf_show(struct seq_file *m, void *v)
 {
-       char kbuf[RMO_READ_BUF_MAX];
-       int n;
-
-       n = sprintf(kbuf, "%016lx %x\n", rtas_rmo_buf, RTAS_RMOBUF_MAX);
-       if (n > count)
-               n = count;
-
-       if (ppos && *ppos != 0)
-               return 0;
-
-       if (copy_to_user(buf, kbuf, n))
-               return -EFAULT;
-
-       if (ppos)
-               *ppos = n;
-       
-       return n;
+       seq_printf(m, "%016lx %x\n", rtas_rmo_buf, RTAS_RMOBUF_MAX);
+       return 0;
 }
index f719d9c..b199fec 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/delay.h>
 #include <asm/uaccess.h>
 
-struct flash_block_list_header rtas_firmware_flash_list = {0, 0};
+struct flash_block_list_header rtas_firmware_flash_list = {0, NULL};
 
 struct rtas_t rtas = { 
        .lock = SPIN_LOCK_UNLOCKED
@@ -331,7 +331,7 @@ rtas_flash_firmware(void)
                if (f->next)
                        f->next = (struct flash_block_list *)virt_to_abs(f->next);
                else
-                       f->next = 0LL;
+                       f->next = NULL;
                /* make num_blocks into the version/length field */
                f->num_blocks = (FLASH_BLOCK_LIST_VERSION << 56) | ((f->num_blocks+1)*16);
        }
@@ -502,7 +502,7 @@ void rtas_stop_self(void)
 
        BUG_ON(rtas_args->token == RTAS_UNKNOWN_SERVICE);
 
-       printk("%u %u Ready to die...\n",
+       printk("cpu %u (hwid %u) Ready to die...\n",
               smp_processor_id(), hard_smp_processor_id());
        enter_rtas(__pa(rtas_args));
 
index aa649a2..7538cea 100644 (file)
@@ -33,7 +33,7 @@
 #define DEBUG(A...)
 #endif
 
-static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t rtasd_log_lock = SPIN_LOCK_UNLOCKED;
 
 DECLARE_WAIT_QUEUE_HEAD(rtas_log_wait);
 
@@ -152,7 +152,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
        if (buf == NULL)
                return;
 
-       spin_lock_irqsave(&log_lock, s);
+       spin_lock_irqsave(&rtasd_log_lock, s);
 
        /* get length and increase count */
        switch (err_type & ERR_TYPE_MASK) {
@@ -163,7 +163,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
                break;
        case ERR_TYPE_KERNEL_PANIC:
        default:
-               spin_unlock_irqrestore(&log_lock, s);
+               spin_unlock_irqrestore(&rtasd_log_lock, s);
                return;
        }
 
@@ -174,7 +174,7 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
        /* Check to see if we need to or have stopped logging */
        if (fatal || no_more_logging) {
                no_more_logging = 1;
-               spin_unlock_irqrestore(&log_lock, s);
+               spin_unlock_irqrestore(&rtasd_log_lock, s);
                return;
        }
 
@@ -199,12 +199,12 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
                else
                        rtas_log_start += 1;
 
-               spin_unlock_irqrestore(&log_lock, s);
+               spin_unlock_irqrestore(&rtasd_log_lock, s);
                wake_up_interruptible(&rtas_log_wait);
                break;
        case ERR_TYPE_KERNEL_PANIC:
        default:
-               spin_unlock_irqrestore(&log_lock, s);
+               spin_unlock_irqrestore(&rtasd_log_lock, s);
                return;
        }
 
@@ -247,24 +247,24 @@ static ssize_t rtas_log_read(struct file * file, char * buf,
                return -ENOMEM;
 
 
-       spin_lock_irqsave(&log_lock, s);
+       spin_lock_irqsave(&rtasd_log_lock, s);
        /* if it's 0, then we know we got the last one (the one in NVRAM) */
        if (rtas_log_size == 0 && !no_more_logging)
                nvram_clear_error_log();
-       spin_unlock_irqrestore(&log_lock, s);
+       spin_unlock_irqrestore(&rtasd_log_lock, s);
 
 
        error = wait_event_interruptible(rtas_log_wait, rtas_log_size);
        if (error)
                goto out;
 
-       spin_lock_irqsave(&log_lock, s);
+       spin_lock_irqsave(&rtasd_log_lock, s);
        offset = rtas_error_log_buffer_max * (rtas_log_start & LOG_NUMBER_MASK);
        memcpy(tmp, &rtas_log_buf[offset], count);
 
        rtas_log_start += 1;
        rtas_log_size -= 1;
-       spin_unlock_irqrestore(&log_lock, s);
+       spin_unlock_irqrestore(&rtasd_log_lock, s);
 
        error = copy_to_user(buf, tmp, count) ? -EFAULT : count;
 out:
@@ -455,7 +455,7 @@ static int __init rtas_init(void)
        else
                printk(KERN_ERR "Failed to create error_log proc entry\n");
 
-       if (kernel_thread(rtasd, 0, CLONE_FS) < 0)
+       if (kernel_thread(rtasd, NULL, CLONE_FS) < 0)
                printk(KERN_ERR "Failed to start RTAS daemon\n");
 
        return 0;
index 57a708d..7bf41f3 100644 (file)
@@ -56,9 +56,7 @@ extern int piranha_simulator;
  *     ioctls.
  */
 
-static loff_t rtc_llseek(struct file *file, loff_t offset, int origin);
-
-static ssize_t rtc_read(struct file *file, char *buf,
+static ssize_t rtc_read(struct file *file, char __user *buf,
                        size_t count, loff_t *ppos);
 
 static int rtc_ioctl(struct inode *inode, struct file *file,
@@ -81,12 +79,7 @@ static const unsigned char days_in_mo[] =
  *     Now all the various file operations that we export.
  */
 
-static loff_t rtc_llseek(struct file *file, loff_t offset, int origin)
-{
-       return -ESPIPE;
-}
-
-static ssize_t rtc_read(struct file *file, char *buf,
+static ssize_t rtc_read(struct file *file, char __user *buf,
                        size_t count, loff_t *ppos)
 {
        return -EIO;
@@ -113,7 +106,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                if (!capable(CAP_SYS_TIME))
                        return -EACCES;
 
-               if (copy_from_user(&rtc_tm, (struct rtc_time*)arg,
+               if (copy_from_user(&rtc_tm, (struct rtc_time __user *)arg,
                                   sizeof(struct rtc_time)))
                        return -EFAULT;
 
@@ -147,7 +140,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        }
        case RTC_EPOCH_READ:    /* Read the epoch.      */
        {
-               return put_user (epoch, (unsigned long *)arg);
+               return put_user (epoch, (unsigned long __user *)arg);
        }
        case RTC_EPOCH_SET:     /* Set the epoch.       */
        {
@@ -166,11 +159,12 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        default:
                return -EINVAL;
        }
-       return copy_to_user((void *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
+       return copy_to_user((void __user *)arg, &wtime, sizeof wtime) ? -EFAULT : 0;
 }
 
 static int rtc_open(struct inode *inode, struct file *file)
 {
+       nonseekable_open(inode, file);
        return 0;
 }
 
@@ -184,7 +178,7 @@ static int rtc_release(struct inode *inode, struct file *file)
  */
 static struct file_operations rtc_fops = {
        .owner =        THIS_MODULE,
-       .llseek =       rtc_llseek,
+       .llseek =       no_llseek,
        .read =         rtc_read,
        .ioctl =        rtc_ioctl,
        .open =         rtc_open,
@@ -207,7 +201,7 @@ static int __init rtc_init(void)
                return retval;
 
 #ifdef CONFIG_PROC_FS
-       if(create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL) == NULL)
+       if (create_proc_read_entry ("driver/rtc", 0, NULL, rtc_read_proc, NULL) == NULL)
                misc_deregister(&rtc_dev);
                return -ENOMEM;
 #endif
index 5875c4b..5cf39f3 100644 (file)
@@ -300,6 +300,10 @@ void __cpu_die(unsigned int cpu)
 void cpu_die(void)
 {
        local_irq_disable();
+       /* Some hardware requires clearing the CPPR, while other hardware does not
+        * it is safe either way
+        */
+       pSeriesLP_cppr_info(0, 0);
        rtas_stop_self();
        /* Should never get here... */
        BUG();
@@ -385,8 +389,6 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
 
        /* Fixup atomic count: it exited inside IRQ handler. */
        paca[lcpu].__current->thread_info->preempt_count        = 0;
-       /* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */
-       paca[lcpu].stab_next_rr = 0;
 
        /* At boot this is done in prom.c. */
        paca[lcpu].hw_cpu_id = pcpu;
@@ -422,7 +424,11 @@ static inline void look_for_more_cpus(void)
        }
 
        maxcpus = ireg[num_addr_cell + num_size_cell];
-       /* DRENG need to account for threads here too */
+
+       /* Double maxcpus for processors which have SMT capability */
+       if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+               maxcpus *= 2;
+
 
        if (maxcpus > NR_CPUS) {
                printk(KERN_WARNING
@@ -715,7 +721,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
                        printk("smp_call_function on cpu %d: other cpus not "
                               "responding (%d)\n", smp_processor_id(),
                               atomic_read(&data.started));
-                       debugger(0);
+                       debugger(NULL);
                        goto out;
                }
        }
@@ -730,7 +736,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
                                       smp_processor_id(),
                                       atomic_read(&data.finished),
                                       atomic_read(&data.started));
-                               debugger(0);
+                               debugger(NULL);
                                goto out;
                        }
                }
@@ -929,7 +935,11 @@ int __devinit __cpu_up(unsigned int cpu)
 
        if (smp_ops->give_timebase)
                smp_ops->give_timebase();
-       cpu_set(cpu, cpu_online_map);
+
+       /* Wait until cpu puts itself in the online map */
+       while (!cpu_online(cpu))
+               cpu_relax();
+
        return 0;
 }
 
@@ -965,6 +975,10 @@ int __devinit start_secondary(void *unused)
 #endif
 #endif
 
+       spin_lock(&call_lock);
+       cpu_set(cpu, cpu_online_map);
+       spin_unlock(&call_lock);
+
        local_irq_enable();
 
        return cpu_idle(NULL);
index 0c0dc27..3eea165 100644 (file)
 #include <asm/naca.h>
 #include <asm/cputable.h>
 
-static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid);
-static void make_slbe(unsigned long esid, unsigned long vsid, int large,
-                     int kernel_segment);
+static int make_ste(unsigned long stab, unsigned long esid,
+                   unsigned long vsid);
 
-static inline void slb_add_bolted(void)
-{
-#ifndef CONFIG_PPC_ISERIES
-       unsigned long esid = GET_ESID(VMALLOCBASE);
-       unsigned long vsid = get_kernel_vsid(VMALLOCBASE);
-
-       WARN_ON(!irqs_disabled());
-
-       /*
-        * Bolt in the first vmalloc segment. Since modules end
-        * up there it gets hit very heavily.
-        */
-       get_paca()->stab_next_rr = 1;
-       make_slbe(esid, vsid, 0, 1);
-#endif
-}
+void slb_initialize(void);
 
 /*
  * Build an entry for the base kernel segment and put it into
@@ -48,32 +32,13 @@ static inline void slb_add_bolted(void)
  */
 void stab_initialize(unsigned long stab)
 {
-       unsigned long esid, vsid; 
-       int seg0_largepages = 0;
-
-       esid = GET_ESID(KERNELBASE);
-       vsid = get_kernel_vsid(esid << SID_SHIFT); 
-
-       if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE)
-               seg0_largepages = 1;
+       unsigned long vsid = get_kernel_vsid(KERNELBASE);
 
        if (cur_cpu_spec->cpu_features & CPU_FTR_SLB) {
-               /* Invalidate the entire SLB & all the ERATS */
-#ifdef CONFIG_PPC_ISERIES
-               asm volatile("isync; slbia; isync":::"memory");
-#else
-               asm volatile("isync":::"memory");
-               asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
-               asm volatile("isync; slbia; isync":::"memory");
-               get_paca()->stab_next_rr = 0;
-               make_slbe(esid, vsid, seg0_largepages, 1);
-               asm volatile("isync":::"memory");
-#endif
-
-               slb_add_bolted();
+               slb_initialize();
        } else {
                asm volatile("isync; slbia; isync":::"memory");
-               make_ste(stab, esid, vsid);
+               make_ste(stab, GET_ESID(KERNELBASE), vsid);
 
                /* Order update */
                asm volatile("sync":::"memory"); 
@@ -129,7 +94,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid)
         * Could not find empty entry, pick one with a round robin selection.
         * Search all entries in the two groups.
         */
-       castout_entry = get_paca()->stab_next_rr;
+       castout_entry = get_paca()->stab_rr;
        for (i = 0; i < 16; i++) {
                if (castout_entry < 8) {
                        global_entry = (esid & 0x1f) << 3;
@@ -148,7 +113,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid)
                castout_entry = (castout_entry + 1) & 0xf;
        }
 
-       get_paca()->stab_next_rr = (castout_entry + 1) & 0xf;
+       get_paca()->stab_rr = (castout_entry + 1) & 0xf;
 
        /* Modify the old entry to the new value. */
 
@@ -314,229 +279,3 @@ void flush_stab(struct task_struct *tsk, struct mm_struct *mm)
 
        preload_stab(tsk, mm);
 }
-
-/*
- * SLB stuff
- */
-
-/*
- * Create a segment buffer entry for the given esid/vsid pair.
- *
- * NOTE: A context syncronising instruction is required before and after
- * this, in the common case we use exception entry and rfid.
- */
-static void make_slbe(unsigned long esid, unsigned long vsid, int large,
-                     int kernel_segment)
-{
-       unsigned long entry, castout_entry;
-       union {
-               unsigned long word0;
-               slb_dword0    data;
-       } esid_data;
-       union {
-               unsigned long word0;
-               slb_dword1    data;
-       } vsid_data;
-       struct paca_struct *lpaca = get_paca();
-
-       /*
-        * We take the next entry, round robin. Previously we tried
-        * to find a free slot first but that took too long. Unfortunately
-        * we dont have any LRU information to help us choose a slot.
-        */
-
-       /* 
-        * Never cast out the segment for our kernel stack. Since we
-        * dont invalidate the ERAT we could have a valid translation
-        * for the kernel stack during the first part of exception exit 
-        * which gets invalidated due to a tlbie from another cpu at a
-        * non recoverable point (after setting srr0/1) - Anton
-        *
-        * paca Ksave is always valid (even when on the interrupt stack)
-        * so we use that.
-        */
-       castout_entry = lpaca->stab_next_rr;
-       do {
-               entry = castout_entry;
-               castout_entry++; 
-               /*
-                * We bolt in the first kernel segment and the first
-                * vmalloc segment.
-                */
-               if (castout_entry >= SLB_NUM_ENTRIES)
-                       castout_entry = 2;
-               asm volatile("slbmfee  %0,%1" : "=r" (esid_data) : "r" (entry));
-       } while (esid_data.data.v &&
-                esid_data.data.esid == GET_ESID(lpaca->kstack));
-
-       lpaca->stab_next_rr = castout_entry;
-
-       /* slbie not needed as the previous mapping is still valid. */
-
-       /* 
-        * Write the new SLB entry.
-        */
-       vsid_data.word0 = 0;
-       vsid_data.data.vsid = vsid;
-       vsid_data.data.kp = 1;
-       if (large)
-               vsid_data.data.l = 1;
-       if (kernel_segment)
-               vsid_data.data.c = 1;
-       else
-               vsid_data.data.ks = 1;
-
-       esid_data.word0 = 0;
-       esid_data.data.esid = esid;
-       esid_data.data.v = 1;
-       esid_data.data.index = entry;
-
-       /*
-        * No need for an isync before or after this slbmte. The exception
-        * we enter with and the rfid we exit with are context synchronizing.
-        */
-       asm volatile("slbmte  %0,%1" : : "r" (vsid_data), "r" (esid_data)); 
-}
-
-static inline void __slb_allocate(unsigned long esid, unsigned long vsid,
-                                 mm_context_t context)
-{
-       int large = 0;
-       int region_id = REGION_ID(esid << SID_SHIFT);
-       unsigned long offset;
-
-       if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) {
-               if (region_id == KERNEL_REGION_ID)
-                       large = 1;
-               else if (region_id == USER_REGION_ID)
-                       large = in_hugepage_area(context, esid << SID_SHIFT);
-       }
-
-       make_slbe(esid, vsid, large, region_id != USER_REGION_ID);
-
-       if (region_id != USER_REGION_ID)
-               return;
-
-       offset = __get_cpu_var(stab_cache_ptr);
-       if (offset < NR_STAB_CACHE_ENTRIES)
-               __get_cpu_var(stab_cache[offset++]) = esid;
-       else
-               offset = NR_STAB_CACHE_ENTRIES+1;
-       __get_cpu_var(stab_cache_ptr) = offset;
-}
-
-/*
- * Allocate a segment table entry for the given ea.
- */
-int slb_allocate(unsigned long ea)
-{
-       unsigned long vsid, esid;
-       mm_context_t context;
-
-       /* Check for invalid effective addresses. */
-       if (unlikely(!IS_VALID_EA(ea)))
-               return 1;
-
-       /* Kernel or user address? */
-       if (REGION_ID(ea) >= KERNEL_REGION_ID) {
-               context = KERNEL_CONTEXT(ea);
-               vsid = get_kernel_vsid(ea);
-       } else {
-               if (unlikely(!current->mm))
-                       return 1;
-
-               context = current->mm->context;
-               vsid = get_vsid(context.id, ea);
-       }
-
-       esid = GET_ESID(ea);
-#ifndef CONFIG_PPC_ISERIES
-       BUG_ON((esid << SID_SHIFT) == VMALLOCBASE);
-#endif
-       __slb_allocate(esid, vsid, context);
-
-       return 0;
-}
-
-/*
- * preload some userspace segments into the SLB.
- */
-static void preload_slb(struct task_struct *tsk, struct mm_struct *mm)
-{
-       unsigned long pc = KSTK_EIP(tsk);
-       unsigned long stack = KSTK_ESP(tsk);
-       unsigned long unmapped_base;
-       unsigned long pc_esid = GET_ESID(pc);
-       unsigned long stack_esid = GET_ESID(stack);
-       unsigned long unmapped_base_esid;
-       unsigned long vsid;
-
-       if (test_tsk_thread_flag(tsk, TIF_32BIT))
-               unmapped_base = TASK_UNMAPPED_BASE_USER32;
-       else
-               unmapped_base = TASK_UNMAPPED_BASE_USER64;
-
-       unmapped_base_esid = GET_ESID(unmapped_base);
-
-       if (!IS_VALID_EA(pc) || (REGION_ID(pc) >= KERNEL_REGION_ID))
-               return;
-       vsid = get_vsid(mm->context.id, pc);
-       __slb_allocate(pc_esid, vsid, mm->context);
-
-       if (pc_esid == stack_esid)
-               return;
-
-       if (!IS_VALID_EA(stack) || (REGION_ID(stack) >= KERNEL_REGION_ID))
-               return;
-       vsid = get_vsid(mm->context.id, stack);
-       __slb_allocate(stack_esid, vsid, mm->context);
-
-       if (pc_esid == unmapped_base_esid || stack_esid == unmapped_base_esid)
-               return;
-
-       if (!IS_VALID_EA(unmapped_base) ||
-           (REGION_ID(unmapped_base) >= KERNEL_REGION_ID))
-               return;
-       vsid = get_vsid(mm->context.id, unmapped_base);
-       __slb_allocate(unmapped_base_esid, vsid, mm->context);
-}
-
-/* Flush all user entries from the segment table of the current processor. */
-void flush_slb(struct task_struct *tsk, struct mm_struct *mm)
-{
-       unsigned long offset = __get_cpu_var(stab_cache_ptr);
-       union {
-               unsigned long word0;
-               slb_dword0 data;
-       } esid_data;
-
-       if (offset <= NR_STAB_CACHE_ENTRIES) {
-               int i;
-               asm volatile("isync" : : : "memory");
-               for (i = 0; i < offset; i++) {
-                       esid_data.word0 = 0;
-                       esid_data.data.esid = __get_cpu_var(stab_cache[i]);
-                       BUG_ON(esid_data.data.esid == GET_ESID(VMALLOCBASE));
-                       asm volatile("slbie %0" : : "r" (esid_data));
-               }
-               asm volatile("isync" : : : "memory");
-       } else {
-               asm volatile("isync; slbia; isync" : : : "memory");
-               slb_add_bolted();
-       }
-
-       /* Workaround POWER5 < DD2.1 issue */
-       if (offset == 1 || offset > NR_STAB_CACHE_ENTRIES) {
-               /* 
-                * flush segment in EEH region, we dont normally access
-                * addresses in this region.
-                */
-               esid_data.word0 = 0;
-               esid_data.data.esid = EEH_REGION_ID;
-               asm volatile("slbie %0" : : "r" (esid_data));
-       }
-
-       __get_cpu_var(stab_cache_ptr) = 0;
-
-       preload_slb(tsk, mm);
-}
index 83133a0..33b64c2 100644 (file)
@@ -211,8 +211,8 @@ static ssize_t show_##NAME(struct sys_device *dev, char *buf) \
        unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \
        return sprintf(buf, "%lx\n", val); \
 } \
-static ssize_t store_##NAME(struct sys_device *dev, const char *buf, \
-                           size_t count) \
+static ssize_t __attribute_used__ \
+       store_##NAME(struct sys_device *dev, const char *buf, size_t count) \
 { \
        struct cpu *cpu = container_of(dev, struct cpu, sysdev); \
        unsigned long val; \
index 125e927..a5fd6e7 100644 (file)
@@ -380,7 +380,7 @@ struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node)
        viodev->dev.platform_data = of_node_get(of_node);
 
        viodev->irq = NO_IRQ;
-       irq_p = (unsigned int *)get_property(of_node, "interrupts", 0);
+       irq_p = (unsigned int *)get_property(of_node, "interrupts", NULL);
        if (irq_p) {
                int virq = virt_irq_create_mapping(*irq_p);
                if (virq == NO_IRQ) {
index 35785ac..c9f950c 100644 (file)
@@ -27,7 +27,6 @@
 #include <asm/naca.h>
 #include <asm/rtas.h>
 #include <asm/xics.h>
-#include <asm/ppcdebug.h>
 #include <asm/hvcall.h>
 #include <asm/machdep.h>
 
@@ -190,7 +189,7 @@ static void pSeriesLP_xirr_info_set(int n_cpu, int value)
                      val64); 
 }
 
-static void pSeriesLP_cppr_info(int n_cpu, u8 value)
+void pSeriesLP_cppr_info(int n_cpu, u8 value)
 {
        unsigned long lpar_rc;
 
@@ -239,13 +238,13 @@ static unsigned int real_irq_to_virt(unsigned int real_irq)
 #ifdef CONFIG_SMP
 static int get_irq_server(unsigned int irq)
 {
-       cpumask_t cpumask = irq_affinity[irq];
-       cpumask_t tmp = CPU_MASK_NONE;
        unsigned int server;
 
 #ifdef CONFIG_IRQ_ALL_CPUS
        /* For the moment only implement delivery to all cpus or one cpu */
        if (smp_threads_ready) {
+               cpumask_t cpumask = irq_affinity[irq];
+               cpumask_t tmp = CPU_MASK_NONE;
                if (cpus_equal(cpumask, CPU_MASK_ALL)) {
                        server = default_distrib_server;
                } else {
@@ -286,7 +285,7 @@ static void xics_enable_irq(unsigned int virq)
        call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server,
                                DEFAULT_PRIORITY);
        if (call_status != 0) {
-               printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_set_xive "
+               printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_set_xive "
                       "returned %x\n", irq, call_status);
                return;
        }
@@ -294,7 +293,7 @@ static void xics_enable_irq(unsigned int virq)
        /* Now unmask the interrupt (often a no-op) */
        call_status = rtas_call(ibm_int_on, 1, 1, NULL, irq);
        if (call_status != 0) {
-               printk(KERN_ERR "xics_enable_irq: irq=%x: ibm_int_on "
+               printk(KERN_ERR "xics_enable_irq: irq=%d: ibm_int_on "
                       "returned %x\n", irq, call_status);
                return;
        }
@@ -310,7 +309,7 @@ static void xics_disable_real_irq(unsigned int irq)
 
        call_status = rtas_call(ibm_int_off, 1, 1, NULL, irq);
        if (call_status != 0) {
-               printk(KERN_ERR "xics_disable_real_irq: irq=%x: "
+               printk(KERN_ERR "xics_disable_real_irq: irq=%d: "
                       "ibm_int_off returned %x\n", irq, call_status);
                return;
        }
@@ -319,7 +318,7 @@ static void xics_disable_real_irq(unsigned int irq)
        /* Have to set XIVE to 0xff to be able to remove a slot */
        call_status = rtas_call(ibm_set_xive, 3, 1, NULL, irq, server, 0xff);
        if (call_status != 0) {
-               printk(KERN_ERR "xics_disable_irq: irq=%x: ibm_set_xive(0xff)"
+               printk(KERN_ERR "xics_disable_irq: irq=%d: ibm_set_xive(0xff)"
                       " returned %x\n", irq, call_status);
                return;
        }
@@ -356,8 +355,6 @@ static void xics_mask_and_ack_irq(unsigned int irq)
        }
 }
 
-extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq);
-
 int xics_get_irq(struct pt_regs *regs)
 {
        unsigned int cpu = smp_processor_id();
@@ -384,7 +381,7 @@ int xics_get_irq(struct pt_regs *regs)
                if (irq == NO_IRQ)
                        irq = real_irq_to_virt_slowpath(vec);
                if (irq == NO_IRQ) {
-                       printk(KERN_ERR "Interrupt 0x%x (real) is invalid,"
+                       printk(KERN_ERR "Interrupt %d (real) is invalid,"
                               " disabling it.\n", vec);
                        xics_disable_real_irq(vec);
                } else
@@ -395,8 +392,6 @@ int xics_get_irq(struct pt_regs *regs)
 
 #ifdef CONFIG_SMP
 
-extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
-
 irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
 {
        int cpu = smp_processor_id();
@@ -469,13 +464,11 @@ void xics_init_IRQ(void)
        ibm_int_off = rtas_token("ibm,int-off");
 
        np = of_find_node_by_type(NULL, "PowerPC-External-Interrupt-Presentation");
-       if (!np) {
-               printk(KERN_WARNING "Can't find Interrupt Presentation\n");
-               udbg_printf("Can't find Interrupt Presentation\n");
-               while (1);
-       }
+       if (!np)
+               panic("xics_init_IRQ: can't find interrupt presentation");
+
 nextnode:
-       ireg = (uint *)get_property(np, "ibm,interrupt-server-ranges", 0);
+       ireg = (uint *)get_property(np, "ibm,interrupt-server-ranges", NULL);
        if (ireg) {
                /*
                 * set node starting index for this node
@@ -484,11 +477,8 @@ nextnode:
        }
 
        ireg = (uint *)get_property(np, "reg", &ilen);
-       if (!ireg) {
-               printk(KERN_WARNING "Can't find Interrupt Reg Property\n");
-               udbg_printf("Can't find Interrupt Reg Property\n");
-               while (1);
-       }
+       if (!ireg)
+               panic("xics_init_IRQ: can't find interrupt reg property");
        
        while (ilen) {
                inodes[indx].addr = (unsigned long long)*ireg++ << 32;
@@ -528,16 +518,14 @@ nextnode:
 
        np = of_find_node_by_type(NULL, "interrupt-controller");
        if (!np) {
-               printk(KERN_WARNING "xics:  no ISA Interrupt Controller\n");
+               printk(KERN_WARNING "xics: no ISA interrupt controller\n");
                xics_irq_8259_cascade_real = -1;
                xics_irq_8259_cascade = -1;
        } else {
-               ireg = (uint *) get_property(np, "interrupts", 0);
-               if (!ireg) {
-                       printk(KERN_WARNING "Can't find ISA Interrupts Property\n");
-                       udbg_printf("Can't find ISA Interrupts Property\n");
-                       while (1);
-               }
+               ireg = (uint *) get_property(np, "interrupts", NULL);
+               if (!ireg)
+                       panic("xics_init_IRQ: can't find ISA interrupts property");
+
                xics_irq_8259_cascade_real = *ireg;
                xics_irq_8259_cascade
                        = virt_irq_create_mapping(xics_irq_8259_cascade_real);
@@ -558,13 +546,8 @@ nextnode:
                xics_per_cpu[0] = __ioremap((ulong)intr_base, intr_size,
                                            _PAGE_NO_CACHE);
 #endif /* CONFIG_SMP */
-#ifdef CONFIG_PPC_PSERIES
-       /* actually iSeries does not use any of xics...but it has link dependencies
-        * for now, except this new one...
-        */
        } else if (systemcfg->platform == PLATFORM_PSERIES_LPAR) {
                ops = &pSeriesLP_ops;
-#endif
        }
 
        xics_8259_pic.enable = i8259_pic.enable;
@@ -589,8 +572,9 @@ static int __init xics_setup_i8259(void)
        if (naca->interrupt_controller == IC_PPC_XIC &&
            xics_irq_8259_cascade != -1) {
                if (request_irq(irq_offset_up(xics_irq_8259_cascade),
-                               no_action, 0, "8259 cascade", 0))
-                       printk(KERN_ERR "xics_init_IRQ: couldn't get 8259 cascade\n");
+                               no_action, 0, "8259 cascade", NULL))
+                       printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 "
+                                       "cascade\n");
                i8259_init();
        }
        return 0;
@@ -604,7 +588,7 @@ void xics_request_IPIs(void)
 
        /* IPIs are marked SA_INTERRUPT as they must run with irqs disabled */
        request_irq(irq_offset_up(XICS_IPI), xics_ipi_action, SA_INTERRUPT,
-                   "IPI", 0);
+                   "IPI", NULL);
        get_irq_desc(irq_offset_up(XICS_IPI))->status |= IRQ_PER_CPU;
 }
 #endif
@@ -643,7 +627,7 @@ static void xics_set_affinity(unsigned int virq, cpumask_t cpumask)
                                irq, newmask, xics_status[1]);
 
        if (status) {
-               printk(KERN_ERR "xics_set_affinity irq=%d ibm,set-xive "
+               printk(KERN_ERR "xics_set_affinity: irq=%d ibm,set-xive "
                       "returns %d\n", irq, status);
                return;
        }
@@ -657,9 +641,7 @@ void xics_migrate_irqs_away(void)
        int set_indicator = rtas_token("set-indicator");
        const unsigned int giqs = 9005UL; /* Global Interrupt Queue Server */
        int status = 0;
-       unsigned int irq, cpu = smp_processor_id();
-       int xics_status[2];
-       unsigned long flags;
+       unsigned int irq, virq, cpu = smp_processor_id();
 
        BUG_ON(set_indicator == RTAS_UNKNOWN_SERVICE);
 
@@ -676,12 +658,20 @@ void xics_migrate_irqs_away(void)
        ops->cppr_info(cpu, DEFAULT_PRIORITY);
        iosync();
 
-       printk(KERN_WARNING "HOTPLUG: Migrating IRQs away\n");
-       for_each_irq(irq) {
-               irq_desc_t *desc = get_irq_desc(irq);
+       for_each_irq(virq) {
+               irq_desc_t *desc;
+               int xics_status[2];
+               unsigned long flags;
+
+               /* We cant set affinity on ISA interrupts */
+               if (virq < irq_offset_value())
+                       continue;
+
+               desc = get_irq_desc(virq);
+               irq = virt_irq_to_real(irq_offset_down(virq));
 
                /* We need to get IPIs still. */
-               if (irq_offset_down(irq) == XICS_IPI)
+               if (irq == XICS_IPI || irq == NO_IRQ)
                        continue;
 
                /* We only need to migrate enabled IRQS */
@@ -696,7 +686,7 @@ void xics_migrate_irqs_away(void)
                if (status) {
                        printk(KERN_ERR "migrate_irqs_away: irq=%d "
                                        "ibm,get-xive returns %d\n",
-                                       irq, status);
+                                       virq, status);
                        goto unlock;
                }
 
@@ -709,21 +699,20 @@ void xics_migrate_irqs_away(void)
                        goto unlock;
 
                printk(KERN_WARNING "IRQ %d affinity broken off cpu %u\n",
-                      irq, cpu);
+                      virq, cpu);
 
                /* Reset affinity to all cpus */
                xics_status[0] = default_distrib_server;
 
-               status = rtas_call(ibm_set_xive, 3, 1, NULL,
-                               irq, xics_status[0], xics_status[1]);
+               status = rtas_call(ibm_set_xive, 3, 1, NULL, irq,
+                               xics_status[0], xics_status[1]);
                if (status)
-                       printk(KERN_ERR "migrate_irqs_away irq=%d "
+                       printk(KERN_ERR "migrate_irqs_away: irq=%d "
                                        "ibm,set-xive returns %d\n",
-                                       irq, status);
+                                       virq, status);
 
 unlock:
                spin_unlock_irqrestore(&desc->lock, flags);
        }
-
 }
 #endif
index 0306bab..691b25e 100644 (file)
@@ -4,6 +4,6 @@
 
 EXTRA_CFLAGS += -mno-minimal-toc
 
-obj-y := fault.o init.o imalloc.o hash_utils.o hash_low.o tlb.o slb_low.o slb.o
+obj-y := fault.o init.o imalloc.o hash_utils.o hash_low.o tlb.o slb_low.o slb.o mmap.o
 obj-$(CONFIG_DISCONTIGMEM) += numa.o
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
index 71c1598..b78e7f4 100644 (file)
@@ -93,13 +93,15 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
        unsigned long is_write = error_code & 0x02000000;
        unsigned long trap = TRAP(regs);
 
-       if (trap == 0x300 || trap == 0x380) {
+       BUG_ON((trap == 0x380) || (trap == 0x480));
+
+       if (trap == 0x300) {
                if (debugger_fault_handler(regs))
                        return 0;
        }
 
        /* On a kernel SLB miss we can only check for a valid exception entry */
-       if (!user_mode(regs) && (trap == 0x380 || address >= TASK_SIZE))
+       if (!user_mode(regs) && (address >= TASK_SIZE))
                return SIGSEGV;
 
        if (error_code & 0x00400000) {
index 4e6b529..f405658 100644 (file)
@@ -251,7 +251,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
        struct mm_struct *mm;
        pte_t *ptep;
        int ret;
-       int cpu;
        int user_region = 0;
        int local = 0;
        cpumask_t tmp;
@@ -303,8 +302,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
        if (pgdir == NULL)
                return 1;
 
-       cpu = get_cpu();
-       tmp = cpumask_of_cpu(cpu);
+       tmp = cpumask_of_cpu(smp_processor_id());
        if (user_region && cpus_equal(mm->cpu_vm_mask, tmp))
                local = 1;
 
@@ -313,13 +311,10 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
                ret = hash_huge_page(mm, access, ea, vsid, local);
        else {
                ptep = find_linux_pte(pgdir, ea);
-               if (ptep == NULL) {
-                       put_cpu();
+               if (ptep == NULL)
                        return 1;
-               }
                ret = __hash_page(ea, access, vsid, ptep, trap, local);
        }
-       put_cpu();
 
        return ret;
 }
index 857e891..99d9238 100644 (file)
@@ -545,6 +545,8 @@ void __init do_init_bootmem(void)
 
        boot_mapsize = init_bootmem(start >> PAGE_SHIFT, total_pages);
 
+       max_pfn = max_low_pfn;
+
        /* add all physical memory to the bootmem map. Also find the first */
        for (i=0; i < lmb.memory.cnt; i++) {
                unsigned long physbase, size;
@@ -629,7 +631,6 @@ void __init mem_init(void)
 
        num_physpages = max_low_pfn;    /* RAM is assumed contiguous */
        high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
-       max_pfn = max_low_pfn;
 
 #ifdef CONFIG_DISCONTIGMEM
 {
@@ -654,7 +655,7 @@ void __init mem_init(void)
 
        totalram_pages += free_all_bootmem();
 
-       for (addr = KERNELBASE; addr <= (unsigned long)__va(lmb_end_of_DRAM());
+       for (addr = KERNELBASE; addr < (unsigned long)__va(lmb_end_of_DRAM());
             addr += PAGE_SIZE) {
                if (!PageReserved(virt_to_page(addr)))
                        continue;
@@ -764,8 +765,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea,
        void *pgdir;
        pte_t *ptep;
        int local = 0;
-       int cpu;
        cpumask_t tmp;
+       unsigned long flags;
 
        /* handle i-cache coherency */
        if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE) &&
@@ -795,14 +796,14 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long ea,
 
        vsid = get_vsid(vma->vm_mm->context.id, ea);
 
-       cpu = get_cpu();
-       tmp = cpumask_of_cpu(cpu);
+       local_irq_save(flags);
+       tmp = cpumask_of_cpu(smp_processor_id());
        if (cpus_equal(vma->vm_mm->cpu_vm_mask, tmp))
                local = 1;
 
        __hash_page(ea, pte_val(pte) & (_PAGE_USER|_PAGE_RW), vsid, ptep,
                    0x300, local);
-       put_cpu();
+       local_irq_restore(flags);
 }
 
 void * reserve_phb_iospace(unsigned long size)
index 2221202..eb33136 100644 (file)
@@ -356,6 +356,7 @@ void __init do_init_bootmem(void)
 
        min_low_pfn = 0;
        max_low_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
+       max_pfn = max_low_pfn;
 
        if (parse_numa_properties())
                setup_nonnuma();
index d4b47a6..d112120 100644 (file)
@@ -181,6 +181,15 @@ config QDIO_PERF_STATS
 
          If unsure, say N.
 
+config QDIO_DEBUG
+       bool "Extended debugging information"
+       depends on QDIO
+       help
+         Say Y here to get extended debugging output in /proc/s390dbf/qdio...
+         Warning: this option reduces the performance of the QDIO module.
+
+         If unsure, say N.
+
 comment "Misc"
 
 config PREEMPT
index d957683..3589f48 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/errno.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
+#include <asm/smp.h>
 #include <linux/interrupt.h>
 #include <linux/proc_fs.h>
 #include <linux/page-flags.h>
@@ -87,11 +88,11 @@ struct appldata_parameter_list {
  */
 static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH] = "appldata";
 static int appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-                                 void __user *buffer, size_t *lenp);
+                                 void __user *buffer, size_t *lenp, loff_t *ppos);
 static int appldata_interval_handler(ctl_table *ctl, int write,
                                         struct file *filp,
                                         void __user *buffer,
-                                        size_t *lenp);
+                                        size_t *lenp, loff_t *ppos);
 
 static struct ctl_table_header *appldata_sysctl_header;
 static struct ctl_table appldata_table[] = {
@@ -314,12 +315,12 @@ __appldata_vtimer_setup(int cmd)
  */
 static int
 appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
-                          void __user *buffer, size_t *lenp)
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int len;
        char buf[2];
 
-       if (!*lenp || filp->f_pos) {
+       if (!*lenp || *ppos) {
                *lenp = 0;
                return 0;
        }
@@ -342,7 +343,7 @@ appldata_timer_handler(ctl_table *ctl, int write, struct file *filp,
        spin_unlock(&appldata_timer_lock);
 out:
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
@@ -354,12 +355,12 @@ out:
  */
 static int
 appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
-                          void __user *buffer, size_t *lenp)
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int len, interval;
        char buf[16];
 
-       if (!*lenp || filp->f_pos) {
+       if (!*lenp || *ppos) {
                *lenp = 0;
                return 0;
        }
@@ -390,7 +391,7 @@ appldata_interval_handler(ctl_table *ctl, int write, struct file *filp,
                 interval);
 out:
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
@@ -402,7 +403,7 @@ out:
  */
 static int
 appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
-                          void __user *buffer, size_t *lenp)
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        struct appldata_ops *ops = NULL, *tmp_ops;
        int rc, len, found;
@@ -428,7 +429,7 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
        }
        spin_unlock_bh(&appldata_ops_lock);
 
-       if (!*lenp || filp->f_pos) {
+       if (!*lenp || *ppos) {
                *lenp = 0;
                module_put(ops->owner);
                return 0;
@@ -487,7 +488,7 @@ appldata_generic_handler(ctl_table *ctl, int write, struct file *filp,
        spin_unlock_bh(&appldata_ops_lock);
 out:
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        module_put(ops->owner);
        return 0;
 }
index 6be5383..d4cd42c 100644 (file)
@@ -11,7 +11,6 @@ CONFIG_UID16=y
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 
 #
 # General setup
@@ -71,6 +70,7 @@ CONFIG_MATHEMU=y
 CONFIG_MACHCHK_WARNING=y
 CONFIG_QDIO=y
 # CONFIG_QDIO_PERF_STATS is not set
+# CONFIG_QDIO_DEBUG is not set
 
 #
 # Misc
@@ -93,6 +93,7 @@ CONFIG_NO_IDLE_HZ_INIT=y
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_DEBUG_DRIVER is not set
@@ -261,17 +262,18 @@ CONFIG_XFRM=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 CONFIG_NET_SCHED=y
+CONFIG_NET_SCH_CLK_JIFFIES=y
+# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
+# CONFIG_NET_SCH_CLK_CPU is not set
 CONFIG_NET_SCH_CBQ=m
 # CONFIG_NET_SCH_HTB is not set
 # CONFIG_NET_SCH_HFSC is not set
-CONFIG_NET_SCH_CSZ=m
 CONFIG_NET_SCH_PRIO=m
 CONFIG_NET_SCH_RED=m
 CONFIG_NET_SCH_SFQ=m
@@ -279,7 +281,7 @@ CONFIG_NET_SCH_TEQL=m
 CONFIG_NET_SCH_TBF=m
 CONFIG_NET_SCH_GRED=m
 CONFIG_NET_SCH_DSMARK=m
-# CONFIG_NET_SCH_DELAY is not set
+# CONFIG_NET_SCH_NETEM is not set
 # CONFIG_NET_SCH_INGRESS is not set
 CONFIG_NET_QOS=y
 CONFIG_NET_ESTIMATOR=y
@@ -391,7 +393,8 @@ CONFIG_FS_MBCACHE=y
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -416,6 +419,7 @@ CONFIG_RAMFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -507,7 +511,7 @@ CONFIG_CRYPTO=y
 # CONFIG_CRYPTO_BLOWFISH is not set
 # CONFIG_CRYPTO_TWOFISH is not set
 # CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_AES_GENERIC is not set
 # CONFIG_CRYPTO_CAST5 is not set
 # CONFIG_CRYPTO_CAST6 is not set
 # CONFIG_CRYPTO_TEA is not set
@@ -520,6 +524,6 @@ CONFIG_CRYPTO=y
 #
 # Library routines
 #
-# CONFIG_CRC16 is not set
+# CONFIG_CRC_CCITT is not set
 # CONFIG_CRC32 is not set
 # CONFIG_LIBCRC32C is not set
index 70c83cb..e8c8b2f 100644 (file)
@@ -106,6 +106,53 @@ int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from)
        return err;
 }
 
+int copy_siginfo_from_user32(siginfo_t *to, siginfo_t32 __user *from)
+{
+       int err;
+       u32 tmp;
+
+       if (!access_ok (VERIFY_READ, from, sizeof(siginfo_t32)))
+               return -EFAULT;
+
+       err = __get_user(to->si_signo, &from->si_signo);
+       err |= __get_user(to->si_errno, &from->si_errno);
+       err |= __get_user(to->si_code, &from->si_code);
+
+       if (from->si_code < 0)
+               err |= __copy_from_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
+       else {
+               switch (from->si_code >> 16) {
+               case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+               case __SI_MESGQ >> 16:
+                       err |= __get_user(to->si_int, &from->si_int);
+                       /* fallthrough */
+               case __SI_KILL >> 16:
+                       err |= __get_user(to->si_pid, &from->si_pid);
+                       err |= __get_user(to->si_uid, &from->si_uid);
+                       break;
+               case __SI_CHLD >> 16:
+                       err |= __get_user(to->si_pid, &from->si_pid);
+                       err |= __get_user(to->si_uid, &from->si_uid);
+                       err |= __get_user(to->si_utime, &from->si_utime);
+                       err |= __get_user(to->si_stime, &from->si_stime);
+                       err |= __get_user(to->si_status, &from->si_status);
+                       break;
+               case __SI_FAULT >> 16:
+                       err |= __get_user(tmp, &from->si_addr);
+                       to->si_addr = (void *)(u64) (tmp & PSW32_ADDR_INSN);
+                       break;
+               case __SI_POLL >> 16:
+               case __SI_TIMER >> 16:
+                       err |= __get_user(to->si_band, &from->si_band);
+                       err |= __get_user(to->si_fd, &from->si_fd);
+                       break;
+               default:
+                       break;
+               }
+       }
+       return err;
+}
+
 /*
  * Atomically swap in the new signal mask, and wait for a signal.
  */
index c0c06f1..1f87bf2 100644 (file)
@@ -62,107 +62,53 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
  *    R15 - kernel stack pointer
  */
 
-        .macro  SAVE_ALL_BASE psworg,savearea,sync
-        stm     %r12,%r15,\savearea
-       l       %r13,__LC_SVC_NEW_PSW+4   # load &system_call to %r13
+       .macro  SAVE_ALL_BASE savearea
+       stm     %r12,%r15,\savearea
+       l       %r13,__LC_SVC_NEW_PSW+4 # load &system_call to %r13
        .endm
 
-        .macro  CLEANUP_SAVE_ALL_BASE psworg,savearea,sync
-       l       %r1,SP_PSW+4(%r15)
-       cli     1(%r1),0xcf
-       bne     BASED(0f)
-       mvc     \savearea(16),SP_R12(%r15)
-0:     st      %r13,SP_R13(%r15)
-       .endm
-
-        .macro  SAVE_ALL psworg,savearea,sync
+       .macro  SAVE_ALL psworg,savearea,sync
+       la      %r12,\psworg
        .if     \sync
-        tm      \psworg+1,0x01            # test problem state bit
-        bz      BASED(1f)                 # skip stack setup save
-        l       %r15,__LC_KERNEL_STACK    # problem state -> load ksp
+       tm      \psworg+1,0x01          # test problem state bit
+       bz      BASED(2f)               # skip stack setup save
+       l       %r15,__LC_KERNEL_STACK  # problem state -> load ksp
        .else
-        tm      \psworg+1,0x01            # test problem state bit
-        bnz     BASED(0f)                 # from user -> load async stack
-       l       %r14,__LC_ASYNC_STACK     # are we already on the async stack ?
-       slr     %r14,%r15
+       tm      \psworg+1,0x01          # test problem state bit
+       bnz     BASED(1f)               # from user -> load async stack
+       clc     \psworg+4(4),BASED(.Lcritical_end)
+       bhe     BASED(0f)
+       clc     \psworg+4(4),BASED(.Lcritical_start)
+       bl      BASED(0f)
+       l       %r14,BASED(.Lcleanup_critical)
+       basr    %r14,%r14
+       tm      0(%r12),0x01            # retest problem state after cleanup
+       bnz     BASED(1f)
+0:     l       %r14,__LC_ASYNC_STACK   # are we already on the async stack ?
+       slr     %r14,%r15
        sra     %r14,13
-       be      BASED(1f)
-0:     l       %r15,__LC_ASYNC_STACK
+       be      BASED(2f)
+1:     l       %r15,__LC_ASYNC_STACK
        .endif
-1:      s       %r15,BASED(.Lc_spsize)    # make room for registers & psw
-       l       %r14,BASED(.L\psworg)
-       slr     %r12,%r12
-       icm     %r14,12,__LC_SVC_ILC
-        stm     %r0,%r11,SP_R0(%r15)      # store gprs 0-12 to kernel stack
-        st      %r2,SP_ORIG_R2(%r15)      # store original content of gpr 2
-        mvc     SP_R12(16,%r15),\savearea # move R13-R15 to stack
-        mvc     SP_PSW(8,%r15),\psworg    # move user PSW to stack
-       st      %r14,SP_ILC(%r15)
-        st      %r12,0(%r15)              # clear back chain
-        .endm
-
-       .macro  CLEANUP_SAVE_ALL psworg,savearea,sync
-       l       %r1,\savearea+12
-       .if     \sync
-       tm      \psworg+1,0x01
-       bz      BASED(1f)
-       l       %r1,__LC_KERNEL_STACK
-       .else
-       tm      \psworg+1,0x01
-       bnz     BASED(0f)
-       l       %r0,__LC_ASYNC_STACK
-       slr     %r0,%r1
-       sra     %r0,13
-       bz      BASED(1f)
-0:     l       %r1,__LC_ASYNC_STACK
-       .endif
-1:     s       %r1,BASED(.Lc_spsize)
-       st      %r1,SP_R15(%r15)
-       l       %r0,BASED(.L\psworg)
-       xc      SP_R12(4,%r15),SP_R12(%r15)
-       icm     %r0,12,__LC_SVC_ILC
-       st      %r0,SP_R14(%r15)
-       mvc     SP_R0(48,%r1),SP_R0(%r15)
-       mvc     SP_ORIG_R2(4,%r1),SP_R2(%r15)
-       mvc     SP_R12(16,%r1),\savearea
-       mvc     SP_PSW(8,%r1),\psworg
-       st      %r0,SP_ILC(%r1)
-       xc      0(4,%r1),0(%r1)
-       .endm
-
-        .macro  RESTORE_ALL               # system exit macro
-        mvc     __LC_RETURN_PSW(8),SP_PSW(%r15)  # move user PSW to lowcore
-        ni      __LC_RETURN_PSW+1,0xfd    # clear wait state bit
-        lm      %r0,%r15,SP_R0(%r15)      # load gprs 0-15 of user
-        lpsw    __LC_RETURN_PSW           # back to caller
-        .endm
-
-       .macro  CLEANUP_RESTORE_ALL
-       l       %r1,SP_PSW+4(%r15)
-       cli     0(%r1),0x82
-       bne     BASED(0f)
-       mvc     SP_PSW(8,%r15),__LC_RETURN_PSW
-       b       BASED(1f)
-0:     l       %r1,SP_R15(%r15)
-       mvc     SP_PSW(8,%r15),SP_PSW(%r1)
-       mvc     SP_R0(64,%r15),SP_R0(%r1)
-1:
+2:     s       %r15,BASED(.Lc_spsize)  # make room for registers & psw
+       mvc     SP_PSW(8,%r15),0(%r12)  # move user PSW to stack
+       la      %r12,\psworg
+       st      %r2,SP_ORIG_R2(%r15)    # store original content of gpr 2
+       icm     %r12,12,__LC_SVC_ILC
+       stm     %r0,%r11,SP_R0(%r15)    # store gprs %r0-%r11 to kernel stack
+       st      %r12,SP_ILC(%r15)
+       mvc     SP_R12(16,%r15),\savearea # move %r12-%r15 to stack
+       la      %r12,0
+       st      %r12,0(%r15)            # clear back chain
        .endm
 
-        .macro  GET_THREAD_INFO
-       l       %r9,__LC_THREAD_INFO
-        .endm
-
-       .macro  CHECK_CRITICAL
-        tm      SP_PSW+1(%r15),0x01      # test problem state bit
-       bnz     BASED(0f)                # from user -> not critical
-       clc     SP_PSW+4(4,%r15),BASED(.Lcritical_end)
-       bnl     BASED(0f)
-       clc     SP_PSW+4(4,%r15),BASED(.Lcritical_start)
-       bl      BASED(0f)
-       l       %r1,BASED(.Lcleanup_critical)
-       basr    %r14,%r1
-0:
+       .macro  RESTORE_ALL sync
+       mvc     __LC_RETURN_PSW(8),SP_PSW(%r15) # move user PSW to lowcore
+       .if !\sync
+       ni      __LC_RETURN_PSW+1,0xfd  # clear wait state bit
+       .endif
+       lm      %r0,%r15,SP_R0(%r15)    # load gprs 0-15 of user
+       lpsw    __LC_RETURN_PSW         # back to caller
        .endm
 
 /*
@@ -226,12 +172,11 @@ __critical_start:
 
        .globl  system_call
 system_call:
-       SAVE_ALL_BASE __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
+       SAVE_ALL_BASE __LC_SAVE_AREA
         SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
        lh      %r7,0x8a          # get svc number from lowcore
-sysc_enter:
-        GET_THREAD_INFO           # load pointer to task_struct to R9
 sysc_do_svc:
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        sla     %r7,2             # *4 and test for svc 0
        bnz     BASED(sysc_nr_ok) # svc number > 0
        # svc 0: system call number in %r1
@@ -256,13 +201,12 @@ sysc_return:
        tm      __TI_flags+3(%r9),_TIF_WORK_SVC
        bnz     BASED(sysc_work)  # there is work to do (signals etc.)
 sysc_leave:
-        RESTORE_ALL
+        RESTORE_ALL 1
 
 #
 # recheck if there is more work to do
 #
 sysc_work_loop:
-        GET_THREAD_INFO           # load pointer to task_struct to R9
        tm      __TI_flags+3(%r9),_TIF_WORK_SVC
        bz      BASED(sysc_leave)      # there is no work to do
 #
@@ -359,7 +303,7 @@ sysc_tracenogo:
         .globl  ret_from_fork
 ret_from_fork:
        l       %r13,__LC_SVC_NEW_PSW+4
-        GET_THREAD_INFO           # load pointer to task_struct to R9
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         l       %r1,BASED(.Lschedtail)
        basr    %r14,%r1
         stosm   24(%r15),0x03     # reenable interrupts
@@ -455,17 +399,17 @@ pgm_check_handler:
  * we just ignore the PER event (FIXME: is there anything we have to do
  * for LPSW?).
  */
-       SAVE_ALL_BASE __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
+       SAVE_ALL_BASE __LC_SAVE_AREA
         tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
         bnz     BASED(pgm_per)           # got per exception -> special case
        SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         l       %r3,__LC_PGM_ILC         # load program interruption code
        la      %r8,0x7f
        nr      %r8,%r3
 pgm_do_call:
         l       %r7,BASED(.Ljump_table)
         sll     %r8,2
-       GET_THREAD_INFO
         l       %r7,0(%r8,%r7)          # load address of handler routine
         la      %r2,SP_PTREGS(%r15)     # address of register-save area
        la      %r14,BASED(sysc_return)
@@ -481,7 +425,7 @@ pgm_per:
         clc     __LC_PGM_OLD_PSW(8),__LC_SVC_NEW_PSW
         be      BASED(pgm_svcper)
 # no interesting special case, ignore PER event
-        lm      %r13,%r15,__LC_SAVE_AREA
+        lm      %r12,%r15,__LC_SAVE_AREA
        lpsw    0x28
 
 #
@@ -489,7 +433,7 @@ pgm_per:
 #
 pgm_per_std:
        SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
-       GET_THREAD_INFO
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        l       %r1,__TI_task(%r9)
        mvc     __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
        mvc     __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -507,7 +451,7 @@ pgm_per_std:
 pgm_svcper:
        SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
        lh      %r7,0x8a                # get svc number from lowcore
-       GET_THREAD_INFO                 # load pointer to task_struct to R9
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        l       %r1,__TI_task(%r9)
        mvc     __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
        mvc     __THREAD_per+__PER_address(4,%r1),__LC_PER_ADDRESS
@@ -522,11 +466,10 @@ pgm_svcper:
 
         .globl io_int_handler
 io_int_handler:
-       SAVE_ALL_BASE __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
-        SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
        stck    __LC_INT_CLOCK
-       CHECK_CRITICAL
-        GET_THREAD_INFO           # load pointer to task_struct to R9
+       SAVE_ALL_BASE __LC_SAVE_AREA+16
+        SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+16,0
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         l       %r1,BASED(.Ldo_IRQ)        # load address of do_IRQ
         la      %r2,SP_PTREGS(%r15) # address of register-save area
         basr    %r14,%r1          # branch to standard irq handler
@@ -541,7 +484,7 @@ io_return:
        tm      __TI_flags+3(%r9),_TIF_WORK_INT
        bnz     BASED(io_work)         # there is work to do (signals etc.)
 io_leave:
-        RESTORE_ALL
+        RESTORE_ALL 0
 
 #ifdef CONFIG_PREEMPT
 io_preempt:
@@ -560,7 +503,6 @@ io_resume_loop:
         l       %r1,BASED(.Lschedule)
        basr    %r14,%r1               # call schedule
         stnsm   24(%r15),0xfc          # disable I/O and ext. interrupts
-        GET_THREAD_INFO                # load pointer to task_struct to R9
        xc      __TI_precount(4,%r9),__TI_precount(%r9)
        b       BASED(io_resume_loop)
 #endif
@@ -593,7 +535,6 @@ io_reschedule:
         stosm   24(%r15),0x03          # reenable interrupts
        basr    %r14,%r1               # call scheduler
         stnsm   24(%r15),0xfc          # disable I/O and ext. interrupts
-        GET_THREAD_INFO                # load pointer to task_struct to R9
        tm      __TI_flags+3(%r9),_TIF_WORK_INT
        bz      BASED(io_leave)        # there is no work to do
        b       BASED(io_work_loop)
@@ -616,11 +557,10 @@ io_sigpending:
 
         .globl  ext_int_handler
 ext_int_handler:
-       SAVE_ALL_BASE __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
-        SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
        stck    __LC_INT_CLOCK
-       CHECK_CRITICAL
-        GET_THREAD_INFO                # load pointer to task_struct to R9
+       SAVE_ALL_BASE __LC_SAVE_AREA+16
+        SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+16,0
+       l       %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        la      %r2,SP_PTREGS(%r15)    # address of register-save area
        lh      %r3,__LC_EXT_INT_CODE  # get interruption code
        l       %r1,BASED(.Ldo_extint)
@@ -633,12 +573,12 @@ ext_int_handler:
 
         .globl mcck_int_handler
 mcck_int_handler:
-       SAVE_ALL_BASE __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
+       SAVE_ALL_BASE __LC_SAVE_AREA+32
         SAVE_ALL __LC_MCK_OLD_PSW,__LC_SAVE_AREA+32,0
        l       %r1,BASED(.Ls390_mcck)
        basr    %r14,%r1          # call machine check handler
 mcck_return:
-        RESTORE_ALL
+        RESTORE_ALL 0
 
 #ifdef CONFIG_SMP
 /*
@@ -671,50 +611,68 @@ restart_crash:
 restart_go:
 #endif
 
-cleanup_table:
-       .long   system_call, sysc_enter, cleanup_sysc_enter
-       .long   sysc_return, sysc_leave, cleanup_sysc_return
-       .long   sysc_leave, sysc_work_loop, cleanup_sysc_leave
-       .long   sysc_work_loop, sysc_reschedule, cleanup_sysc_return
-cleanup_table_entries=(.-cleanup_table) / 12
+cleanup_table_system_call:
+       .long   system_call + 0x80000000, sysc_do_svc + 0x80000000
+cleanup_table_sysc_return:
+       .long   sysc_return + 0x80000000, sysc_leave + 0x80000000
+cleanup_table_sysc_leave:
+       .long   sysc_leave + 0x80000000, sysc_work_loop + 0x80000000
+cleanup_table_sysc_work_loop:
+       .long   sysc_work_loop + 0x80000000, sysc_reschedule + 0x80000000
 
 cleanup_critical:
-       lhi     %r0,cleanup_table_entries
-       la      %r1,BASED(cleanup_table)
-       l       %r2,SP_PSW+4(%r15)
-       la      %r2,0(%r2)
-cleanup_loop:
-       cl      %r2,0(%r1)
-       bl      BASED(cleanup_cont)
-       cl      %r2,4(%r1)
-       bl      BASED(cleanup_found)
-cleanup_cont:
-       la      %r1,12(%r1)
-       bct     %r0,BASED(cleanup_loop)
+       clc     4(4,%r12),BASED(cleanup_table_system_call)
+       bl      BASED(0f)
+       clc     4(4,%r12),BASED(cleanup_table_system_call+4)
+       bl      BASED(cleanup_system_call)
+0:
+       clc     4(4,%r12),BASED(cleanup_table_sysc_return)
+       bl      BASED(0f)
+       clc     4(4,%r12),BASED(cleanup_table_sysc_return+4)
+       bl      BASED(cleanup_sysc_return)
+0:
+       clc     4(4,%r12),BASED(cleanup_table_sysc_leave)
+       bl      BASED(0f)
+       clc     4(4,%r12),BASED(cleanup_table_sysc_leave+4)
+       bl      BASED(cleanup_sysc_leave)
+0:
+       clc     4(4,%r12),BASED(cleanup_table_sysc_work_loop)
+       bl      BASED(0f)
+       clc     4(4,%r12),BASED(cleanup_table_sysc_work_loop+4)
+       bl      BASED(cleanup_sysc_leave)
+0:
        br      %r14
-cleanup_found:
-       l       %r1,8(%r1)
-       br      %r1
 
-cleanup_sysc_enter:
-       CLEANUP_SAVE_ALL_BASE __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
-       CLEANUP_SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
-       lh      %r0,0x8a
-       st      %r0,SP_R7(%r15)
-       la      %r1,BASED(sysc_enter)
-       o       %r1,BASED(.Lamode)
-       st      %r1,SP_PSW+4(%r15)
+cleanup_system_call:
+       mvc     __LC_RETURN_PSW(4),0(%r12)
+       clc     4(4,%r12),BASED(cleanup_table_system_call)
+       bne     BASED(0f)
+       mvc     __LC_SAVE_AREA(16),__LC_SAVE_AREA+16
+0:     st      %r13,__LC_SAVE_AREA+20
+       SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
+       st      %r15,__LC_SAVE_AREA+28
+       lh      %r7,0x8a
+       mvc     __LC_RETURN_PSW+4(4),BASED(cleanup_table_system_call+4)
+       la      %r12,__LC_RETURN_PSW
        br      %r14
 
 cleanup_sysc_return:
-       la      %r1,BASED(sysc_return)
-       o       %r1,BASED(.Lamode)
-       st      %r1,SP_PSW+4(%r15)
+       mvc     __LC_RETURN_PSW(4),0(%r12)
+       mvc     __LC_RETURN_PSW+4(4),BASED(cleanup_table_sysc_return)
+       la      %r12,__LC_RETURN_PSW
        br      %r14
 
 cleanup_sysc_leave:
-       CLEANUP_RESTORE_ALL
+       clc     4(4,%r12),BASED(cleanup_sysc_leave_lpsw)
+       be      BASED(0f)
+       mvc     __LC_RETURN_PSW(8),SP_PSW(%r15)
+       mvc     __LC_SAVE_AREA+16(16),SP_R12(%r15)
+       lm      %r0,%r11,SP_R0(%r15)
+       l       %r15,SP_R15(%r15)
+0:     la      %r12,__LC_RETURN_PSW
        br      %r14
+cleanup_sysc_leave_lpsw:
+       .long   sysc_leave + 10 + 0x80000000
 
 /*
  * Integer constants
@@ -724,12 +682,11 @@ cleanup_sysc_leave:
 .Lc_overhead:  .long  STACK_FRAME_OVERHEAD
 .Lc_pactive:   .long  PREEMPT_ACTIVE
 .Lnr_syscalls: .long  NR_syscalls
-.L0x018:       .long  0x018
-.L0x020:       .long  0x020
-.L0x028:       .long  0x028
-.L0x030:       .long  0x030
-.L0x038:       .long  0x038
-.Lamode:       .long  0x80000000
+.L0x018:       .short 0x018
+.L0x020:       .short 0x020
+.L0x028:       .short 0x028
+.L0x030:       .short 0x030
+.L0x038:       .short 0x038
 
 /*
  * Symbol constants
index 1874b07..5419009 100644 (file)
@@ -52,6 +52,8 @@ _TIF_WORK_SVC = (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
                 _TIF_RESTART_SVC | _TIF_SINGLE_STEP )
 _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 
+#define BASED(name) name-system_call(%r13)
+
 /*
  * Register usage in interrupt handlers:
  *    R9  - pointer to current task structure
@@ -60,99 +62,52 @@ _TIF_WORK_INT = (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
  *    R15 - kernel stack pointer
  */
 
+        .macro  SAVE_ALL_BASE savearea
+       stmg    %r12,%r15,\savearea
+       larl    %r13,system_call
+       .endm
+
         .macro  SAVE_ALL psworg,savearea,sync
-        stmg    %r13,%r15,\savearea
+       la      %r12,\psworg
        .if     \sync
-        tm      \psworg+1,0x01           # test problem state bit
-        jz      1f                       # skip stack setup save
-       lg      %r15,__LC_KERNEL_STACK   # problem state -> load ksp
+       tm      \psworg+1,0x01          # test problem state bit
+       jz      2f                      # skip stack setup save
+       lg      %r15,__LC_KERNEL_STACK  # problem state -> load ksp
        .else
-        tm      \psworg+1,0x01           # test problem state bit
-       jnz     0f                       # from user -> load kernel stack
-       lg      %r14,__LC_ASYNC_STACK    # are we already on the async. stack ?
+       tm      \psworg+1,0x01          # test problem state bit
+       jnz     1f                      # from user -> load kernel stack
+       clc     \psworg+8(8),BASED(.Lcritical_end)
+       jhe     0f
+       clc     \psworg+8(8),BASED(.Lcritical_start)
+       jl      0f
+       brasl   %r14,cleanup_critical
+       tm      0(%r12),0x01            # retest problem state after cleanup
+       jnz     1f
+0:     lg      %r14,__LC_ASYNC_STACK   # are we already on the async. stack ?
        slgr    %r14,%r15
        srag    %r14,%r14,14
-       jz      1f
-0:     lg      %r15,__LC_ASYNC_STACK    # load async stack
+       jz      2f
+1:     lg      %r15,__LC_ASYNC_STACK   # load async stack
        .endif
-1:      aghi    %r15,-SP_SIZE            # make room for registers & psw
-       lghi    %r14,\psworg
-       slgr    %r13,%r13
-       icm     %r14,12,__LC_SVC_ILC
-        stmg    %r0,%r12,SP_R0(%r15)     # store gprs 0-13 to kernel stack
-        stg     %r2,SP_ORIG_R2(%r15)     # store original content of gpr 2
-        mvc     SP_R13(24,%r15),\savearea # move r13, r14 and r15 to stack
-        mvc     SP_PSW(16,%r15),\psworg  # move user PSW to stack
-       st      %r14,SP_ILC(%r15)
-       stg     %r13,0(%r15)
+2:     aghi    %r15,-SP_SIZE           # make room for registers & psw
+       mvc     SP_PSW(16,%r15),0(%r12) # move user PSW to stack
+       la      %r12,\psworg
+       stg     %r2,SP_ORIG_R2(%r15)    # store original content of gpr 2
+       icm     %r12,12,__LC_SVC_ILC
+       stmg    %r0,%r11,SP_R0(%r15)    # store gprs %r0-%r11 to kernel stack
+       st      %r12,SP_ILC(%r15)
+       mvc     SP_R12(32,%r15),\savearea # move %r12-%r15 to stack
+       la      %r12,0
+       stg     %r12,0(%r15)
         .endm
 
-       .macro  CLEANUP_SAVE_ALL psworg,savearea,sync
-       lg      %r1,SP_PSW+8(%r15)
-       cli     1(%r1),0xdf
-       jne     2f
-       mvc     \savearea(24),SP_R13(%r15)
-2:     lg      %r1,\savearea+16
-       .if     \sync
-       tm      \psworg+1,0x01
-       jz      1f
-       lg      %r1,__LC_KERNEL_STACK
-       .else
-       tm      \psworg+1,0x01
-       jnz     0f
-       lg      %r0,__LC_ASYNC_STACK
-       slgr    %r0,%r1
-       srag    %r0,%r0,14
-       jz      1f
-0:     lg      %r1,__LC_ASYNC_STACK
+       .macro  RESTORE_ALL sync
+       mvc     __LC_RETURN_PSW(16),SP_PSW(%r15) # move user PSW to lowcore
+       .if !\sync
+       ni      __LC_RETURN_PSW+1,0xfd  # clear wait state bit
        .endif
-1:     aghi    %r1,-SP_SIZE
-       stg     %r1,SP_R15(%r15)
-       lghi    %r0,\psworg
-       xc      SP_R13(8,%r15),SP_R13(%r15)
-       icm     %r0,12,__LC_SVC_ILC
-       stg     %r0,SP_R14(%r15)
-       mvc     SP_R0(104,%r1),SP_R0(%r15)
-       mvc     SP_ORIG_R2(8,%r1),SP_R2(%r15)
-       mvc     SP_R13(24,%r1),\savearea
-       mvc     SP_PSW(16,%r1),\psworg
-       st      %r0,SP_ILC(%r1)
-       xc      0(8,%r1),0(%r1)
-       .endm
-
-        .macro  RESTORE_ALL              # system exit macro
-        mvc     __LC_RETURN_PSW(16),SP_PSW(%r15) # move user PSW to lowcore
-        ni      __LC_RETURN_PSW+1,0xfd   # clear wait state bit
-        lmg     %r0,%r15,SP_R0(%r15)     # load gprs 0-15 of user
-        lpswe   __LC_RETURN_PSW          # back to caller
-        .endm
-
-       .macro  CLEANUP_RESTORE_ALL
-       lg      %r1,SP_PSW+8(%r15)
-       cli     0(%r1),0xb2
-       jne     0f
-       mvc     SP_PSW(16,%r15),__LC_RETURN_PSW
-       j       1f
-0:     lg      %r1,SP_R15(%r15)
-       mvc     SP_PSW(16,%r15),SP_PSW(%r1)
-       mvc     SP_R0(128,%r15),SP_R0(%r1)
-1:
-       .endm
-
-        .macro  GET_THREAD_INFO
-       lg      %r9,__LC_THREAD_INFO     # load pointer to thread_info struct
-        .endm
-
-       .macro  CHECK_CRITICAL
-        tm      SP_PSW+1(%r15),0x01      # test problem state bit
-       jnz     0f                       # from user -> not critical
-       larl    %r1,.Lcritical_start
-       clc     SP_PSW+8(8,%r15),8(%r1)  # compare ip with __critical_end
-       jnl     0f
-       clc     SP_PSW+8(8,%r15),0(%r1)  # compare ip with __critical_start
-       jl      0f
-       brasl   %r14,cleanup_critical
-0:
+       lmg     %r0,%r15,SP_R0(%r15)    # load gprs 0-15 of user
+       lpswe   __LC_RETURN_PSW         # back to caller
        .endm
 
 /*
@@ -211,16 +166,15 @@ __critical_start:
 
        .globl  system_call
 system_call:
+       SAVE_ALL_BASE __LC_SAVE_AREA
         SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
        llgh    %r7,__LC_SVC_INT_CODE # get svc number from lowcore
-sysc_enter:
-        GET_THREAD_INFO           # load pointer to task_struct to R9
 sysc_do_svc:
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         slag    %r7,%r7,2         # *4 and test for svc 0
        jnz     sysc_nr_ok
        # svc 0: system call number in %r1
-       lghi    %r0,NR_syscalls
-       clr     %r1,%r0
+       cl      %r1,BASED(.Lnr_syscalls)
        jnl     sysc_nr_ok
        lgfr    %r7,%r1           # clear high word in r1
        slag    %r7,%r7,2         # svc 0: system call number in %r1
@@ -248,13 +202,12 @@ sysc_return:
        tm      __TI_flags+7(%r9),_TIF_WORK_SVC
        jnz     sysc_work         # there is work to do (signals etc.)
 sysc_leave:
-        RESTORE_ALL
+        RESTORE_ALL 1
 
 #
 # recheck if there is more work to do
 #
 sysc_work_loop:
-        GET_THREAD_INFO           # load pointer to task_struct to R9
        tm      __TI_flags+7(%r9),_TIF_WORK_SVC
        jz      sysc_leave        # there is no work to do
 #
@@ -348,8 +301,9 @@ sysc_tracenogo:
 # a new process exits the kernel with ret_from_fork
 #
         .globl  ret_from_fork
-ret_from_fork:  
-        GET_THREAD_INFO           # load pointer to task_struct to R9
+ret_from_fork:
+       lg      %r13,__LC_SVC_NEW_PSW+8
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         brasl   %r14,schedule_tail
         stosm   24(%r15),0x03     # reenable interrupts
        j       sysc_return
@@ -492,15 +446,16 @@ pgm_check_handler:
  * we just ignore the PER event (FIXME: is there anything we have to do
  * for LPSW?).
  */
+       SAVE_ALL_BASE __LC_SAVE_AREA
         tm      __LC_PGM_INT_CODE+1,0x80 # check whether we got a per exception
         jnz     pgm_per                  # got per exception -> special case
        SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        lgf     %r3,__LC_PGM_ILC         # load program interruption code
        lghi    %r8,0x7f
        ngr     %r8,%r3
 pgm_do_call:
         sll     %r8,3
-       GET_THREAD_INFO
         larl    %r1,pgm_check_table
         lg      %r1,0(%r8,%r1)          # load address of handler routine
         la      %r2,SP_PTREGS(%r15)     # address of register-save area
@@ -517,6 +472,7 @@ pgm_per:
         clc     __LC_PGM_OLD_PSW(16),__LC_SVC_NEW_PSW
         je      pgm_svcper
 # no interesting special case, ignore PER event
+       lmg     %r12,%r15,__LC_SAVE_AREA
        lpswe   __LC_PGM_OLD_PSW
 
 #
@@ -524,7 +480,7 @@ pgm_per:
 #
 pgm_per_std:
        SAVE_ALL __LC_PGM_OLD_PSW,__LC_SAVE_AREA,1
-       GET_THREAD_INFO
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        lg      %r1,__TI_task(%r9)
        mvc     __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
        mvc     __THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS
@@ -542,7 +498,7 @@ pgm_per_std:
 pgm_svcper:
        SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
        llgh    %r7,__LC_SVC_INT_CODE   # get svc number from lowcore
-       GET_THREAD_INFO                 # load pointer to task_struct to R9
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        lg      %r1,__TI_task(%r9)
        mvc     __THREAD_per+__PER_atmid(2,%r1),__LC_PER_ATMID
        mvc     __THREAD_per+__PER_address(8,%r1),__LC_PER_ADDRESS
@@ -556,10 +512,10 @@ pgm_svcper:
  */
         .globl io_int_handler
 io_int_handler:
-        SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+32,0
        stck    __LC_INT_CLOCK
-       CHECK_CRITICAL
-        GET_THREAD_INFO                # load pointer to task_struct to R9
+       SAVE_ALL_BASE __LC_SAVE_AREA+32
+        SAVE_ALL __LC_IO_OLD_PSW,__LC_SAVE_AREA+32,0
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
         la      %r2,SP_PTREGS(%r15)    # address of register-save area
        brasl   %r14,do_IRQ            # call standard irq handler
 
@@ -573,7 +529,7 @@ io_return:
        tm      __TI_flags+7(%r9),_TIF_WORK_INT
        jnz     io_work                # there is work to do (signals etc.)
 io_leave:
-        RESTORE_ALL
+        RESTORE_ALL 0
 
 #ifdef CONFIG_PREEMPT
 io_preempt:
@@ -593,7 +549,6 @@ io_resume_loop:
         stosm   48(%r15),0x03          # reenable interrupts
        brasl   %r14,schedule          # call schedule
         stnsm   48(%r15),0xfc          # disable I/O and ext. interrupts
-        GET_THREAD_INFO                # load pointer to task_struct to R9
        xc      __TI_precount(4,%r9),__TI_precount(%r9)
        j       io_resume_loop
 #endif
@@ -625,7 +580,6 @@ io_reschedule:
         stosm   48(%r15),0x03       # reenable interrupts
         brasl   %r14,schedule       # call scheduler
         stnsm   48(%r15),0xfc       # disable I/O and ext. interrupts
-        GET_THREAD_INFO             # load pointer to task_struct to R9
        tm      __TI_flags+7(%r9),_TIF_WORK_INT
        jz      io_leave               # there is no work to do
        j       io_work_loop
@@ -646,10 +600,10 @@ io_sigpending:
  */
         .globl  ext_int_handler
 ext_int_handler:
-        SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32,0
-       CHECK_CRITICAL
-        GET_THREAD_INFO                # load pointer to task_struct to R9
        stck    __LC_INT_CLOCK
+       SAVE_ALL_BASE __LC_SAVE_AREA+32
+        SAVE_ALL __LC_EXT_OLD_PSW,__LC_SAVE_AREA+32,0
+       lg      %r9,__LC_THREAD_INFO    # load pointer to thread_info struct
        la      %r2,SP_PTREGS(%r15)    # address of register-save area
        llgh    %r3,__LC_EXT_INT_CODE  # get interruption code
        brasl   %r14,do_extint
@@ -660,10 +614,11 @@ ext_int_handler:
  */
         .globl mcck_int_handler
 mcck_int_handler:
+       SAVE_ALL_BASE __LC_SAVE_AREA+64
         SAVE_ALL __LC_MCK_OLD_PSW,__LC_SAVE_AREA+64,0
        brasl   %r14,s390_do_machine_check
 mcck_return:
-        RESTORE_ALL
+        RESTORE_ALL 0
 
 #ifdef CONFIG_SMP
 /*
@@ -694,46 +649,68 @@ restart_crash:
 restart_go:
 #endif
 
-cleanup_table:
-       .quad   system_call, sysc_enter, cleanup_sysc_enter
-       .quad   sysc_return, sysc_leave, cleanup_sysc_return
-       .quad   sysc_leave, sysc_work_loop, cleanup_sysc_leave
-       .quad   sysc_work_loop, sysc_reschedule, cleanup_sysc_return
-cleanup_table_entries=(.-cleanup_table) / 24
+cleanup_table_system_call:
+       .quad   system_call, sysc_do_svc
+cleanup_table_sysc_return:
+       .quad   sysc_return, sysc_leave
+cleanup_table_sysc_leave:
+       .quad   sysc_leave, sysc_work_loop
+cleanup_table_sysc_work_loop:
+       .quad   sysc_work_loop, sysc_reschedule
 
 cleanup_critical:
-       lghi    %r0,cleanup_table_entries
-       larl    %r1,cleanup_table
-       lg      %r2,SP_PSW+8(%r15)
-cleanup_loop:
-       clg     %r2,0(%r1)
-       jl      cleanup_cont
-       clg     %r2,8(%r1)
-       jl      cleanup_found
-cleanup_cont:
-       la      %r1,24(%r1)
-       brct    %r0,cleanup_loop
+       clc     8(8,%r12),BASED(cleanup_table_system_call)
+       jl      0f
+       clc     8(8,%r12),BASED(cleanup_table_system_call+8)
+       jl      cleanup_system_call
+0:
+       clc     8(8,%r12),BASED(cleanup_table_sysc_return)
+       jl      0f
+       clc     8(8,%r12),BASED(cleanup_table_sysc_return+8)
+       jl      cleanup_sysc_return
+0:
+       clc     8(8,%r12),BASED(cleanup_table_sysc_leave)
+       jl      0f
+       clc     8(8,%r12),BASED(cleanup_table_sysc_leave+8)
+       jl      cleanup_sysc_leave
+0:
+       clc     8(8,%r12),BASED(cleanup_table_sysc_work_loop)
+       jl      0f
+       clc     8(8,%r12),BASED(cleanup_table_sysc_work_loop+8)
+       jl      cleanup_sysc_leave
+0:
        br      %r14
-cleanup_found:
-       lg      %r1,16(%r1)
-       br      %r1
-
-cleanup_sysc_enter:
-       CLEANUP_SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
-       llgh    %r0,0x8a
-       stg     %r0,SP_R7(%r15)
-       larl    %r1,sysc_enter
-       stg     %r1,SP_PSW+8(%r15)
+
+cleanup_system_call:
+       mvc     __LC_RETURN_PSW(8),0(%r12)
+       clc     8(8,%r12),BASED(cleanup_table_system_call)
+       jne     0f
+       mvc     __LC_SAVE_AREA(32),__LC_SAVE_AREA+32
+0:     stg     %r13,__LC_SAVE_AREA+40
+       SAVE_ALL __LC_SVC_OLD_PSW,__LC_SAVE_AREA,1
+       stg     %r15,__LC_SAVE_AREA+56
+       llgh    %r7,__LC_SVC_INT_CODE
+       mvc     __LC_RETURN_PSW+8(8),BASED(cleanup_table_system_call+8)
+       la      %r12,__LC_RETURN_PSW
        br      %r14
 
 cleanup_sysc_return:
-       larl    %r1,sysc_return
-       stg     %r1,SP_PSW+8(%r15)
+       mvc     __LC_RETURN_PSW(8),0(%r12)
+       mvc     __LC_RETURN_PSW+8(8),BASED(cleanup_table_sysc_return)
+       la      %r12,__LC_RETURN_PSW
        br      %r14
 
 cleanup_sysc_leave:
-       CLEANUP_RESTORE_ALL
+       clc     8(8,%r12),BASED(cleanup_sysc_leave_lpsw)
+       je      0f
+       mvc     __LC_RETURN_PSW(16),SP_PSW(%r15)
+       mvc     __LC_SAVE_AREA+32(32),SP_R12(%r15)
+       lmg     %r0,%r11,SP_R0(%r15)
+       lg      %r15,SP_R15(%r15)
+0:     la      %r12,__LC_RETURN_PSW
        br      %r14
+cleanup_sysc_leave_lpsw:
+       .quad   sysc_leave + 12
 
 /*
  * Integer constants
@@ -741,6 +718,12 @@ cleanup_sysc_leave:
                .align 4
 .Lconst:
 .Lc_pactive:   .long  PREEMPT_ACTIVE
+.Lnr_syscalls: .long  NR_syscalls
+.L0x0130:      .short 0x130
+.L0x0140:      .short 0x140
+.L0x0150:      .short 0x150
+.L0x0160:      .short 0x160
+.L0x0170:      .short 0x170
 .Lcritical_start:
                .quad  __critical_start
 .Lcritical_end:
index cada0f7..6e35d53 100644 (file)
@@ -553,6 +553,19 @@ do_ptrace_emu31(struct task_struct *child, long request, long addr, long data)
                        copied += sizeof(unsigned int);
                }
                return 0;
+       case PTRACE_GETEVENTMSG:
+               return put_user((__u32) child->ptrace_message,
+                               (unsigned int __user *) data);
+       case PTRACE_GETSIGINFO:
+               if (child->last_siginfo == NULL)
+                       return -EINVAL;
+               return copy_siginfo_to_user32((siginfo_t32 __user *) data,
+                                             child->last_siginfo);
+       case PTRACE_SETSIGINFO:
+               if (child->last_siginfo == NULL)
+                       return -EINVAL;
+               return copy_siginfo_from_user32(child->last_siginfo,
+                                               (siginfo_t32 __user *) data);
        }
        return ptrace_request(child, request, addr, data);
 }
index f8583ca..aa9a42b 100644 (file)
@@ -2,6 +2,6 @@
 # Makefile for the linux s390-specific parts of the memory manager.
 #
 
-obj-y   := init.o fault.o ioremap.o extmem.o
+obj-y   := init.o fault.o ioremap.o extmem.o mmap.o
 obj-$(CONFIG_CMM) += cmm.o
 
index 72d4f1e..cb29503 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <asm/pgalloc.h>
 #include <asm/uaccess.h>
+#include <asm/smp.h>
 
 #include "../../../drivers/s390/net/smsgiucv.h"
 
@@ -255,13 +256,13 @@ static struct ctl_table cmm_table[];
 
 static int
 cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
-                 void *buffer, size_t *lenp)
+                 void *buffer, size_t *lenp, loff_t *ppos)
 {
        char buf[16], *p;
        long pages;
        int len;
 
-       if (!*lenp || (filp->f_pos && !write)) {
+       if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -290,19 +291,19 @@ cmm_pages_handler(ctl_table *ctl, int write, struct file *filp,
                        return -EFAULT;
        }
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
 static int
 cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
-                   void *buffer, size_t *lenp)
+                   void *buffer, size_t *lenp, loff_t *ppos)
 {
        char buf[64], *p;
        long pages, seconds;
        int len;
 
-       if (!*lenp || (filp->f_pos && !write)) {
+       if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -327,7 +328,7 @@ cmm_timeout_handler(ctl_table *ctl, int write, struct file *filp,
                        return -EFAULT;
        }
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
index 4b3dd85..02ce6cc 100644 (file)
@@ -83,6 +83,7 @@ config HW_CONSOLE
 
 config SMP
        bool "Symmetric multi-processing support (does not work on sun4/sun4c)"
+       depends on BROKEN
        ---help---
          This enables support for systems with more than one CPU. If you have
          a system with only one CPU, like most personal computers, say N. If
@@ -221,6 +222,7 @@ config SUN_PM
 
 config SUN4
        bool "Support for SUN4 machines (disables SUN4[CDM] support)"
+       depends on !SMP
        help
          Say Y here if, and only if, your machine is a sun4. Note that
          a kernel compiled with this option will run only on sun4.
index 1a68817..a698562 100644 (file)
@@ -292,7 +292,6 @@ CONFIG_SCTP_HMAC_MD5=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index fd065fb..46591a1 100644 (file)
@@ -45,6 +45,7 @@ int smp_activated = 0;
 volatile int __cpu_number_map[NR_CPUS];
 volatile int __cpu_logical_map[NR_CPUS];
 cycles_t cacheflush_time = 0; /* XXX */
+unsigned long cache_decay_ticks = 100;
 
 cpumask_t cpu_online_map = CPU_MASK_NONE;
 cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
@@ -203,6 +204,11 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
        }
 }
 
+void smp_reschedule_irq(void)
+{
+       set_need_resched();
+}
+
 void smp_flush_page_to_ram(unsigned long page)
 {
        /* Current theory is that those who call this are the one's
index 01587b1..f2fc64e 100644 (file)
@@ -95,8 +95,6 @@ void __init smp4m_callin(void)
         * the SMP initialization the master will be just allowed
         * to call the scheduler code.
         */
-       init_idle();
-
        /* Allow master to continue. */
        swap((unsigned long *)&cpu_callin_map[cpuid], 1);
 
@@ -126,7 +124,6 @@ void __init smp4m_callin(void)
 extern int cpu_idle(void *unused);
 extern void init_IRQ(void);
 extern void cpu_panic(void);
-extern int start_secondary(void *unused);
 
 /*
  *     Cycle through the processors asking the PROM to start each one.
@@ -460,9 +457,9 @@ void __init smp4m_blackbox_current(unsigned *addr)
 
 void __init sun4m_init_smp(void)
 {
-       BTFIXUPSET_BLACKBOX(smp_processor_id, smp4m_blackbox_id);
+       BTFIXUPSET_BLACKBOX(hard_smp_processor_id, smp4m_blackbox_id);
        BTFIXUPSET_BLACKBOX(load_current, smp4m_blackbox_current);
        BTFIXUPSET_CALL(smp_cross_call, smp4m_cross_call, BTFIXUPCALL_NORM);
        BTFIXUPSET_CALL(smp_message_pass, smp4m_message_pass, BTFIXUPCALL_NORM);
-       BTFIXUPSET_CALL(__smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM);
+       BTFIXUPSET_CALL(__hard_smp_processor_id, __smp4m_processor_id, BTFIXUPCALL_NORM);
 }
index 16745a2..0787907 100644 (file)
@@ -333,7 +333,7 @@ asmlinkage unsigned long sparc_mremap(unsigned long addr,
 
                new_addr = get_unmapped_area(file, addr, new_len,
                                     vma ? vma->vm_pgoff : 0,
-                                    map_flags, vma->vm_flags & VM_EXEC);
+                                    map_flags);
                ret = new_addr;
                if (new_addr & ~PAGE_MASK)
                        goto out_sem;
index 5715671..c85f8f2 100644 (file)
@@ -139,7 +139,7 @@ config CPU_FREQ
          fly.  Currently there are only sparc64 drivers for UltraSPARC-III
          and UltraSPARC-IIe processors.
 
-         For details, take a look at linux/Documentation/cpu-freq.
+         For details, take a look at <file:Documentation/cpu-freq>.
 
          If in doubt, say N.
 
@@ -159,7 +159,7 @@ config US3_FREQ
        help
          This adds the CPUFreq driver for UltraSPARC-III processors.
 
-         For details, take a look at linux/Documentation/cpu-freq.
+         For details, take a look at <file:Documentation/cpu-freq>.
 
          If in doubt, say N.
 
@@ -169,7 +169,7 @@ config US2E_FREQ
        help
          This adds the CPUFreq driver for UltraSPARC-IIe processors.
 
-         For details, take a look at linux/Documentation/cpu-freq.
+         For details, take a look at <file:Documentation/cpu-freq>.
 
          If in doubt, say N.
 
@@ -382,6 +382,7 @@ source "fs/Kconfig.binfmt"
 
 config SUNOS_EMUL
        bool "SunOS binary emulation"
+       depends on BINFMT_AOUT32
        help
          This allows you to run most SunOS binaries.  If you want to do this,
          say Y here and place appropriate files in /usr/gnemul/sunos. See
@@ -391,7 +392,7 @@ config SUNOS_EMUL
 
 config SOLARIS_EMUL
        tristate "Solaris binary emulation (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
+       depends on SPARC32_COMPAT && EXPERIMENTAL
        help
          This is experimental code which will enable you to run (many)
          Solaris binaries on your SPARC Linux machine.
index d998139..7fa2d47 100644 (file)
@@ -9,7 +9,6 @@ CONFIG_MMU=y
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 
 #
 # General setup
@@ -90,7 +89,6 @@ CONFIG_BINFMT_ELF32=y
 # CONFIG_BINFMT_AOUT32 is not set
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
-# CONFIG_SUNOS_EMUL is not set
 CONFIG_SOLARIS_EMUL=m
 
 #
@@ -111,6 +109,7 @@ CONFIG_DISPLAY7SEG=m
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 CONFIG_FW_LOADER=m
 # CONFIG_DEBUG_DRIVER is not set
@@ -122,7 +121,6 @@ CONFIG_FB=y
 # CONFIG_FB_CIRRUS is not set
 CONFIG_FB_PM2=y
 # CONFIG_FB_PM2_FIFO_DISCONNECT is not set
-# CONFIG_FB_CYBER2000 is not set
 # CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 # CONFIG_FB_BW2 is not set
@@ -180,7 +178,6 @@ CONFIG_LOGO_SUN_CLUT224=y
 #
 # Serial drivers
 #
-# CONFIG_SERIAL_8250 is not set
 
 #
 # Non-8250 serial port support
@@ -201,8 +198,6 @@ CONFIG_SUN_OPENPROMIO=m
 CONFIG_SUN_MOSTEK_RTC=y
 CONFIG_OBP_FLASH=m
 # CONFIG_SUN_BPP is not set
-# CONFIG_SUN_VIDEOPIX is not set
-# CONFIG_SUN_AURORA is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -344,12 +339,9 @@ CONFIG_SCSI_SATA_SIL=m
 CONFIG_SCSI_SATA_SIS=m
 CONFIG_SCSI_SATA_VIA=m
 CONFIG_SCSI_SATA_VITESSE=m
-# CONFIG_SCSI_BUSLOGIC is not set
 CONFIG_SCSI_DMX3191D=m
-# CONFIG_SCSI_EATA is not set
 CONFIG_SCSI_EATA_PIO=m
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_GDTH is not set
 CONFIG_SCSI_IPS=m
 CONFIG_SCSI_INIA100=m
 CONFIG_SCSI_PPA=m
@@ -377,7 +369,7 @@ CONFIG_SCSI_QLA2XXX=y
 # CONFIG_SCSI_QLA6312 is not set
 # CONFIG_SCSI_QLA6322 is not set
 CONFIG_SCSI_DC395x=m
-CONFIG_SCSI_DC390T=m
+# CONFIG_SCSI_DC390T is not set
 CONFIG_SCSI_DEBUG=m
 CONFIG_SCSI_SUNESP=y
 
@@ -676,13 +668,15 @@ CONFIG_LAPB=m
 CONFIG_NET_DIVERT=y
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 CONFIG_NET_SCHED=y
+# CONFIG_NET_SCH_CLK_JIFFIES is not set
+# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
+CONFIG_NET_SCH_CLK_CPU=y
 CONFIG_NET_SCH_CBQ=m
 CONFIG_NET_SCH_HTB=m
 CONFIG_NET_SCH_HFSC=m
@@ -915,7 +909,6 @@ CONFIG_NET_RADIO=y
 #
 # Wireless 802.11b ISA/PCI cards support
 #
-CONFIG_AIRO=m
 CONFIG_HERMES=m
 CONFIG_PLX_HERMES=m
 CONFIG_TMD_HERMES=m
@@ -1132,12 +1125,15 @@ CONFIG_I2C_VOODOO3=m
 #
 CONFIG_I2C_SENSOR=m
 CONFIG_SENSORS_ADM1021=m
+CONFIG_SENSORS_ADM1025=m
+CONFIG_SENSORS_ADM1031=m
 CONFIG_SENSORS_ASB100=m
 CONFIG_SENSORS_DS1621=m
 CONFIG_SENSORS_FSCHER=m
 CONFIG_SENSORS_GL518SM=m
 CONFIG_SENSORS_IT87=m
 CONFIG_SENSORS_LM75=m
+CONFIG_SENSORS_LM77=m
 CONFIG_SENSORS_LM78=m
 CONFIG_SENSORS_LM80=m
 CONFIG_SENSORS_LM83=m
@@ -1270,6 +1266,7 @@ CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
 CONFIG_CIFS=m
 # CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_XATTR is not set
 CONFIG_CIFS_POSIX=y
 CONFIG_NCP_FS=m
 # CONFIG_NCPFS_PACKET_SIGNING is not set
@@ -1522,11 +1519,6 @@ CONFIG_SND_VX222=m
 CONFIG_SND_SUN_AMD7930=m
 CONFIG_SND_SUN_CS4231=m
 
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
 #
 # USB support
 #
@@ -1606,6 +1598,7 @@ CONFIG_USB_HPUSBSCSI=m
 # CONFIG_USB_OV511 is not set
 CONFIG_USB_PWC=m
 # CONFIG_USB_SE401 is not set
+CONFIG_USB_SN9C102=m
 # CONFIG_USB_STV680 is not set
 CONFIG_USB_W9968CF=m
 
@@ -1777,6 +1770,7 @@ CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
 CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_KHAZAD=m
 CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_CRC32C=m
index d2d37d9..2a85819 100644 (file)
@@ -248,10 +248,10 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                loff_t pos = fd_offset;
                /* Fuck me plenty... */
                error = do_brk(N_TXTADDR(ex), ex.a_text);
-               bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex),
+               bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex),
                          ex.a_text, &pos);
                error = do_brk(N_DATADDR(ex), ex.a_data);
-               bprm->file->f_op->read(bprm->file, (char *) N_DATADDR(ex),
+               bprm->file->f_op->read(bprm->file, (char __user *)N_DATADDR(ex),
                          ex.a_data, &pos);
                goto beyond_if;
        }
@@ -260,7 +260,7 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                loff_t pos = fd_offset;
                do_brk(N_TXTADDR(ex) & PAGE_MASK,
                        ex.a_text+ex.a_data + PAGE_SIZE - 1);
-               bprm->file->f_op->read(bprm->file, (char *) N_TXTADDR(ex),
+               bprm->file->f_op->read(bprm->file, (char __user *)N_TXTADDR(ex),
                          ex.a_text+ex.a_data, &pos);
        } else {
                static unsigned long error_time;
@@ -274,7 +274,8 @@ static int load_aout32_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                if (!bprm->file->f_op->mmap) {
                        loff_t pos = fd_offset;
                        do_brk(0, ex.a_text+ex.a_data);
-                       bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex),
+                       bprm->file->f_op->read(bprm->file,
+                                 (char __user *)N_TXTADDR(ex),
                                  ex.a_text+ex.a_data, &pos);
                        goto beyond_if;
                }
index fb3dff0..1462b24 100644 (file)
@@ -1496,28 +1496,30 @@ sunos_getgid:
        /* SunOS's execv() call only specifies the argv argument, the
         * environment settings are the same as the calling processes.
         */
-       .globl  sunos_execv, sys_execve, sys32_execve
+       .globl  sunos_execv
 sys_execve:
        sethi           %hi(sparc_execve), %g1
        ba,pt           %xcc, execve_merge
         or             %g1, %lo(sparc_execve), %g1
+#ifdef CONFIG_COMPAT
+       .globl  sys_execve
 sunos_execv:
        stx             %g0, [%sp + PTREGS_OFF + PT_V9_I2]
+       .globl  sys32_execve
 sys32_execve:
        sethi           %hi(sparc32_execve), %g1
        or              %g1, %lo(sparc32_execve), %g1
+#endif
 execve_merge:
        flushw
        jmpl            %g1, %g0
         add            %sp, PTREGS_OFF, %o0
 
        .globl  sys_pipe, sys_sigpause, sys_nis_syscall
-       .globl  sys_sigsuspend, sys_rt_sigsuspend, sys32_rt_sigsuspend
+       .globl  sys_sigsuspend, sys_rt_sigsuspend
        .globl  sys_rt_sigreturn
-       .globl  sys32_sigreturn, sys32_rt_sigreturn
-       .globl  sys32_execve, sys_ptrace
-       .globl  sys_sigaltstack, sys32_sigaltstack
-       .globl  sys32_sigstack
+       .globl  sys_ptrace
+       .globl  sys_sigaltstack
        .align  32
 sys_pipe:      ba,pt           %xcc, sparc_pipe
                 add            %sp, PTREGS_OFF, %o0
@@ -1528,12 +1530,15 @@ sys_memory_ordering:
                 add            %sp, PTREGS_OFF, %o1
 sys_sigaltstack:ba,pt          %xcc, do_sigaltstack
                 add            %i6, STACK_BIAS, %o2
+#ifdef CONFIG_COMPAT
+       .globl  sys32_sigstack
 sys32_sigstack:        ba,pt           %xcc, do_sys32_sigstack
                 mov            %i6, %o2
+       .globl  sys32_sigaltstack
 sys32_sigaltstack:
                ba,pt           %xcc, do_sys32_sigaltstack
                 mov            %i6, %o2
-
+#endif
                .align          32
 sys_sigsuspend:        add             %sp, PTREGS_OFF, %o0
                call            do_sigsuspend
@@ -1544,31 +1549,40 @@ sys_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
                call            do_rt_sigsuspend
                 add            %o7, 1f-.-4, %o7
                nop
+#ifdef CONFIG_COMPAT
+       .globl  sys32_rt_sigsuspend
 sys32_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
                srl             %o0, 0, %o0
                add             %sp, PTREGS_OFF, %o2
                call            do_rt_sigsuspend32
                 add            %o7, 1f-.-4, %o7
+#endif
                /* NOTE: %o0 has a correct value already */
 sys_sigpause:  add             %sp, PTREGS_OFF, %o1
                call            do_sigpause
                 add            %o7, 1f-.-4, %o7
                nop
+#ifdef CONFIG_COMPAT
+       .globl  sys32_sigreturn
 sys32_sigreturn:
                add             %sp, PTREGS_OFF, %o0
                call            do_sigreturn32
                 add            %o7, 1f-.-4, %o7
                nop
+#endif
 sys_rt_sigreturn:
                add             %sp, PTREGS_OFF, %o0
                call            do_rt_sigreturn
                 add            %o7, 1f-.-4, %o7
                nop
+#ifdef CONFIG_COMPAT
+       .globl  sys32_rt_sigreturn
 sys32_rt_sigreturn:
                add             %sp, PTREGS_OFF, %o0
                call            do_rt_sigreturn32
                 add            %o7, 1f-.-4, %o7
                nop
+#endif
 sys_ptrace:    add             %sp, PTREGS_OFF, %o0
                call            do_ptrace
                 add            %o7, 1f-.-4, %o7
index 14de65b..01c8869 100644 (file)
@@ -522,8 +522,6 @@ cheetah_tlb_fixup:
        /* Patch copy/page operations to cheetah optimized versions. */
        call    cheetah_patch_copyops
         nop
-       call    cheetah_patch_pgcopyops
-        nop
        call    cheetah_patch_cachetlbops
         nop
 
index 912e04c..af8eb0b 100644 (file)
@@ -25,7 +25,7 @@
 /* Use this to get at 32-bit user passed pointers. 
  * See sys_sparc32.c for description about it.
  */
-#define A(__x) ((void __user *)(unsigned long)(__x))
+#define A(__x) compat_ptr(__x)
 
 static __inline__ void *alloc_user_space(long len)
 {
@@ -54,39 +54,21 @@ struct  fbcmap32 {
 
 static int fbiogetputcmap(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-       struct fbcmap f;
+       struct fbcmap32 __user *argp = (void __user *)arg;
+       struct fbcmap __user *p = compat_alloc_user_space(sizeof(*p));
+       u32 addr;
        int ret;
-       char red[256], green[256], blue[256];
-       u32 r, g, b;
-       mm_segment_t old_fs = get_fs();
        
-       ret = get_user(f.index, &(((struct fbcmap32 __user *)arg)->index));
-       ret |= __get_user(f.count, &(((struct fbcmap32 __user *)arg)->count));
-       ret |= __get_user(r, &(((struct fbcmap32 __user *)arg)->red));
-       ret |= __get_user(g, &(((struct fbcmap32 __user *)arg)->green));
-       ret |= __get_user(b, &(((struct fbcmap32 __user *)arg)->blue));
+       ret = copy_in_user(p, argp, 2 * sizeof(int));
+       ret |= get_user(addr, &argp->red);
+       ret |= put_user(compat_ptr(addr), &p->red);
+       ret |= get_user(addr, &argp->green);
+       ret |= put_user(compat_ptr(addr), &p->green);
+       ret |= get_user(addr, &argp->blue);
+       ret |= put_user(compat_ptr(addr), &p->blue);
        if (ret)
                return -EFAULT;
-       if ((f.index < 0) || (f.index > 255)) return -EINVAL;
-       if (f.index + f.count > 256)
-               f.count = 256 - f.index;
-       if (cmd == FBIOPUTCMAP32) {
-               ret = copy_from_user (red, A(r), f.count);
-               ret |= copy_from_user (green, A(g), f.count);
-               ret |= copy_from_user (blue, A(b), f.count);
-               if (ret)
-                       return -EFAULT;
-       }
-       f.red = red; f.green = green; f.blue = blue;
-       set_fs (KERNEL_DS);
-       ret = sys_ioctl (fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (long)&f);
-       set_fs (old_fs);
-       if (!ret && cmd == FBIOGETCMAP32) {
-               ret = copy_to_user (A(r), red, f.count);
-               ret |= copy_to_user (A(g), green, f.count);
-               ret |= copy_to_user (A(b), blue, f.count);
-       }
-       return ret ? -EFAULT : 0;
+       return sys_ioctl(fd, (cmd == FBIOPUTCMAP32) ? FBIOPUTCMAP_SPARC : FBIOGETCMAP_SPARC, (unsigned long)p);
 }
 
 struct fbcursor32 {
@@ -105,52 +87,28 @@ struct fbcursor32 {
 
 static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-       struct fbcursor f;
+       struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
+       struct fbcursor32 __user *argp =  (void __user *)arg;
+       compat_uptr_t addr;
        int ret;
-       char red[2], green[2], blue[2];
-       char image[128], mask[128];
-       u32 r, g, b;
-       u32 m, i;
-       mm_segment_t old_fs = get_fs();
        
-       ret = copy_from_user (&f, (struct fbcursor32 __user *) arg,
+       ret = copy_in_user(p, argp,
                              2 * sizeof (short) + 2 * sizeof(struct fbcurpos));
-       ret |= __get_user(f.size.x,
-                         &(((struct fbcursor32 __user *)arg)->size.x));
-       ret |= __get_user(f.size.y,
-                         &(((struct fbcursor32 __user *)arg)->size.y));
-       ret |= __get_user(f.cmap.index,
-                         &(((struct fbcursor32 __user *)arg)->cmap.index));
-       ret |= __get_user(f.cmap.count,
-                         &(((struct fbcursor32 __user *)arg)->cmap.count));
-       ret |= __get_user(r, &(((struct fbcursor32 __user *)arg)->cmap.red));
-       ret |= __get_user(g, &(((struct fbcursor32 __user *)arg)->cmap.green));
-       ret |= __get_user(b, &(((struct fbcursor32 __user *)arg)->cmap.blue));
-       ret |= __get_user(m, &(((struct fbcursor32 __user *)arg)->mask));
-       ret |= __get_user(i, &(((struct fbcursor32 __user *)arg)->image));
+       ret |= copy_in_user(&p->size, &argp->size, sizeof(struct fbcurpos));
+       ret |= copy_in_user(&p->cmap, &argp->cmap, 2 * sizeof(int));
+       ret |= get_user(addr, &argp->cmap.red);
+       ret |= put_user(compat_ptr(addr), &p->cmap.red);
+       ret |= get_user(addr, &argp->cmap.green);
+       ret |= put_user(compat_ptr(addr), &p->cmap.green);
+       ret |= get_user(addr, &argp->cmap.blue);
+       ret |= put_user(compat_ptr(addr), &p->cmap.blue);
+       ret |= get_user(addr, &argp->mask);
+       ret |= put_user(compat_ptr(addr), &p->mask);
+       ret |= get_user(addr, &argp->image);
+       ret |= put_user(compat_ptr(addr), &p->image);
        if (ret)
                return -EFAULT;
-       if (f.set & FB_CUR_SETCMAP) {
-               if ((uint) f.size.y > 32)
-                       return -EINVAL;
-               ret = copy_from_user (mask, A(m), f.size.y * 4);
-               ret |= copy_from_user (image, A(i), f.size.y * 4);
-               if (ret)
-                       return -EFAULT;
-               f.image = image; f.mask = mask;
-       }
-       if (f.set & FB_CUR_SETCMAP) {
-               ret = copy_from_user (red, A(r), 2);
-               ret |= copy_from_user (green, A(g), 2);
-               ret |= copy_from_user (blue, A(b), 2);
-               if (ret)
-                       return -EFAULT;
-               f.cmap.red = red; f.cmap.green = green; f.cmap.blue = blue;
-       }
-       set_fs (KERNEL_DS);
-       ret = sys_ioctl (fd, FBIOSCURSOR, (long)&f);
-       set_fs (old_fs);
-       return ret;
+       return sys_ioctl (fd, FBIOSCURSOR, (unsigned long)p);
 }
 
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
@@ -173,72 +131,40 @@ typedef struct drm32_version {
 static int drm32_version(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_version_t __user *uversion = (drm32_version_t __user *)arg;
-       char __user *name_ptr, *date_ptr, *desc_ptr;
-       u32 tmp1, tmp2, tmp3;
-       drm_version_t kversion;
-       mm_segment_t old_fs;
+       drm_version_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
+       int n;
        int ret;
 
-       memset(&kversion, 0, sizeof(kversion));
-       if (get_user(kversion.name_len, &uversion->name_len) ||
-           get_user(kversion.date_len, &uversion->date_len) ||
-           get_user(kversion.desc_len, &uversion->desc_len) ||
-           get_user(tmp1, &uversion->name) ||
-           get_user(tmp2, &uversion->date) ||
-           get_user(tmp3, &uversion->desc))
+       if (clear_user(p, 3 * sizeof(int)) ||
+           get_user(n, &uversion->name_len) ||
+           put_user(n, &p->name_len) ||
+           get_user(addr, &uversion->name) ||
+           put_user(compat_ptr(addr), &p->name) ||
+           get_user(n, &uversion->date_len) ||
+           put_user(n, &p->date_len) ||
+           get_user(addr, &uversion->date) ||
+           put_user(compat_ptr(addr), &p->date) ||
+           get_user(n, &uversion->desc_len) ||
+           put_user(n, &p->desc_len) ||
+           get_user(addr, &uversion->desc) ||
+           put_user(compat_ptr(addr), &p->desc))
                return -EFAULT;
 
-       name_ptr = A(tmp1);
-       date_ptr = A(tmp2);
-       desc_ptr = A(tmp3);
-
-       ret = -ENOMEM;
-       if (kversion.name_len && name_ptr) {
-               kversion.name = kmalloc(kversion.name_len, GFP_KERNEL);
-               if (!kversion.name)
-                       goto out;
-       }
-       if (kversion.date_len && date_ptr) {
-               kversion.date = kmalloc(kversion.date_len, GFP_KERNEL);
-               if (!kversion.date)
-                       goto out;
-       }
-       if (kversion.desc_len && desc_ptr) {
-               kversion.desc = kmalloc(kversion.desc_len, GFP_KERNEL);
-               if (!kversion.desc)
-                       goto out;
-       }
-
-        old_fs = get_fs();
-       set_fs(KERNEL_DS);
-        ret = sys_ioctl (fd, DRM_IOCTL_VERSION, (unsigned long)&kversion);
-        set_fs(old_fs);
-
-       if (!ret) {
-               if ((kversion.name &&
-                    copy_to_user(name_ptr, kversion.name, kversion.name_len)) ||
-                   (kversion.date &&
-                    copy_to_user(date_ptr, kversion.date, kversion.date_len)) ||
-                   (kversion.desc &&
-                    copy_to_user(desc_ptr, kversion.desc, kversion.desc_len)))
-                       ret = -EFAULT;
-               if (put_user(kversion.version_major, &uversion->version_major) ||
-                   put_user(kversion.version_minor, &uversion->version_minor) ||
-                   put_user(kversion.version_patchlevel, &uversion->version_patchlevel) ||
-                   put_user(kversion.name_len, &uversion->name_len) ||
-                   put_user(kversion.date_len, &uversion->date_len) ||
-                   put_user(kversion.desc_len, &uversion->desc_len))
-                       ret = -EFAULT;
-       }
+        ret = sys_ioctl(fd, DRM_IOCTL_VERSION, (unsigned long)p);
+       if (ret)
+               return ret;
+
+       if (copy_in_user(uversion, p, 3 * sizeof(int)) ||
+           get_user(n, &p->name_len) ||
+           put_user(n, &uversion->name_len) ||
+           get_user(n, &p->date_len) ||
+           put_user(n, &uversion->date_len) ||
+           get_user(n, &p->desc_len) ||
+           put_user(n, &uversion->desc_len))
+               return -EFAULT;
 
-out:
-       if (kversion.name)
-               kfree(kversion.name);
-       if (kversion.date)
-               kfree(kversion.date);
-       if (kversion.desc)
-               kfree(kversion.desc);
-       return ret;
+       return 0;
 }
 
 typedef struct drm32_unique {
@@ -251,53 +177,29 @@ typedef struct drm32_unique {
 static int drm32_getsetunique(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_unique_t __user *uarg = (drm32_unique_t __user *)arg;
-       drm_unique_t karg;
-       mm_segment_t old_fs;
-       char __user *uptr;
-       u32 tmp;
+       drm_unique_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
+       int n;
        int ret;
 
-       if (get_user(karg.unique_len, &uarg->unique_len))
+       if (get_user(n, &uarg->unique_len) ||
+           put_user(n, &p->unique_len) ||
+           get_user(addr, &uarg->unique) ||
+           put_user(compat_ptr(addr), &p->unique))
                return -EFAULT;
-       karg.unique = NULL;
-
-       if (get_user(tmp, &uarg->unique))
-               return -EFAULT;
-
-       uptr = A(tmp);
 
-       if (uptr) {
-               karg.unique = kmalloc(karg.unique_len, GFP_KERNEL);
-               if (!karg.unique)
-                       return -ENOMEM;
-               if (cmd == DRM32_IOCTL_SET_UNIQUE &&
-                   copy_from_user(karg.unique, uptr, karg.unique_len)) {
-                       kfree(karg.unique);
-                       return -EFAULT;
-               }
-       }
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
        if (cmd == DRM32_IOCTL_GET_UNIQUE)
-               ret = sys_ioctl (fd, DRM_IOCTL_GET_UNIQUE, (unsigned long)&karg);
+               ret = sys_ioctl (fd, DRM_IOCTL_GET_UNIQUE, (unsigned long)p);
        else
-               ret = sys_ioctl (fd, DRM_IOCTL_SET_UNIQUE, (unsigned long)&karg);
-        set_fs(old_fs);
+               ret = sys_ioctl (fd, DRM_IOCTL_SET_UNIQUE, (unsigned long)p);
 
-       if (!ret) {
-               if (cmd == DRM32_IOCTL_GET_UNIQUE &&
-                   uptr != NULL &&
-                   copy_to_user(uptr, karg.unique, karg.unique_len))
-                       ret = -EFAULT;
-               if (put_user(karg.unique_len, &uarg->unique_len))
-                       ret = -EFAULT;
-       }
+       if (ret)
+               return ret;
 
-       if (karg.unique != NULL)
-               kfree(karg.unique);
+       if (get_user(n, &p->unique_len) || put_user(n, &uarg->unique_len))
+               return -EFAULT;
 
-       return ret;
+       return 0;
 }
 
 typedef struct drm32_map {
@@ -360,41 +262,23 @@ typedef struct drm32_buf_info {
 static int drm32_info_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_buf_info_t __user *uarg = (drm32_buf_info_t __user *)arg;
-       drm_buf_desc_t __user *ulist;
-       drm_buf_info_t karg;
-       mm_segment_t old_fs;
-       int orig_count, ret;
-       u32 tmp;
+       drm_buf_info_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
+       int n;
+       int ret;
 
-       if (get_user(karg.count, &uarg->count) ||
-           get_user(tmp, &uarg->list))
+       if (get_user(n, &uarg->count) || put_user(n, &p->count) ||
+           get_user(addr, &uarg->list) || put_user(compat_ptr(addr), &p->list))
                return -EFAULT;
 
-       ulist = A(tmp);
-
-       orig_count = karg.count;
+       ret = sys_ioctl(fd, DRM_IOCTL_INFO_BUFS, (unsigned long)p);
+       if (ret)
+               return ret;
 
-       karg.list = kmalloc(karg.count * sizeof(drm_buf_desc_t), GFP_KERNEL);
-       if (!karg.list)
+       if (get_user(n, &p->count) || put_user(n, &uarg->count))
                return -EFAULT;
 
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_ioctl(fd, DRM_IOCTL_INFO_BUFS, (unsigned long) &karg);
-       set_fs(old_fs);
-
-       if (!ret) {
-               if (karg.count <= orig_count &&
-                   (copy_to_user(ulist, karg.list,
-                                 karg.count * sizeof(drm_buf_desc_t))))
-                       ret = -EFAULT;
-               if (put_user(karg.count, &uarg->count))
-                       ret = -EFAULT;
-       }
-
-       kfree(karg.list);
-
-       return ret;
+       return 0;
 }
 
 typedef struct drm32_buf_free {
@@ -406,35 +290,15 @@ typedef struct drm32_buf_free {
 static int drm32_free_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_buf_free_t __user *uarg = (drm32_buf_free_t __user *)arg;
-       drm_buf_free_t karg;
-       mm_segment_t old_fs;
-       int __user *ulist;
-       int ret;
-       u32 tmp;
+       drm_buf_free_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
+       int n;
 
-       if (get_user(karg.count, &uarg->count) ||
-           get_user(tmp, &uarg->list))
+       if (get_user(n, &uarg->count) || put_user(n, &p->count) ||
+           get_user(addr, &uarg->list) || put_user(compat_ptr(addr), &p->list))
                return -EFAULT;
 
-       ulist = A(tmp);
-
-       karg.list = kmalloc(karg.count * sizeof(int), GFP_KERNEL);
-       if (!karg.list)
-               return -ENOMEM;
-
-       ret = -EFAULT;
-       if (copy_from_user(karg.list, ulist, (karg.count * sizeof(int))))
-               goto out;
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_ioctl(fd, DRM_IOCTL_FREE_BUFS, (unsigned long) &karg);
-       set_fs(old_fs);
-
-out:
-       kfree(karg.list);
-
-       return ret;
+       return sys_ioctl(fd, DRM_IOCTL_FREE_BUFS, (unsigned long)p);
 }
 
 typedef struct drm32_buf_pub {
@@ -455,59 +319,61 @@ static int drm32_map_bufs(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_buf_map_t __user *uarg = (drm32_buf_map_t __user *)arg;
        drm32_buf_pub_t __user *ulist;
-       drm_buf_map_t karg;
-       mm_segment_t old_fs;
+       drm_buf_map_t __user *arg64;
+       drm_buf_pub_t __user *list;
        int orig_count, ret, i;
-       u32 tmp1, tmp2;
+       int n;
+       compat_uptr_t addr;
 
-       if (get_user(karg.count, &uarg->count) ||
-           get_user(tmp1, &uarg->virtual) ||
-           get_user(tmp2, &uarg->list))
+       if (get_user(orig_count, &uarg->count))
                return -EFAULT;
 
-       karg.virtual = (void *) (unsigned long) tmp1;
-       ulist = A(tmp2);
-
-       orig_count = karg.count;
-
-       karg.list = kmalloc(karg.count * sizeof(drm_buf_pub_t), GFP_KERNEL);
-       if (!karg.list)
-               return -ENOMEM;
+       arg64 = compat_alloc_user_space(sizeof(drm_buf_map_t) +
+                               (size_t)orig_count * sizeof(drm_buf_pub_t));
+       list = (void __user *)(arg64 + 1);
 
-       ret = -EFAULT;
-       for (i = 0; i < karg.count; i++) {
-               if (get_user(karg.list[i].idx, &ulist[i].idx) ||
-                   get_user(karg.list[i].total, &ulist[i].total) ||
-                   get_user(karg.list[i].used, &ulist[i].used) ||
-                   get_user(tmp1, &ulist[i].address))
-                       goto out;
+       if (put_user(orig_count, &arg64->count) ||
+           put_user(list, &arg64->list) ||
+           get_user(addr, &uarg->virtual) ||
+           put_user(compat_ptr(addr), &arg64->virtual) ||
+           get_user(addr, &uarg->list))
+               return -EFAULT;
 
-               karg.list[i].address = (void *) (unsigned long) tmp1;
+       ulist = compat_ptr(addr);
+
+       for (i = 0; i < orig_count; i++) {
+               if (get_user(n, &ulist[i].idx) ||
+                   put_user(n, &list[i].idx) ||
+                   get_user(n, &ulist[i].total) ||
+                   put_user(n, &list[i].total) ||
+                   get_user(n, &ulist[i].used) ||
+                   put_user(n, &list[i].used) ||
+                   get_user(addr, &ulist[i].address) ||
+                   put_user(compat_ptr(addr), &list[i].address))
+                       return -EFAULT;
        }
 
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_ioctl(fd, DRM_IOCTL_MAP_BUFS, (unsigned long) &karg);
-       set_fs(old_fs);
-
-       if (!ret) {
-               for (i = 0; i < orig_count; i++) {
-                       tmp1 = (u32) (long) karg.list[i].address;
-                       if (put_user(karg.list[i].idx, &ulist[i].idx) ||
-                           put_user(karg.list[i].total, &ulist[i].total) ||
-                           put_user(karg.list[i].used, &ulist[i].used) ||
-                           put_user(tmp1, &ulist[i].address)) {
-                               ret = -EFAULT;
-                               goto out;
-                       }
-               }
-               if (put_user(karg.count, &uarg->count))
-                       ret = -EFAULT;
+       ret = sys_ioctl(fd, DRM_IOCTL_MAP_BUFS, (unsigned long) arg64);
+       if (ret)
+               return ret;
+
+       for (i = 0; i < orig_count; i++) {
+               void __user *p;
+               if (get_user(n, &list[i].idx) ||
+                   put_user(n, &ulist[i].idx) ||
+                   get_user(n, &list[i].total) ||
+                   put_user(n, &ulist[i].total) ||
+                   get_user(n, &list[i].used) ||
+                   put_user(n, &ulist[i].used) ||
+                   get_user(p, &list[i].address) ||
+                   put_user((unsigned long)p, &ulist[i].address))
+                       return -EFAULT;
        }
 
-out:
-       kfree(karg.list);
-       return ret;
+       if (get_user(n, &arg64->count) || put_user(n, &uarg->count))
+               return -EFAULT;
+
+       return 0;
 }
 
 typedef struct drm32_dma {
@@ -533,105 +399,37 @@ typedef struct drm32_dma {
 static int drm32_dma(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_dma_t __user *uarg = (drm32_dma_t __user *) arg;
-       int __user *u_si, *u_ss, *u_ri, *u_rs;
-       drm_dma_t karg;
-       mm_segment_t old_fs;
+       drm_dma_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
        int ret;
-       u32 tmp1, tmp2, tmp3, tmp4;
-
-       karg.send_indices = karg.send_sizes = NULL;
-       karg.request_indices = karg.request_sizes = NULL;
-
-       if (get_user(karg.context, &uarg->context) ||
-           get_user(karg.send_count, &uarg->send_count) ||
-           get_user(tmp1, &uarg->send_indices) ||
-           get_user(tmp2, &uarg->send_sizes) ||
-           get_user(karg.flags, &uarg->flags) ||
-           get_user(karg.request_count, &uarg->request_count) ||
-           get_user(karg.request_size, &uarg->request_size) ||
-           get_user(tmp3, &uarg->request_indices) ||
-           get_user(tmp4, &uarg->request_sizes) ||
-           get_user(karg.granted_count, &uarg->granted_count))
-               return -EFAULT;
-
-       u_si = A(tmp1);
-       u_ss = A(tmp2);
-       u_ri = A(tmp3);
-       u_rs = A(tmp4);
-
-       if (karg.send_count) {
-               karg.send_indices = kmalloc(karg.send_count * sizeof(int), GFP_KERNEL);
-               karg.send_sizes = kmalloc(karg.send_count * sizeof(int), GFP_KERNEL);
-
-               ret = -ENOMEM;
-               if (!karg.send_indices || !karg.send_sizes)
-                       goto out;
-
-               ret = -EFAULT;
-               if (copy_from_user(karg.send_indices, u_si,
-                                  (karg.send_count * sizeof(int))) ||
-                   copy_from_user(karg.send_sizes, u_ss,
-                                  (karg.send_count * sizeof(int))))
-                       goto out;
-       }
-
-       if (karg.request_count) {
-               karg.request_indices = kmalloc(karg.request_count * sizeof(int), GFP_KERNEL);
-               karg.request_sizes = kmalloc(karg.request_count * sizeof(int), GFP_KERNEL);
-
-               ret = -ENOMEM;
-               if (!karg.request_indices || !karg.request_sizes)
-                       goto out;
 
-               ret = -EFAULT;
-               if (copy_from_user(karg.request_indices, u_ri,
-                                  (karg.request_count * sizeof(int))) ||
-                   copy_from_user(karg.request_sizes, u_rs,
-                                  (karg.request_count * sizeof(int))))
-                       goto out;
-       }
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_ioctl(fd, DRM_IOCTL_DMA, (unsigned long) &karg);
-       set_fs(old_fs);
-
-       if (!ret) {
-               if (put_user(karg.context, &uarg->context) ||
-                   put_user(karg.send_count, &uarg->send_count) ||
-                   put_user(karg.flags, &uarg->flags) ||
-                   put_user(karg.request_count, &uarg->request_count) ||
-                   put_user(karg.request_size, &uarg->request_size) ||
-                   put_user(karg.granted_count, &uarg->granted_count))
-                       ret = -EFAULT;
+       if (copy_in_user(p, uarg, 2 * sizeof(int)) ||
+           get_user(addr, &uarg->send_indices) ||
+           put_user(compat_ptr(addr), &p->send_indices) ||
+           get_user(addr, &uarg->send_sizes) ||
+           put_user(compat_ptr(addr), &p->send_sizes) ||
+           copy_in_user(&p->flags, &uarg->flags, sizeof(drm_dma_flags_t)) ||
+           copy_in_user(&p->request_count, &uarg->request_count, sizeof(int))||
+           copy_in_user(&p->request_size, &uarg->request_size, sizeof(int)) ||
+           get_user(addr, &uarg->request_indices) ||
+           put_user(compat_ptr(addr), &p->request_indices) ||
+           get_user(addr, &uarg->request_sizes) ||
+           put_user(compat_ptr(addr), &p->request_sizes) ||
+           copy_in_user(&p->granted_count, &uarg->granted_count, sizeof(int)))
+               return -EFAULT;
 
-               if (karg.send_count) {
-                       if (copy_to_user(u_si, karg.send_indices,
-                                        (karg.send_count * sizeof(int))) ||
-                           copy_to_user(u_ss, karg.send_sizes,
-                                        (karg.send_count * sizeof(int))))
-                               ret = -EFAULT;
-               }
-               if (karg.request_count) {
-                       if (copy_to_user(u_ri, karg.request_indices,
-                                        (karg.request_count * sizeof(int))) ||
-                           copy_to_user(u_rs, karg.request_sizes,
-                                        (karg.request_count * sizeof(int))))
-                               ret = -EFAULT;
-               }
-       }
+       ret = sys_ioctl(fd, DRM_IOCTL_DMA, (unsigned long)p);
+       if (ret)
+               return ret;
 
-out:
-       if (karg.send_indices)
-               kfree(karg.send_indices);
-       if (karg.send_sizes)
-               kfree(karg.send_sizes);
-       if (karg.request_indices)
-               kfree(karg.request_indices);
-       if (karg.request_sizes)
-               kfree(karg.request_sizes);
+       if (copy_in_user(uarg, p, 2 * sizeof(int)) ||
+           copy_in_user(&uarg->flags, &p->flags, sizeof(drm_dma_flags_t)) ||
+           copy_in_user(&uarg->request_count, &p->request_count, sizeof(int))||
+           copy_in_user(&uarg->request_size, &p->request_size, sizeof(int)) ||
+           copy_in_user(&uarg->granted_count, &p->granted_count, sizeof(int)))
+               return -EFAULT;
 
-       return ret;
+       return 0;
 }
 
 typedef struct drm32_ctx_res {
@@ -643,50 +441,23 @@ typedef struct drm32_ctx_res {
 static int drm32_res_ctx(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
        drm32_ctx_res_t __user *uarg = (drm32_ctx_res_t __user *) arg;
-       drm_ctx_t __user *ulist;
-       drm_ctx_res_t karg;
-       mm_segment_t old_fs;
-       int orig_count, ret;
-       u32 tmp;
+       drm_ctx_res_t __user *p = compat_alloc_user_space(sizeof(*p));
+       compat_uptr_t addr;
+       int ret;
 
-       karg.contexts = NULL;
-       if (get_user(karg.count, &uarg->count) ||
-           get_user(tmp, &uarg->contexts))
+       if (copy_in_user(p, uarg, sizeof(int)) ||
+           get_user(addr, &uarg->contexts) ||
+           put_user(compat_ptr(addr), &p->contexts))
                return -EFAULT;
 
-       ulist = A(tmp);
-
-       orig_count = karg.count;
-       if (karg.count && ulist) {
-               karg.contexts = kmalloc((karg.count * sizeof(drm_ctx_t)), GFP_KERNEL);
-               if (!karg.contexts)
-                       return -ENOMEM;
-               if (copy_from_user(karg.contexts, ulist,
-                                  (karg.count * sizeof(drm_ctx_t)))) {
-                       kfree(karg.contexts);
-                       return -EFAULT;
-               }
-       }
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_ioctl(fd, DRM_IOCTL_RES_CTX, (unsigned long) &karg);
-       set_fs(old_fs);
-
-       if (!ret) {
-               if (orig_count) {
-                       if (copy_to_user(ulist, karg.contexts,
-                                        (orig_count * sizeof(drm_ctx_t))))
-                               ret = -EFAULT;
-               }
-               if (put_user(karg.count, &uarg->count))
-                       ret = -EFAULT;
-       }
+       ret = sys_ioctl(fd, DRM_IOCTL_RES_CTX, (unsigned long)p);
+       if (ret)
+               return ret;
 
-       if (karg.contexts)
-               kfree(karg.contexts);
+       if (copy_in_user(uarg, p, sizeof(int)))
+               return -EFAULT;
 
-       return ret;
+       return 0;
 }
 
 #endif
index 7f03853..145ce7c 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <stdarg.h>
 
+#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/sched.h>
@@ -28,6 +29,7 @@
 #include <linux/config.h>
 #include <linux/reboot.h>
 #include <linux/delay.h>
+#include <linux/compat.h>
 #include <linux/init.h>
 
 #include <asm/oplib.h>
@@ -588,10 +590,13 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags,
 
        clone_flags &= ~CLONE_IDLETASK;
 
+#ifdef CONFIG_COMPAT
        if (test_thread_flag(TIF_32BIT)) {
                parent_tid_ptr = compat_ptr(regs->u_regs[UREG_I2]);
                child_tid_ptr = compat_ptr(regs->u_regs[UREG_I4]);
-       } else {
+       } else
+#endif
+       {
                parent_tid_ptr = (int __user *) regs->u_regs[UREG_I2];
                child_tid_ptr = (int __user *) regs->u_regs[UREG_I4];
        }
index 549e978..14d9c3a 100644 (file)
  *
  * On SYSIO, using an 8K page size we have 1GB of SBUS
  * DMA space mapped.  We divide this space into equally
- * sized clusters.  Currently we allow clusters up to a
- * size of 1MB.  If anything begins to generate DMA
- * mapping requests larger than this we will need to
- * increase things a bit.
+ * sized clusters. We allocate a DMA mapping from the
+ * cluster that matches the order of the allocation, or
+ * if the order is greater than the number of clusters,
+ * we try to allocate from the last cluster.
  */
 
 #define NCLUSTERS      8UL
@@ -134,12 +134,17 @@ static void strbuf_flush(struct sbus_iommu *iommu, u32 base, unsigned long npage
 
 static iopte_t *alloc_streaming_cluster(struct sbus_iommu *iommu, unsigned long npages)
 {
-       iopte_t *iopte, *limit, *first;
-       unsigned long cnum, ent, flush_point;
+       iopte_t *iopte, *limit, *first, *cluster;
+       unsigned long cnum, ent, nent, flush_point, found;
 
        cnum = 0;
+       nent = 1;
        while ((1UL << cnum) < npages)
                cnum++;
+       if(cnum >= NCLUSTERS) {
+               nent = 1UL << (cnum - NCLUSTERS);
+               cnum = NCLUSTERS - 1;
+       }
        iopte  = iommu->page_table + (cnum * CLUSTER_NPAGES);
 
        if (cnum == 0)
@@ -152,22 +157,31 @@ static iopte_t *alloc_streaming_cluster(struct sbus_iommu *iommu, unsigned long
        flush_point = iommu->alloc_info[cnum].flush;
 
        first = iopte;
+       cluster = NULL;
+       found = 0;
        for (;;) {
                if (iopte_val(*iopte) == 0UL) {
-                       if ((iopte + (1 << cnum)) >= limit)
-                               ent = 0;
-                       else
-                               ent = ent + 1;
-                       iommu->alloc_info[cnum].next = ent;
-                       if (ent == flush_point)
-                               __iommu_flushall(iommu);
-                       break;
+                       found++;
+                       if (!cluster)
+                               cluster = iopte;
+               } else {
+                       /* Used cluster in the way */
+                       cluster = NULL;
+                       found = 0;
                }
+
+               if (found == nent)
+                       break;
+
                iopte += (1 << cnum);
                ent++;
                if (iopte >= limit) {
                        iopte = (iommu->page_table + (cnum * CLUSTER_NPAGES));
                        ent = 0;
+
+                       /* Multiple cluster allocations must not wrap */
+                       cluster = NULL;
+                       found = 0;
                }
                if (ent == flush_point)
                        __iommu_flushall(iommu);
@@ -175,8 +189,19 @@ static iopte_t *alloc_streaming_cluster(struct sbus_iommu *iommu, unsigned long
                        goto bad;
        }
 
+       /* ent/iopte points to the last cluster entry we're going to use,
+        * so save our place for the next allocation.
+        */
+       if ((iopte + (1 << cnum)) >= limit)
+               ent = 0;
+       else
+               ent = ent + 1;
+       iommu->alloc_info[cnum].next = ent;
+       if (ent == flush_point)
+               __iommu_flushall(iommu);
+
        /* I've got your streaming cluster right here buddy boy... */
-       return iopte;
+       return cluster;
 
 bad:
        printk(KERN_EMERG "sbus: alloc_streaming_cluster of npages(%ld) failed!\n",
@@ -186,15 +211,23 @@ bad:
 
 static void free_streaming_cluster(struct sbus_iommu *iommu, u32 base, unsigned long npages)
 {
-       unsigned long cnum, ent;
+       unsigned long cnum, ent, nent;
        iopte_t *iopte;
 
        cnum = 0;
+       nent = 1;
        while ((1UL << cnum) < npages)
                cnum++;
+       if(cnum >= NCLUSTERS) {
+               nent = 1UL << (cnum - NCLUSTERS);
+               cnum = NCLUSTERS - 1;
+       }
        ent = (base & CLUSTER_MASK) >> (IO_PAGE_SHIFT + cnum);
        iopte = iommu->page_table + ((base - MAP_BASE) >> IO_PAGE_SHIFT);
-       iopte_val(*iopte) = 0UL;
+       do {
+               iopte_val(*iopte) = 0UL;
+               iopte += 1 << cnum;
+       } while(--nent);
 
        /* If the global flush might not have caught this entry,
         * adjust the flush point such that we will flush before
index 1c8b543..abc65dc 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/uaccess.h>
 #include <asm/timer.h>
 #include <asm/starfire.h>
+#include <asm/tlb.h>
 
 extern int linux_num_cpus;
 extern void calibrate_delay(void);
@@ -635,9 +636,8 @@ void smp_call_function_client(int irq, struct pt_regs *regs)
        }
 }
 
-extern unsigned long xcall_flush_tlb_page;
 extern unsigned long xcall_flush_tlb_mm;
-extern unsigned long xcall_flush_tlb_range;
+extern unsigned long xcall_flush_tlb_pending;
 extern unsigned long xcall_flush_tlb_kernel_range;
 extern unsigned long xcall_flush_tlb_all_spitfire;
 extern unsigned long xcall_flush_tlb_all_cheetah;
@@ -835,7 +835,6 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
                int cpu = get_cpu();
 
                if (atomic_read(&mm->mm_users) == 1) {
-                       /* See smp_flush_tlb_page for info about this. */
                        mm->cpu_vm_mask = cpumask_of_cpu(cpu);
                        goto local_flush_and_out;
                }
@@ -851,27 +850,40 @@ void smp_flush_tlb_mm(struct mm_struct *mm)
        }
 }
 
-void smp_flush_tlb_range(struct mm_struct *mm, unsigned long start,
-                        unsigned long end)
+void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long *vaddrs)
 {
        u32 ctx = CTX_HWBITS(mm->context);
        int cpu = get_cpu();
 
-       start &= PAGE_MASK;
-       end    = PAGE_ALIGN(end);
-
        if (mm == current->active_mm && atomic_read(&mm->mm_users) == 1) {
                mm->cpu_vm_mask = cpumask_of_cpu(cpu);
                goto local_flush_and_out;
+       } else {
+               /* This optimization is not valid.  Normally
+                * we will be holding the page_table_lock, but
+                * there is an exception which is copy_page_range()
+                * when forking.  The lock is held during the individual
+                * page table updates in the parent, but not at the
+                * top level, which is where we are invoked.
+                */
+               if (0) {
+                       cpumask_t this_cpu_mask = cpumask_of_cpu(cpu);
+
+                       /* By virtue of running under the mm->page_table_lock,
+                        * and mmu_context.h:switch_mm doing the same, the
+                        * following operation is safe.
+                        */
+                       if (cpus_equal(mm->cpu_vm_mask, this_cpu_mask))
+                               goto local_flush_and_out;
+               }
        }
 
-       smp_cross_call_masked(&xcall_flush_tlb_range,
-                             ctx, start, end,
+       smp_cross_call_masked(&xcall_flush_tlb_pending,
+                             ctx, nr, (unsigned long) vaddrs,
                              mm->cpu_vm_mask);
 
- local_flush_and_out:
-       __flush_tlb_range(ctx, start, SECONDARY_CONTEXT,
-                         end, PAGE_SIZE, (end-start));
+local_flush_and_out:
+       __flush_tlb_pending(ctx, nr, vaddrs);
 
        put_cpu();
 }
@@ -888,55 +900,6 @@ void smp_flush_tlb_kernel_range(unsigned long start, unsigned long end)
        }
 }
 
-void smp_flush_tlb_page(struct mm_struct *mm, unsigned long page)
-{
-       {
-               u32 ctx = CTX_HWBITS(mm->context);
-               int cpu = get_cpu();
-
-               page &= PAGE_MASK;
-               if (mm == current->active_mm &&
-                   atomic_read(&mm->mm_users) == 1) {
-                       /* By virtue of being the current address space, and
-                        * having the only reference to it, the following
-                        * operation is safe.
-                        *
-                        * It would not be a win to perform the xcall tlb
-                        * flush in this case, because even if we switch back
-                        * to one of the other processors in cpu_vm_mask it
-                        * is almost certain that all TLB entries for this
-                        * context will be replaced by the time that happens.
-                        */
-                       mm->cpu_vm_mask = cpumask_of_cpu(cpu);
-                       goto local_flush_and_out;
-               } else {
-                       cpumask_t this_cpu_mask = cpumask_of_cpu(cpu);
-
-                       /* By virtue of running under the mm->page_table_lock,
-                        * and mmu_context.h:switch_mm doing the same, the
-                        * following operation is safe.
-                        */
-                       if (cpus_equal(mm->cpu_vm_mask, this_cpu_mask))
-                               goto local_flush_and_out;
-               }
-
-               /* OK, we have to actually perform the cross call.  Most
-                * likely this is a cloned mm or kswapd is kicking out pages
-                * for a task which has run recently on another cpu.
-                */
-               smp_cross_call_masked(&xcall_flush_tlb_page,
-                                     ctx, page, 0,
-                                     mm->cpu_vm_mask);
-               if (!cpu_isset(cpu, mm->cpu_vm_mask))
-                       return;
-
-       local_flush_and_out:
-               __flush_tlb_page(ctx, page, SECONDARY_CONTEXT);
-
-               put_cpu();
-       }
-}
-
 /* CPU capture. */
 /* #define CAPTURE_DEBUG */
 extern unsigned long xcall_capture;
index b041d87..5eafadd 100644 (file)
@@ -135,6 +135,7 @@ EXPORT_SYMBOL(__write_lock);
 EXPORT_SYMBOL(__write_unlock);
 EXPORT_SYMBOL(__write_trylock);
 /* Out of line spin-locking implementation. */
+EXPORT_SYMBOL(_raw_spin_lock);
 EXPORT_SYMBOL(_raw_spin_lock_flags);
 #endif
 
@@ -142,8 +143,8 @@ EXPORT_SYMBOL(_raw_spin_lock_flags);
 EXPORT_SYMBOL(synchronize_irq);
 
 #if defined(CONFIG_MCOUNT)
-extern void mcount(void);
-EXPORT_SYMBOL_NOVERS(mcount);
+extern void _mcount(void);
+EXPORT_SYMBOL_NOVERS(_mcount);
 #endif
 
 /* CPU online map and active count.  */
@@ -258,7 +259,7 @@ EXPORT_SYMBOL(verify_compat_iovec);
 
 EXPORT_SYMBOL(dump_thread);
 EXPORT_SYMBOL(dump_fpu);
-EXPORT_SYMBOL(pte_alloc_one_kernel);
+EXPORT_SYMBOL(__pte_alloc_one_kernel);
 #ifndef CONFIG_SMP
 EXPORT_SYMBOL(pgt_quicklists);
 #endif
@@ -333,7 +334,6 @@ EXPORT_SYMBOL(sys_close);
 #endif
 
 /* Special internal versions of library functions. */
-EXPORT_SYMBOL(__memcpy);
 EXPORT_SYMBOL(__memset);
 EXPORT_SYMBOL(_clear_page);
 EXPORT_SYMBOL(clear_user_page);
@@ -350,9 +350,10 @@ EXPORT_SYMBOL(csum_partial);
 EXPORT_SYMBOL(csum_partial_copy_sparc64);
 EXPORT_SYMBOL(ip_fast_csum);
 
-/* Moving data to/from userspace. */
+/* Moving data to/from/in userspace. */
 EXPORT_SYMBOL(__copy_to_user);
 EXPORT_SYMBOL(__copy_from_user);
+EXPORT_SYMBOL(__copy_in_user);
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(__bzero_noasi);
 
index 50d889f..3d6fd1e 100644 (file)
@@ -128,7 +128,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
 
        if (flags & MAP_FIXED) {
                /* Ok, don't mess with it. */
-               return get_unmapped_area(NULL, addr, len, pgoff, flags, 0);
+               return get_unmapped_area(NULL, addr, len, pgoff, flags);
        }
        flags &= ~MAP_SHARED;
 
@@ -141,7 +141,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
                align_goal = (64UL * 1024);
 
        do {
-               addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags, 0);
+               addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
                if (!(addr & ~PAGE_MASK)) {
                        addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
                        break;
@@ -159,7 +159,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
         * be obtained.
         */
        if (addr & ~PAGE_MASK)
-               addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags, 0);
+               addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
 
        return addr;
 }
@@ -403,7 +403,7 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr,
                /* MREMAP_FIXED checked above. */
                new_addr = get_unmapped_area(file, addr, new_len,
                                    vma ? vma->vm_pgoff : 0,
-                                   map_flags, vma->vm_flags & VM_EXEC);
+                                   map_flags);
                ret = new_addr;
                if (new_addr & ~PAGE_MASK)
                        goto out_sem;
index c047ed3..56e2773 100644 (file)
@@ -867,138 +867,6 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long high, unsigned
                return sys_ftruncate(fd, (high << 32) | low);
 }
 
-/* readdir & getdents */
-
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
-
-struct old_linux_dirent32 {
-       u32             d_ino;
-       u32             d_offset;
-       unsigned short  d_namlen;
-       char            d_name[1];
-};
-
-struct readdir_callback32 {
-       struct old_linux_dirent32 __user * dirent;
-       int count;
-};
-
-static int fillonedir(void * __buf, const char * name, int namlen,
-                     loff_t offset, ino_t ino, unsigned int d_type)
-{
-       struct readdir_callback32 * buf = (struct readdir_callback32 *) __buf;
-       struct old_linux_dirent32 __user * dirent;
-
-       if (buf->count)
-               return -EINVAL;
-       buf->count++;
-       dirent = buf->dirent;
-       put_user(ino, &dirent->d_ino);
-       put_user(offset, &dirent->d_offset);
-       put_user(namlen, &dirent->d_namlen);
-       copy_to_user(dirent->d_name, name, namlen);
-       put_user(0, dirent->d_name + namlen);
-       return 0;
-}
-
-asmlinkage long old32_readdir(unsigned int fd, struct old_linux_dirent32 __user *dirent, unsigned int count)
-{
-       int error = -EBADF;
-       struct file * file;
-       struct readdir_callback32 buf;
-
-       file = fget(fd);
-       if (!file)
-               goto out;
-
-       buf.count = 0;
-       buf.dirent = dirent;
-
-       error = vfs_readdir(file, fillonedir, &buf);
-       if (error < 0)
-               goto out_putf;
-       error = buf.count;
-
-out_putf:
-       fput(file);
-out:
-       return error;
-}
-
-struct linux_dirent32 {
-       u32             d_ino;
-       u32             d_off;
-       unsigned short  d_reclen;
-       char            d_name[1];
-};
-
-struct getdents_callback32 {
-       struct linux_dirent32 __user *current_dir;
-       struct linux_dirent32 __user *previous;
-       int count;
-       int error;
-};
-
-static int filldir(void * __buf, const char * name, int namlen, loff_t offset, ino_t ino,
-                  unsigned int d_type)
-{
-       struct linux_dirent32 __user * dirent;
-       struct getdents_callback32 * buf = (struct getdents_callback32 *) __buf;
-       int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
-
-       buf->error = -EINVAL;   /* only used if we fail.. */
-       if (reclen > buf->count)
-               return -EINVAL;
-       dirent = buf->previous;
-       if (dirent)
-               put_user(offset, &dirent->d_off);
-       dirent = buf->current_dir;
-       buf->previous = dirent;
-       put_user(ino, &dirent->d_ino);
-       put_user(reclen, &dirent->d_reclen);
-       copy_to_user(dirent->d_name, name, namlen);
-       put_user(0, dirent->d_name + namlen);
-       put_user(d_type, (char __user *) dirent + reclen - 1);
-       dirent = (void __user *) dirent + reclen;
-       buf->current_dir = dirent;
-       buf->count -= reclen;
-       return 0;
-}
-
-asmlinkage long sys32_getdents(unsigned int fd, struct linux_dirent32 __user *dirent, unsigned int count)
-{
-       struct file * file;
-       struct linux_dirent32 __user *lastdirent;
-       struct getdents_callback32 buf;
-       int error = -EBADF;
-
-       file = fget(fd);
-       if (!file)
-               goto out;
-
-       buf.current_dir = dirent;
-       buf.previous = NULL;
-       buf.count = count;
-       buf.error = 0;
-
-       error = vfs_readdir(file, filldir, &buf);
-       if (error < 0)
-               goto out_putf;
-       lastdirent = buf.previous;
-       error = buf.error;
-       if (lastdirent) {
-               put_user(file->f_pos, &lastdirent->d_off);
-               error = count - buf.count;
-       }
-out_putf:
-       fput(file);
-out:
-       return error;
-}
-
-/* end of readdir & getdents */
-
 int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 {
        int err;
@@ -1750,7 +1618,7 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
                /* MREMAP_FIXED checked above. */
                new_addr = get_unmapped_area(file, addr, new_len,
                                    vma ? vma->vm_pgoff : 0,
-                                   map_flags, vma->vm_flags & VM_EXEC);
+                                   map_flags);
                ret = new_addr;
                if (new_addr & ~PAGE_MASK)
                        goto out_sem;
index 2187876..4aee276 100644 (file)
@@ -15,6 +15,7 @@
        .text
        .align  4
 
+#ifdef CONFIG_COMPAT
        /* First, the 32-bit Linux native syscall table. */
 
        .globl sys_call_table32
@@ -53,13 +54,13 @@ sys_call_table32:
        .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
 /*160*/        .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
        .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
-/*170*/        .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, sys32_getdents
+/*170*/        .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
        .word sys_setsid, sys_fchdir, sys32_fgetxattr, sys_listxattr, sys_llistxattr
 /*180*/        .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
        .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
 /*190*/        .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
        .word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask
-/*200*/        .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, old32_readdir
+/*200*/        .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_old_readdir
        .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
 /*210*/        .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
        .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex
@@ -77,6 +78,8 @@ sys_call_table32:
        .word sys_mq_timedsend, sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, sys_ni_syscall
 /*280*/        .word sys_ni_syscall, sys_ni_syscall, sys_ni_syscall
 
+#endif /* CONFIG_COMPAT */
+
        /* Now the 64-bit native Linux syscall table. */
 
        .align  4
@@ -85,7 +88,7 @@ sys_call_table64:
 sys_call_table:
 /*0*/  .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
 /*5*/  .word sys_open, sys_close, sys_wait4, sys_creat, sys_link
-/*10*/  .word sys_unlink, sunos_execv, sys_chdir, sys_chown, sys_mknod
+/*10*/  .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
 /*15*/ .word sys_chmod, sys_lchown, sparc_brk, sys_perfctr, sys_lseek
 /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
 /*25*/ .word sys_nis_syscall, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
index 06e1579..f961a0d 100644 (file)
@@ -423,7 +423,7 @@ static unsigned long timer_ticks_per_nsec_quotient;
 
 #define TICK_SIZE (tick_nsec / 1000)
 
-static __inline__ void timer_check_rtc(void)
+static inline void timer_check_rtc(void)
 {
        /* last time the cmos clock got updated */
        static long last_rtc_update;
@@ -443,8 +443,7 @@ static __inline__ void timer_check_rtc(void)
 
 void sparc64_do_profile(struct pt_regs *regs)
 {
-       unsigned long pc = regs->tpc;
-       unsigned long o7 = regs->u_regs[UREG_RETPC];
+       unsigned long pc;
 
        profile_hook(regs);
 
@@ -454,32 +453,14 @@ void sparc64_do_profile(struct pt_regs *regs)
        if (!prof_buffer)
                return;
 
-       {
-               extern int rwlock_impl_begin, rwlock_impl_end;
-               extern int atomic_impl_begin, atomic_impl_end;
-               extern int __memcpy_begin, __memcpy_end;
-               extern int __bzero_begin, __bzero_end;
-               extern int __bitops_begin, __bitops_end;
-
-               if ((pc >= (unsigned long) &atomic_impl_begin &&
-                    pc < (unsigned long) &atomic_impl_end) ||
-                   (pc >= (unsigned long) &rwlock_impl_begin &&
-                    pc < (unsigned long) &rwlock_impl_end) ||
-                   (pc >= (unsigned long) &__memcpy_begin &&
-                    pc < (unsigned long) &__memcpy_end) ||
-                   (pc >= (unsigned long) &__bzero_begin &&
-                    pc < (unsigned long) &__bzero_end) ||
-                   (pc >= (unsigned long) &__bitops_begin &&
-                    pc < (unsigned long) &__bitops_end))
-                       pc = o7;
-
-               pc -= (unsigned long) _stext;
-               pc >>= prof_shift;
-
-               if(pc >= prof_len)
-                       pc = prof_len - 1;
-               atomic_inc((atomic_t *)&prof_buffer[pc]);
-       }
+       pc = regs->tpc;
+
+       pc -= (unsigned long) _stext;
+       pc >>= prof_shift;
+
+       if(pc >= prof_len)
+               pc = prof_len - 1;
+       atomic_inc((atomic_t *)&prof_buffer[pc]);
 }
 
 static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
@@ -1139,7 +1120,6 @@ EXPORT_SYMBOL(do_settimeofday);
  */
 void do_gettimeofday(struct timeval *tv)
 {
-       unsigned long flags;
        unsigned long seq;
        unsigned long usec, sec;
        unsigned long max_ntp_tick = tick_usec - tickadj;
@@ -1147,7 +1127,7 @@ void do_gettimeofday(struct timeval *tv)
        do {
                unsigned long lost;
 
-               seq = read_seqbegin_irqsave(&xtime_lock, flags);
+               seq = read_seqbegin(&xtime_lock);
                usec = do_gettimeoffset();
                lost = jiffies - wall_jiffies;
 
@@ -1166,8 +1146,18 @@ void do_gettimeofday(struct timeval *tv)
                        usec += lost * tick_usec;
 
                sec = xtime.tv_sec;
-               usec += (xtime.tv_nsec / 1000);
-       } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
+
+               /* Believe it or not, this divide shows up on
+                * kernel profiles.  The problem is that it is
+                * both 64-bit and signed.  Happily, 32-bits
+                * of precision is all we really need and in
+                * doing so gcc ends up emitting a cheap multiply.
+                *
+                * XXX Why is tv_nsec 'long' and 'signed' in
+                * XXX the first place, can it even be negative?
+                */
+               usec += ((unsigned int) xtime.tv_nsec / 1000U);
+       } while (read_seqretry(&xtime_lock, seq));
 
        while (usec >= 1000000) {
                usec -= 1000000;
index 230e59f..2da5af9 100644 (file)
@@ -5,7 +5,7 @@
 EXTRA_AFLAGS := -ansi
 EXTRA_CFLAGS := -Werror
 
-lib-y := PeeCeeI.o blockops.o strlen.o strncmp.o \
+lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
         memscan.o strncpy_from_user.o strlen_user.o memcmp.o checksum.o \
         VIScopy.o VISbzero.o VISmemset.o VIScsum.o VIScsumcopy.o \
         VIScsumcopyusr.o VISsave.o atomic.o rwlock.o bitops.o \
diff --git a/arch/sparc64/lib/blockops.S b/arch/sparc64/lib/blockops.S
deleted file mode 100644 (file)
index 8413038..0000000
+++ /dev/null
@@ -1,451 +0,0 @@
-/* $Id: blockops.S,v 1.42 2002/02/09 19:49:30 davem Exp $
- * blockops.S: UltraSparc block zero optimized routines.
- *
- * Copyright (C) 1996, 1998, 1999, 2000 David S. Miller (davem@redhat.com)
- * Copyright (C) 1997 Jakub Jelinek (jakub@redhat.com)
- */
-
-#include "VIS.h"
-#include <asm/visasm.h>
-#include <asm/thread_info.h>
-#include <asm/page.h>
-#include <asm/dcu.h>
-#include <asm/spitfire.h>
-#include <asm/pgtable.h>
-
-#define TOUCH(reg0, reg1, reg2, reg3, reg4, reg5, reg6, reg7)  \
-       fmovd   %reg0, %f48;    fmovd   %reg1, %f50;            \
-       fmovd   %reg2, %f52;    fmovd   %reg3, %f54;            \
-       fmovd   %reg4, %f56;    fmovd   %reg5, %f58;            \
-       fmovd   %reg6, %f60;    fmovd   %reg7, %f62;
-
-#define        DCACHE_SIZE     (PAGE_SIZE * 2)
-#define TLBTEMP_ENT1   (60 << 3)
-#define TLBTEMP_ENT2   (61 << 3)
-#define TLBTEMP_ENTSZ  (1 << 3)
-
-#if (PAGE_SHIFT == 13) || (PAGE_SHIFT == 19)
-#define PAGE_SIZE_REM  0x80
-#elif (PAGE_SHIFT == 16) || (PAGE_SHIFT == 22)
-#define PAGE_SIZE_REM  0x100
-#else
-#error Wrong PAGE_SHIFT specified
-#endif
-
-       .text
-
-       .align          32
-       .globl          copy_user_page
-       .type           copy_user_page,@function
-copy_user_page: /* %o0=dest, %o1=src, %o2=vaddr */
-       VISEntry
-       sethi           %hi(PAGE_SIZE), %g3
-       sethi           %uhi(PAGE_OFFSET), %g2
-       sllx            %g2, 32, %g2
-       sub             %o0, %g2, %g1
-       and             %o2, %g3, %o0
-       sethi           %hi(TLBTEMP_BASE), %o3
-       sethi           %uhi(_PAGE_VALID | _PAGE_SZBITS), %g3
-       sub             %o1, %g2, %g2
-       sllx            %g3, 32, %g3
-       mov             TLB_TAG_ACCESS, %o2
-       or              %g3, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W), %g3
-       sethi           %hi(DCACHE_SIZE), %o1
-       or              %g1, %g3, %g1
-       or              %g2, %g3, %g2
-       add             %o0, %o3, %o0
-       add             %o0, %o1, %o1
-#define FIX_INSN_1     0x96102060 /* mov (12 << 3), %o3 */
-cheetah_patch_1:
-       mov             TLBTEMP_ENT1, %o3
-       rdpr            %pstate, %g3
-       wrpr            %g3, PSTATE_IE, %pstate
-
-       /* Do this now, before loading the fixed TLB entries for copying,
-        * so we do not risk a multiple TLB match condition later when
-        * restoring those entries.
-        */
-       ldx             [%g6 + TI_FLAGS], %g3
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %o4
-       stxa            %g0, [%o4] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_TAG_READ, %o4
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %o5
-       stxa            %g0, [%o5] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %g0
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %o5
-       stxa            %o0, [%o2] ASI_DMMU
-       stxa            %g1, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-       add             %o3, (TLBTEMP_ENTSZ), %o3
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %g5
-       stxa            %g0, [%g5] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_TAG_READ, %g5
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %g7
-       stxa            %g0, [%g7] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %g0
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %g7
-       stxa            %o1, [%o2] ASI_DMMU
-       stxa            %g2, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-
-       andcc           %g3, _TIF_BLKCOMMIT, %g0
-       bne,pn          %xcc, copy_page_using_blkcommit
-        nop
-
-       BRANCH_IF_ANY_CHEETAH(g3,o2,cheetah_copy_user_page)
-       ba,pt           %xcc, spitfire_copy_user_page
-        nop
-
-cheetah_copy_user_page:
-       .globl          cheetah_copy_user_page_nop_1_6
-cheetah_copy_user_page_nop_1_6:
-       ldxa            [%g0] ASI_DCU_CONTROL_REG, %g3
-       sethi           %uhi(DCU_PE), %o2
-       sllx            %o2, 32, %o2
-       or              %g3, %o2, %o2
-       stxa            %o2, [%g0] ASI_DCU_CONTROL_REG  ! Enable P-cache
-       membar          #Sync
-
-       sethi           %hi((PAGE_SIZE/64)-7), %o2      ! A0 Group
-       prefetch        [%o1 + 0x000], #one_read        ! MS
-       or              %o2, %lo((PAGE_SIZE/64)-7), %o2 ! A1 Group
-       prefetch        [%o1 + 0x040], #one_read        ! MS
-       prefetch        [%o1 + 0x080], #one_read        ! MS Group
-       prefetch        [%o1 + 0x0c0], #one_read        ! MS Group
-       ldd             [%o1 + 0x000], %f0              ! MS Group
-       prefetch        [%o1 + 0x100], #one_read        ! MS Group
-       ldd             [%o1 + 0x008], %f2              ! AX
-       prefetch        [%o1 + 0x140], #one_read        ! MS Group
-       ldd             [%o1 + 0x010], %f4              ! AX
-       prefetch        [%o1 + 0x180], #one_read        ! MS Group
-       fmovd           %f0, %f32                       ! FGA Group
-       ldd             [%o1 + 0x018], %f6              ! AX
-       fmovd           %f2, %f34                       ! FGA Group
-       ldd             [%o1 + 0x020], %f8              ! MS
-       fmovd           %f4, %f36                       ! FGA Group
-       ldd             [%o1 + 0x028], %f10             ! AX
-       membar          #StoreStore                     ! MS
-       fmovd           %f6, %f38                       ! FGA Group
-       ldd             [%o1 + 0x030], %f12             ! MS
-       fmovd           %f8, %f40                       ! FGA Group
-       ldd             [%o1 + 0x038], %f14             ! AX
-       fmovd           %f10, %f42                      ! FGA Group
-       ldd             [%o1 + 0x040], %f16             ! MS
-1:     ldd             [%o1 + 0x048], %f2              ! AX (Group)
-       fmovd           %f12, %f44                      ! FGA
-       ldd             [%o1 + 0x050], %f4              ! MS
-       fmovd           %f14, %f46                      ! FGA Group
-       stda            %f32, [%o0] ASI_BLK_P           ! MS
-       ldd             [%o1 + 0x058], %f6              ! AX
-       fmovd           %f16, %f32                      ! FGA Group (8-cycle stall)
-       ldd             [%o1 + 0x060], %f8              ! MS
-       fmovd           %f2, %f34                       ! FGA Group
-       ldd             [%o1 + 0x068], %f10             ! AX
-       fmovd           %f4, %f36                       ! FGA Group
-       ldd             [%o1 + 0x070], %f12             ! MS
-       fmovd           %f6, %f38                       ! FGA Group
-       ldd             [%o1 + 0x078], %f14             ! AX
-       fmovd           %f8, %f40                       ! FGA Group
-       ldd             [%o1 + 0x080], %f16             ! AX
-       prefetch        [%o1 + 0x180], #one_read        ! MS
-       fmovd           %f10, %f42                      ! FGA Group
-       subcc           %o2, 1, %o2                     ! A0
-       add             %o0, 0x40, %o0                  ! A1
-       bne,pt          %xcc, 1b                        ! BR
-        add            %o1, 0x40, %o1                  ! A0 Group
-
-       mov             5, %o2                          ! A0 Group
-1:     ldd             [%o1 + 0x048], %f2              ! AX
-       fmovd           %f12, %f44                      ! FGA
-       ldd             [%o1 + 0x050], %f4              ! MS
-       fmovd           %f14, %f46                      ! FGA Group
-       stda            %f32, [%o0] ASI_BLK_P           ! MS
-       ldd             [%o1 + 0x058], %f6              ! AX
-       fmovd           %f16, %f32                      ! FGA Group (8-cycle stall)
-       ldd             [%o1 + 0x060], %f8              ! MS
-       fmovd           %f2, %f34                       ! FGA Group
-       ldd             [%o1 + 0x068], %f10             ! AX
-       fmovd           %f4, %f36                       ! FGA Group
-       ldd             [%o1 + 0x070], %f12             ! MS
-       fmovd           %f6, %f38                       ! FGA Group
-       ldd             [%o1 + 0x078], %f14             ! AX
-       fmovd           %f8, %f40                       ! FGA Group
-       ldd             [%o1 + 0x080], %f16             ! MS
-       fmovd           %f10, %f42                      ! FGA Group
-       subcc           %o2, 1, %o2                     ! A0
-       add             %o0, 0x40, %o0                  ! A1
-       bne,pt          %xcc, 1b                        ! BR
-        add            %o1, 0x40, %o1                  ! A0 Group
-
-       ldd             [%o1 + 0x048], %f2              ! AX
-       fmovd           %f12, %f44                      ! FGA
-       ldd             [%o1 + 0x050], %f4              ! MS
-       fmovd           %f14, %f46                      ! FGA Group
-       stda            %f32, [%o0] ASI_BLK_P           ! MS
-       ldd             [%o1 + 0x058], %f6              ! AX
-       fmovd           %f16, %f32                      ! FGA Group (8-cycle stall)
-       ldd             [%o1 + 0x060], %f8              ! MS
-       fmovd           %f2, %f34                       ! FGA Group
-       ldd             [%o1 + 0x068], %f10             ! AX
-       fmovd           %f4, %f36                       ! FGA Group
-       ldd             [%o1 + 0x070], %f12             ! MS
-       fmovd           %f6, %f38                       ! FGA Group
-       add             %o0, 0x40, %o0                  ! A0
-       ldd             [%o1 + 0x078], %f14             ! AX
-       fmovd           %f8, %f40                       ! FGA Group
-       fmovd           %f10, %f42                      ! FGA Group
-       fmovd           %f12, %f44                      ! FGA Group
-       fmovd           %f14, %f46                      ! FGA Group
-       stda            %f32, [%o0] ASI_BLK_P           ! MS
-       .globl          cheetah_copy_user_page_nop_2_3
-cheetah_copy_user_page_nop_2_3:
-       mov             PRIMARY_CONTEXT, %o2
-       stxa            %g0, [%o2] ASI_DMMU             ! Flush P-cache
-       stxa            %g3, [%g0] ASI_DCU_CONTROL_REG  ! Disable P-cache
-       ba,a,pt         %xcc, copy_user_page_continue
-
-spitfire_copy_user_page:
-       ldda            [%o1] ASI_BLK_P, %f0
-       add             %o1, 0x40, %o1
-       ldda            [%o1] ASI_BLK_P, %f16
-       add             %o1, 0x40, %o1
-       sethi           %hi(PAGE_SIZE), %o2
-1:     TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
-       ldda            [%o1] ASI_BLK_P, %f32
-       stda            %f48, [%o0] ASI_BLK_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
-       ldda            [%o1] ASI_BLK_P, %f0
-       stda            %f48, [%o0] ASI_BLK_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f32, f34, f36, f38, f40, f42, f44, f46)
-       ldda            [%o1] ASI_BLK_P, %f16
-       stda            %f48, [%o0] ASI_BLK_P
-       sub             %o2, 0x40, %o2
-       add             %o1, 0x40, %o1
-       cmp             %o2, PAGE_SIZE_REM
-       bne,pt          %xcc, 1b
-        add            %o0, 0x40, %o0
-#if (PAGE_SHIFT == 16) || (PAGE_SHIFT == 22)
-       TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
-       ldda            [%o1] ASI_BLK_P, %f32
-       stda            %f48, [%o0] ASI_BLK_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
-       ldda            [%o1] ASI_BLK_P, %f0
-       stda            %f48, [%o0] ASI_BLK_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       membar          #Sync
-       stda            %f32, [%o0] ASI_BLK_P
-       add             %o0, 0x40, %o0
-       stda            %f0, [%o0] ASI_BLK_P
-#else
-       membar          #Sync
-       stda            %f0, [%o0] ASI_BLK_P
-       add             %o0, 0x40, %o0
-       stda            %f16, [%o0] ASI_BLK_P
-#endif
-copy_user_page_continue:
-       membar          #Sync
-       VISExit
-
-       mov             TLB_TAG_ACCESS, %o2
-       stxa            %g5, [%o2] ASI_DMMU
-       stxa            %g7, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-       sub             %o3, (TLBTEMP_ENTSZ), %o3
-       stxa            %o4, [%o2] ASI_DMMU
-       stxa            %o5, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-       rdpr            %pstate, %g3
-       jmpl            %o7 + 0x8, %g0
-        wrpr           %g3, PSTATE_IE, %pstate
-
-copy_page_using_blkcommit:
-       membar          #LoadStore | #StoreStore | #StoreLoad
-       ldda            [%o1] ASI_BLK_P, %f0
-       add             %o1, 0x40, %o1
-       ldda            [%o1] ASI_BLK_P, %f16
-       add             %o1, 0x40, %o1
-       sethi           %hi(PAGE_SIZE), %o2
-1:     TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
-       ldda            [%o1] ASI_BLK_P, %f32
-       stda            %f48, [%o0] ASI_BLK_COMMIT_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
-       ldda            [%o1] ASI_BLK_P, %f0
-       stda            %f48, [%o0] ASI_BLK_COMMIT_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f32, f34, f36, f38, f40, f42, f44, f46)
-       ldda            [%o1] ASI_BLK_P, %f16
-       stda            %f48, [%o0] ASI_BLK_COMMIT_P
-       sub             %o2, 0x40, %o2
-       add             %o1, 0x40, %o1
-       cmp             %o2, PAGE_SIZE_REM
-       bne,pt          %xcc, 1b
-        add            %o0, 0x40, %o0
-#if (PAGE_SHIFT == 16) || (PAGE_SHIFT == 22)
-       TOUCH(f0, f2, f4, f6, f8, f10, f12, f14)
-       ldda            [%o1] ASI_BLK_P, %f32
-       stda            %f48, [%o0] ASI_BLK_COMMIT_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       TOUCH(f16, f18, f20, f22, f24, f26, f28, f30)
-       ldda            [%o1] ASI_BLK_P, %f0
-       stda            %f48, [%o0] ASI_BLK_COMMIT_P
-       add             %o1, 0x40, %o1
-       sub             %o2, 0x40, %o2
-       add             %o0, 0x40, %o0
-       membar          #Sync
-       stda            %f32, [%o0] ASI_BLK_COMMIT_P
-       add             %o0, 0x40, %o0
-       ba,pt           %xcc, copy_user_page_continue
-        stda           %f0, [%o0] ASI_BLK_COMMIT_P
-#else
-       membar          #Sync
-       stda            %f0, [%o0] ASI_BLK_COMMIT_P
-       add             %o0, 0x40, %o0
-       ba,pt           %xcc, copy_user_page_continue
-        stda           %f16, [%o0] ASI_BLK_COMMIT_P
-#endif
-
-       .align          32
-       .globl          _clear_page
-       .type           _clear_page,@function
-_clear_page:   /* %o0=dest */
-       VISEntryHalf
-       ba,pt           %xcc, clear_page_common
-        clr            %o4
-
-       .align          32
-       .globl          clear_user_page
-       .type           clear_user_page,@function
-clear_user_page:       /* %o0=dest, %o1=vaddr */
-       VISEntryHalf
-       sethi           %hi(PAGE_SIZE), %g3
-       sethi           %uhi(PAGE_OFFSET), %g2
-       sllx            %g2, 32, %g2
-       sub             %o0, %g2, %g1
-       and             %o1, %g3, %o0
-       mov             TLB_TAG_ACCESS, %o2
-       sethi           %uhi(_PAGE_VALID | _PAGE_SZBITS), %g3
-       sethi           %hi(TLBTEMP_BASE), %o3
-       sllx            %g3, 32, %g3
-       or              %g3, (_PAGE_CP | _PAGE_CV | _PAGE_P | _PAGE_L | _PAGE_W), %g3
-       or              %g1, %g3, %g1
-       add             %o0, %o3, %o0
-#define FIX_INSN_2     0x96102068 /* mov (13 << 3), %o3 */
-cheetah_patch_2:
-       mov             TLBTEMP_ENT2, %o3
-       rdpr            %pstate, %g3
-       wrpr            %g3, PSTATE_IE, %pstate
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %g5
-       stxa            %g0, [%g5] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_TAG_READ, %g5
-
-       /* Spitfire Errata #32 workaround */
-       mov             PRIMARY_CONTEXT, %g7
-       stxa            %g0, [%g7] ASI_DMMU
-       membar          #Sync
-
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %g0
-       ldxa            [%o3] ASI_DTLB_DATA_ACCESS, %g7
-       stxa            %o0, [%o2] ASI_DMMU
-       stxa            %g1, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-
-       mov             1, %o4
-
-clear_page_common:
-       membar          #StoreLoad | #StoreStore | #LoadStore   ! LSU   Group
-       fzero           %f0                             ! FPA   Group
-       sethi           %hi(PAGE_SIZE/256), %o1         ! IEU0
-       fzero           %f2                             ! FPA   Group
-       or              %o1, %lo(PAGE_SIZE/256), %o1    ! IEU0
-       faddd           %f0, %f2, %f4                   ! FPA   Group
-       fmuld           %f0, %f2, %f6                   ! FPM
-       faddd           %f0, %f2, %f8                   ! FPA   Group
-       fmuld           %f0, %f2, %f10                  ! FPM
-
-       faddd           %f0, %f2, %f12                  ! FPA   Group
-       fmuld           %f0, %f2, %f14                  ! FPM
-1:     stda            %f0, [%o0 + %g0] ASI_BLK_P      ! Store Group
-       add             %o0, 0x40, %o0                  ! IEU0
-       stda            %f0, [%o0 + %g0] ASI_BLK_P      ! Store Group
-       add             %o0, 0x40, %o0                  ! IEU0
-       stda            %f0, [%o0 + %g0] ASI_BLK_P      ! Store Group
-
-       add             %o0, 0x40, %o0                  ! IEU0  Group
-       stda            %f0, [%o0 + %g0] ASI_BLK_P      ! Store Group
-       subcc           %o1, 1, %o1                     ! IEU1
-       bne,pt          %icc, 1b                        ! CTI
-        add            %o0, 0x40, %o0                  ! IEU0  Group
-       membar          #Sync                           ! LSU   Group
-       VISExitHalf
-
-       brnz,pt         %o4, 1f
-        nop
-
-       retl
-        nop
-
-1:
-       stxa            %g5, [%o2] ASI_DMMU
-       stxa            %g7, [%o3] ASI_DTLB_DATA_ACCESS
-       membar          #Sync
-       jmpl            %o7 + 0x8, %g0
-        wrpr           %g3, 0x0, %pstate
-
-       .globl          cheetah_patch_pgcopyops
-cheetah_patch_pgcopyops:
-       sethi           %hi(FIX_INSN_1), %g1
-       or              %g1, %lo(FIX_INSN_1), %g1
-       sethi           %hi(cheetah_patch_1), %g2
-       or              %g2, %lo(cheetah_patch_1), %g2
-       stw             %g1, [%g2]
-       flush           %g2
-       sethi           %hi(FIX_INSN_2), %g1
-       or              %g1, %lo(FIX_INSN_2), %g1
-       sethi           %hi(cheetah_patch_2), %g2
-       or              %g2, %lo(cheetah_patch_2), %g2
-       stw             %g1, [%g2]
-       flush           %g2
-       retl
-        nop
-
-#undef FIX_INSN1
-#undef FIX_INSN2
-#undef PAGE_SIZE_REM
index 640c46e..49c3dd2 100644 (file)
@@ -428,7 +428,8 @@ good_area:
                if (tlb_type == spitfire &&
                    (vma->vm_flags & VM_EXEC) != 0 &&
                    vma->vm_file != NULL)
-                       set_thread_flag(TIF_BLKCOMMIT);
+                       set_thread_fault_code(fault_code |
+                                             FAULT_CODE_BLKCOMMIT);
        } else {
                /* Allow reads even for write-only mappings */
                if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
@@ -497,6 +498,5 @@ do_sigbus:
 fault_done:
        /* These values are no longer needed, clear them. */
        set_thread_fault_code(0);
-       clear_thread_flag(TIF_BLKCOMMIT);
        current_thread_info()->fault_address = 0;
 }
index 994174a..60308ce 100644 (file)
@@ -37,8 +37,6 @@
 #include <asm/spitfire.h>
 #include <asm/sections.h>
 
-DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
-
 extern void device_scan(void);
 
 struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
@@ -252,87 +250,6 @@ out:
        put_cpu();
 }
 
-/* When shared+writable mmaps of files go away, we lose all dirty
- * page state, so we have to deal with D-cache aliasing here.
- *
- * This code relies on the fact that flush_cache_range() is always
- * called for an area composed by a single VMA.  It also assumes that
- * the MM's page_table_lock is held.
- */
-static inline void flush_cache_pte_range(struct mm_struct *mm, pmd_t *pmd, unsigned long address, unsigned long size)
-{
-       unsigned long offset;
-       pte_t *ptep;
-
-       if (pmd_none(*pmd))
-               return;
-       ptep = pte_offset_map(pmd, address);
-       offset = address & ~PMD_MASK;
-       if (offset + size > PMD_SIZE)
-               size = PMD_SIZE - offset;
-       size &= PAGE_MASK;
-       for (offset = 0; offset < size; ptep++, offset += PAGE_SIZE) {
-               pte_t pte = *ptep;
-
-               if (pte_none(pte))
-                       continue;
-
-               if (pte_present(pte) && pte_dirty(pte)) {
-                       struct page *page;
-                       unsigned long pgaddr, uaddr;
-                       unsigned long pfn = pte_pfn(pte);
-
-                       if (!pfn_valid(pfn))
-                               continue;
-                       page = pfn_to_page(pfn);
-                       if (PageReserved(page) || !page_mapping(page))
-                               continue;
-                       pgaddr = (unsigned long) page_address(page);
-                       uaddr = address + offset;
-                       if ((pgaddr ^ uaddr) & (1 << 13))
-                               flush_dcache_page_all(mm, page);
-               }
-       }
-       pte_unmap(ptep - 1);
-}
-
-static inline void flush_cache_pmd_range(struct mm_struct *mm, pgd_t *dir, unsigned long address, unsigned long size)
-{
-       pmd_t *pmd;
-       unsigned long end;
-
-       if (pgd_none(*dir))
-               return;
-       pmd = pmd_offset(dir, address);
-       end = address + size;
-       if (end > ((address + PGDIR_SIZE) & PGDIR_MASK))
-               end = ((address + PGDIR_SIZE) & PGDIR_MASK);
-       do {
-               flush_cache_pte_range(mm, pmd, address, end - address);
-               address = (address + PMD_SIZE) & PMD_MASK;
-               pmd++;
-       } while (address < end);
-}
-
-void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
-{
-       struct mm_struct *mm = vma->vm_mm;
-       pgd_t *dir = pgd_offset(mm, start);
-
-       if (mm == current->mm)
-               flushw_user();
-
-       if (vma->vm_file == NULL ||
-           ((vma->vm_flags & (VM_SHARED|VM_WRITE)) != (VM_SHARED|VM_WRITE)))
-               return;
-
-       do {
-               flush_cache_pmd_range(mm, dir, start, end - start);
-               start = (start + PGDIR_SIZE) & PGDIR_MASK;
-               dir++;
-       } while (start && (start < end));
-}
-
 void flush_icache_range(unsigned long start, unsigned long end)
 {
        /* Cheetah has coherent I-cache. */
@@ -1173,7 +1090,7 @@ struct pgtable_cache_struct pgt_quicklists;
 #else
 #define DC_ALIAS_SHIFT 0
 #endif
-pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+pte_t *__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
        struct page *page;
        unsigned long color;
index ea9f269..fc68bcb 100644 (file)
@@ -104,7 +104,6 @@ CONFIG_INET=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 825e495..544f3b0 100644 (file)
@@ -168,7 +168,6 @@ CONFIG_INET=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index e3f3cdd..147ec19 100644 (file)
@@ -82,7 +82,7 @@ static int harddog_open(struct inode *inode, struct file *file)
 
        timer_alive = 1;
        unlock_kernel();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 extern void stop_watchdog(int in_fd, int out_fd);
@@ -108,10 +108,6 @@ extern int ping_watchdog(int fd);
 static ssize_t harddog_write(struct file *file, const char *data, size_t len,
                             loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /*
         *      Refresh the timer.
         */
index e569a14..bf6969f 100644 (file)
@@ -386,7 +386,6 @@ CONFIG_IPV6=y
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
 # CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
index 282695a..2f2e29d 100644 (file)
@@ -886,7 +886,7 @@ sys32_sysctl(struct sysctl_ia32 __user *args32)
        oldvalp = (void *) A(a32.oldval);
        newvalp = (void *) A(a32.newval);
 
-       if ((oldvalp && get_user(oldlen, (int *) A(a32.oldlenp)))
+       if ((oldvalp && get_user(oldlen, (int __user *)compat_ptr(a32.oldlenp)))
            || !access_ok(VERIFY_WRITE, namep, 0)
            || !access_ok(VERIFY_WRITE, oldvalp, 0)
            || !access_ok(VERIFY_WRITE, newvalp, 0))
@@ -898,7 +898,7 @@ sys32_sysctl(struct sysctl_ia32 __user *args32)
        unlock_kernel();
        set_fs(old_fs);
 
-       if (oldvalp && put_user (oldlen, (int *) A(a32.oldlenp)))
+       if (oldvalp && put_user (oldlen, (int __user *)compat_ptr(a32.oldlenp)))
                return -EFAULT;
 
        return ret;
@@ -1291,28 +1291,20 @@ sys_timer_create(clockid_t which_clock,
 long
 sys32_timer_create(u32 clock, struct sigevent32 __user *se32, timer_t __user *timer_id)
 {
-       struct sigevent se;
-       mm_segment_t oldfs;
-       long err;
-
+       struct sigevent __user *p = NULL;
        if (se32) { 
+               struct sigevent se;
+               p = compat_alloc_user_space(sizeof(struct sigevent));
                memset(&se, 0, sizeof(struct sigevent)); 
                if (get_user(se.sigev_value.sival_int,  &se32->sigev_value) ||
                    __get_user(se.sigev_signo, &se32->sigev_signo) ||
                    __get_user(se.sigev_notify, &se32->sigev_notify) ||
                    __copy_from_user(&se._sigev_un._pad, &se32->payload, 
-                                    sizeof(se32->payload)))
+                                    sizeof(se32->payload)) ||
+                   copy_to_user(p, &se, sizeof(se)))
                        return -EFAULT;
        } 
-       if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, se32 ? &se : NULL, timer_id);
-       set_fs(oldfs); 
-       
-       return err; 
+       return sys_timer_create(clock, p, timer_id);
 } 
 
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
index 0425e55..c52b859 100644 (file)
@@ -75,7 +75,7 @@ BUILD_16_IRQS(0x4) BUILD_16_IRQS(0x5) BUILD_16_IRQS(0x6) BUILD_16_IRQS(0x7)
 BUILD_16_IRQS(0x8) BUILD_16_IRQS(0x9) BUILD_16_IRQS(0xa) BUILD_16_IRQS(0xb)
 BUILD_16_IRQS(0xc) BUILD_16_IRQS(0xd)
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
        BUILD_14_IRQS(0xe)
 #endif
 
@@ -110,7 +110,7 @@ void (*interrupt[NR_IRQS])(void) = {
        IRQLIST_16(0x8), IRQLIST_16(0x9), IRQLIST_16(0xa), IRQLIST_16(0xb),
        IRQLIST_16(0xc), IRQLIST_16(0xd)
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
        , IRQLIST_14(0xe)
 #endif
 
index 3869af6..6cb45b7 100644 (file)
@@ -68,7 +68,7 @@ static struct irq_pin_list {
 } irq_2_pin[PIN_MAP_SIZE];
 
 int vector_irq[NR_VECTORS] = { [0 ... NR_VECTORS - 1] = -1};
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 #define vector_to_irq(vector)  \
        (platform_legacy_irq(vector) ? vector : vector_irq[vector])
 #else
@@ -656,7 +656,7 @@ static inline int IO_APIC_irq_trigger(int irq)
 /* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
 u8 irq_vector[NR_IRQ_VECTORS] = { FIRST_DEVICE_VECTOR , 0 };
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 int assign_irq_vector(int irq)
 #else
 int __init assign_irq_vector(int irq)
@@ -1406,7 +1406,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t mask)
        spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 static unsigned int startup_edge_ioapic_vector(unsigned int vector)
 {
        int irq = vector_to_irq(vector);
@@ -1747,7 +1747,7 @@ static inline void check_timer(void)
                return;
        }
        printk(" failed :(.\n");
-       panic("IO-APIC + timer doesn't work! pester mingo@redhat.com");
+       panic("IO-APIC + timer doesn't work! Try using the 'noapic' kernel parameter\n");
 }
 
 /*
index c5b647f..646b3c0 100644 (file)
@@ -44,7 +44,7 @@ int acpi_found_madt;
 int apic_version [MAX_APICS];
 unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
 int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
-cpumask_t mp_bus_to_cpumask [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = CPU_MASK_ALL };
+cpumask_t pci_bus_to_cpumask [256] = { [0 ... 255] = CPU_MASK_ALL };
 
 int mp_current_pci_id = 0;
 /* I/O APIC entries */
index 938bafe..09fde74 100644 (file)
@@ -70,6 +70,8 @@ int iommu_fullflush = 1;
 static spinlock_t iommu_bitmap_lock = SPIN_LOCK_UNLOCKED;
 static unsigned long *iommu_gart_bitmap; /* guarded by iommu_bitmap_lock */
 
+static u32 gart_unmapped_entry; 
+
 #define GPTE_VALID    1
 #define GPTE_COHERENT 2
 #define GPTE_ENCODE(x) \
@@ -147,8 +149,6 @@ static void free_iommu(unsigned long offset, int size)
 static void flush_gart(struct pci_dev *dev)
 { 
        unsigned long flags;
-       int bus = dev ? dev->bus->number : -1;
-       cpumask_t bus_cpumask = pcibus_to_cpumask(bus);
        int flushed = 0;
        int i;
 
@@ -158,8 +158,6 @@ static void flush_gart(struct pci_dev *dev)
                        u32 w;
                        if (!northbridges[i]) 
                                continue;
-                       if (bus >= 0 && !(cpu_isset(i, bus_cpumask)))
-                               continue;
                        pci_write_config_dword(northbridges[i], 0x9c, 
                                               northbridge_flush_word[i] | 1); 
                        /* Make sure the hardware actually executed the flush. */
@@ -169,7 +167,7 @@ static void flush_gart(struct pci_dev *dev)
                        flushed++;
                } 
                if (!flushed) 
-                       printk("nothing to flush? %d\n", bus);
+                       printk("nothing to flush?\n");
                need_flush = 0;
        } 
        spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
@@ -479,6 +477,11 @@ int pci_map_sg(struct pci_dev *dev, struct scatterlist *sg, int nents, int dir)
        unsigned long pages = 0;
        int need = 0, nextneed;
 
+#ifdef CONFIG_SWIOTLB
+       if (swiotlb)
+               return swiotlb_map_sg(&dev->dev,sg,nents,dir);
+#endif
+
        BUG_ON(dir == PCI_DMA_NONE);
        if (nents == 0) 
                return 0;
@@ -562,7 +565,7 @@ void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
        iommu_page = (dma_addr - iommu_bus_base)>>PAGE_SHIFT;   
        npages = to_pages(dma_addr, size);
        for (i = 0; i < npages; i++) { 
-               iommu_gatt_base[iommu_page + i] = 0
+               iommu_gatt_base[iommu_page + i] = gart_unmapped_entry
                CLEAR_LEAK(iommu_page + i);
        }
        free_iommu(iommu_page, npages);
@@ -729,7 +732,8 @@ static int __init pci_iommu_init(void)
        unsigned long aper_size;
        unsigned long iommu_start;
        struct pci_dev *dev;
-               
+       unsigned long scratch;
+       long i;
 
 #ifndef CONFIG_AGP_AMD64
        no_agp = 1; 
@@ -766,7 +770,7 @@ static int __init pci_iommu_init(void)
                        return -1;
                }
        } 
-       
+
        aper_size = info.aper_size * 1024 * 1024;       
        iommu_size = check_iommu_size(info.aper_base, aper_size); 
        iommu_pages = iommu_size >> PAGE_SHIFT; 
@@ -815,6 +819,19 @@ static int __init pci_iommu_init(void)
         */
        clear_kernel_mapping((unsigned long)__va(iommu_bus_base), iommu_size);
 
+       /* 
+        * Try to workaround a bug (thanks to BenH) 
+        * Set unmapped entries to a scratch page instead of 0. 
+        * Any prefetches that hit unmapped entries won't get an bus abort
+        * then.
+        */
+       scratch = get_zeroed_page(GFP_KERNEL); 
+       if (!scratch) 
+               panic("Cannot allocate iommu scratch page");
+       gart_unmapped_entry = GPTE_ENCODE(__pa(scratch));
+       for (i = EMERGENCY_PAGES; i < iommu_pages; i++) 
+               iommu_gatt_base[i] = gart_unmapped_entry;
+
        for_all_nb(dev) {
                u32 flag; 
                int cpu = PCI_SLOT(dev->devfn) - 24;
index d814db6..f6eb0e3 100644 (file)
@@ -242,7 +242,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 
        if (me->used_math) {
                fp = get_stack(ka, regs, sizeof(struct _fpstate)); 
-               frame = (void __user *)round_down((u64)fp - sizeof(struct rt_sigframe), 16) - 8;
+               frame = (void __user *)round_down((unsigned long)fp - sizeof(struct rt_sigframe), 16) - 8;
 
                if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) { 
                goto give_sigsegv;
index 0693740..29f2578 100644 (file)
@@ -659,7 +659,7 @@ static void __init do_boot_cpu (int apicid)
                        Dprintk("CPU has booted.\n");
                } else {
                        boot_error = 1;
-                       if (*((volatile unsigned char *)phys_to_virt(8192))
+                       if (*((volatile unsigned char *)phys_to_virt(SMP_TRAMPOLINE_BASE))
                                        == 0xA5)
                                /* trampoline started but...? */
                                printk("Stuck ??\n");
@@ -676,9 +676,6 @@ static void __init do_boot_cpu (int apicid)
                clear_bit(cpu, &cpu_initialized); /* was set by cpu_init() */
                cpucount--;
        }
-
-       /* mark "stuck" area as not stuck */
-       *((volatile unsigned *)phys_to_virt(8192)) = 0;
 }
 
 cycles_t cacheflush_time;
index 14bbe9e..b8cf5d9 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for the linux x86_64-specific parts of the memory manager.
 #
 
-obj-y   := init.o fault.o ioremap.o extable.o pageattr.o
+obj-y   := init.o fault.o ioremap.o extable.o pageattr.o mmap.o
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
 obj-$(CONFIG_DISCONTIGMEM) += numa.o
 obj-$(CONFIG_K8_NUMA) += k8topology.o
index 75825f0..a51772d 100644 (file)
@@ -374,7 +374,7 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
        __flush_tlb_all();
 } 
 
-int page_is_ram (unsigned long pagenr)
+static inline int page_is_ram (unsigned long pagenr)
 {
        int i;
 
@@ -396,6 +396,26 @@ int page_is_ram (unsigned long pagenr)
        return 0;
 }
 
+/*
+ * 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-64, 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)
+               return 1;
+       if (!page_is_ram(pagenr))
+               return 1;
+       return 0;
+}
+
+
 static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
                         kcore_vsyscall;
 
diff --git a/configs/kernel-2.6.7-i586-smp.config b/configs/kernel-2.6.7-i586-smp.config
deleted file mode 100644 (file)
index c1d4cfa..0000000
+++ /dev/null
@@ -1,2399 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_X86=y
-CONFIG_MMU=y
-CONFIG_UID16=y
-CONFIG_GENERIC_ISA_DMA=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
-CONFIG_LOG_BUF_SHIFT=17
-CONFIG_HOTPLUG=y
-# CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-CONFIG_KMOD=y
-CONFIG_STOP_MACHINE=y
-
-#
-# Processor type and features
-#
-CONFIG_X86_PC=y
-# CONFIG_X86_ELAN is not set
-# CONFIG_X86_VOYAGER is not set
-# CONFIG_X86_NUMAQ is not set
-# CONFIG_X86_SUMMIT is not set
-# CONFIG_X86_BIGSMP is not set
-# CONFIG_X86_VISWS is not set
-# CONFIG_X86_GENERICARCH is not set
-# CONFIG_X86_ES7000 is not set
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-CONFIG_M586=y
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-# CONFIG_M686 is not set
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP2 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-CONFIG_X86_GENERIC=y
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_XADD=y
-CONFIG_X86_L1_CACHE_SHIFT=7
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_F00F_BUG=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_ALIGNMENT_16=y
-CONFIG_X86_INTEL_USERCOPY=y
-# CONFIG_X86_4G is not set
-# CONFIG_X86_SWITCH_PAGETABLES is not set
-# CONFIG_X86_4G_VM_LAYOUT is not set
-# CONFIG_X86_UACCESS_INDIRECT is not set
-# CONFIG_X86_HIGH_ENTRY is not set
-CONFIG_HPET_TIMER=y
-CONFIG_HPET_EMULATE_RTC=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=8
-CONFIG_SCHED_SMT=y
-# CONFIG_PREEMPT is not set
-CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_IO_APIC=y
-CONFIG_X86_MCE=y
-# CONFIG_X86_MCE_NONFATAL is not set
-CONFIG_X86_MCE_P4THERMAL=y
-CONFIG_TOSHIBA=m
-CONFIG_I8K=m
-# CONFIG_MICROCODE is not set
-CONFIG_X86_MSR=m
-CONFIG_X86_CPUID=m
-
-#
-# Firmware Drivers
-#
-CONFIG_EDD=m
-# CONFIG_NOHIGHMEM is not set
-CONFIG_HIGHMEM4G=y
-# CONFIG_HIGHMEM64G is not set
-CONFIG_HIGHMEM=y
-CONFIG_HIGHPTE=y
-# CONFIG_MATH_EMULATION is not set
-CONFIG_MTRR=y
-# CONFIG_EFI is not set
-# CONFIG_IRQBALANCE is not set
-CONFIG_HAVE_DEC_LOCK=y
-CONFIG_REGPARM=y
-
-#
-# Power management options (ACPI, APM)
-#
-CONFIG_PM=y
-# CONFIG_SOFTWARE_SUSPEND is not set
-# CONFIG_PM_DISK is not set
-
-#
-# ACPI (Advanced Configuration and Power Interface) Support
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_AC=m
-CONFIG_ACPI_BATTERY=m
-CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_FAN=y
-CONFIG_ACPI_PROCESSOR=y
-CONFIG_ACPI_THERMAL=y
-CONFIG_ACPI_ASUS=m
-CONFIG_ACPI_TOSHIBA=m
-# CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
-CONFIG_ACPI_EC=y
-CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
-CONFIG_ACPI_SYSTEM=y
-CONFIG_X86_PM_TIMER=y
-
-#
-# APM (Advanced Power Management) BIOS Support
-#
-CONFIG_APM=y
-# CONFIG_APM_IGNORE_USER_SUSPEND is not set
-# CONFIG_APM_DO_ENABLE is not set
-CONFIG_APM_CPU_IDLE=y
-# CONFIG_APM_DISPLAY_BLANK is not set
-CONFIG_APM_RTC_IS_GMT=y
-# CONFIG_APM_ALLOW_INTS is not set
-# CONFIG_APM_REAL_MODE_POWER_OFF is not set
-
-#
-# CPU Frequency scaling
-#
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_PROC_INTF is not set
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-CONFIG_CPU_FREQ_GOV_POWERSAVE=m
-CONFIG_CPU_FREQ_GOV_USERSPACE=y
-# CONFIG_CPU_FREQ_24_API is not set
-CONFIG_CPU_FREQ_TABLE=y
-
-#
-# CPUFreq processor drivers
-#
-CONFIG_X86_ACPI_CPUFREQ=m
-# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
-CONFIG_X86_POWERNOW_K6=m
-CONFIG_X86_POWERNOW_K7=y
-CONFIG_X86_POWERNOW_K8=m
-# CONFIG_X86_GX_SUSPMOD is not set
-CONFIG_X86_SPEEDSTEP_CENTRINO=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y
-CONFIG_X86_SPEEDSTEP_ICH=y
-CONFIG_X86_SPEEDSTEP_SMI=m
-CONFIG_X86_P4_CLOCKMOD=m
-CONFIG_X86_SPEEDSTEP_LIB=y
-# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
-CONFIG_X86_LONGRUN=y
-# CONFIG_X86_LONGHAUL is not set
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-CONFIG_PCI=y
-# CONFIG_PCI_GOBIOS is not set
-# CONFIG_PCI_GOMMCONFIG is not set
-# CONFIG_PCI_GODIRECT is not set
-CONFIG_PCI_GOANY=y
-CONFIG_PCI_BIOS=y
-CONFIG_PCI_DIRECT=y
-CONFIG_PCI_MMCONFIG=y
-CONFIG_PCI_USE_VECTOR=y
-CONFIG_PCI_LEGACY_PROC=y
-# CONFIG_PCI_NAMES is not set
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SCx200 is not set
-
-#
-# PCMCIA/CardBus support
-#
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
-CONFIG_CARDBUS=y
-CONFIG_I82092=m
-CONFIG_I82365=m
-CONFIG_TCIC=m
-CONFIG_PCMCIA_PROBE=y
-
-#
-# PCI Hotplug Support
-#
-CONFIG_HOTPLUG_PCI=y
-# CONFIG_HOTPLUG_PCI_FAKE is not set
-CONFIG_HOTPLUG_PCI_COMPAQ=m
-# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
-CONFIG_HOTPLUG_PCI_IBM=m
-# CONFIG_HOTPLUG_PCI_ACPI is not set
-# CONFIG_HOTPLUG_PCI_CPCI is not set
-CONFIG_HOTPLUG_PCI_PCIE=m
-CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y
-CONFIG_HOTPLUG_PCI_SHPC=m
-CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_FW_LOADER=y
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=m
-# CONFIG_MTD_DEBUG is not set
-CONFIG_MTD_PARTITIONS=m
-CONFIG_MTD_CONCAT=m
-CONFIG_MTD_REDBOOT_PARTS=m
-CONFIG_MTD_CMDLINE_PARTS=m
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=m
-CONFIG_MTD_BLOCK=m
-CONFIG_MTD_BLOCK_RO=m
-CONFIG_FTL=m
-CONFIG_NFTL=m
-CONFIG_NFTL_RW=y
-CONFIG_INFTL=m
-
-#
-# RAM/ROM/Flash chip drivers
-#
-CONFIG_MTD_CFI=m
-CONFIG_MTD_JEDECPROBE=m
-CONFIG_MTD_GEN_PROBE=m
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_CFI_INTELEXT=m
-CONFIG_MTD_CFI_AMDSTD=m
-CONFIG_MTD_CFI_STAA=m
-CONFIG_MTD_RAM=m
-CONFIG_MTD_ROM=m
-CONFIG_MTD_ABSENT=m
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_PNC2000 is not set
-CONFIG_MTD_SC520CDP=m
-CONFIG_MTD_NETSC520=m
-CONFIG_MTD_SBC_GXX=m
-CONFIG_MTD_ELAN_104NC=m
-CONFIG_MTD_SCx200_DOCFLASH=m
-CONFIG_MTD_AMD76XROM=m
-CONFIG_MTD_ICH2ROM=m
-CONFIG_MTD_SCB2_FLASH=m
-# CONFIG_MTD_NETtel is not set
-# CONFIG_MTD_DILNETPC is not set
-CONFIG_MTD_L440GX=m
-CONFIG_MTD_PCI=m
-
-#
-# Self-contained MTD device drivers
-#
-CONFIG_MTD_PMC551=m
-# CONFIG_MTD_PMC551_BUGFIX is not set
-# CONFIG_MTD_PMC551_DEBUG is not set
-# CONFIG_MTD_SLRAM is not set
-CONFIG_MTD_MTDRAM=m
-CONFIG_MTDRAM_TOTAL_SIZE=4096
-CONFIG_MTDRAM_ERASE_SIZE=128
-# CONFIG_MTD_BLKMTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-CONFIG_MTD_DOC2000=m
-# CONFIG_MTD_DOC2001 is not set
-CONFIG_MTD_DOC2001PLUS=m
-CONFIG_MTD_DOCPROBE=m
-# CONFIG_MTD_DOCPROBE_ADVANCED is not set
-CONFIG_MTD_DOCPROBE_ADDRESS=0
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-CONFIG_MTD_NAND_IDS=m
-
-#
-# Parallel port support
-#
-CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-CONFIG_PARPORT_SERIAL=m
-# CONFIG_PARPORT_PC_FIFO is not set
-# CONFIG_PARPORT_PC_SUPERIO is not set
-CONFIG_PARPORT_PC_PCMCIA=m
-# CONFIG_PARPORT_OTHER is not set
-CONFIG_PARPORT_1284=y
-
-#
-# Plug and Play support
-#
-CONFIG_PNP=y
-# CONFIG_PNP_DEBUG is not set
-
-#
-# Protocols
-#
-CONFIG_ISAPNP=y
-# CONFIG_PNPBIOS is not set
-
-#
-# Block devices
-#
-CONFIG_BLK_DEV_FD=m
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-CONFIG_BLK_CPQ_DA=m
-CONFIG_BLK_CPQ_CISS_DA=m
-CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_DEV_DAC960=m
-CONFIG_BLK_DEV_UMEM=m
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_CRYPTOLOOP=m
-CONFIG_BLK_DEV_NBD=m
-CONFIG_BLK_DEV_CARMEL=m
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=16384
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_LBD=y
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_HD_IDE is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
-CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDETAPE=m
-CONFIG_BLK_DEV_IDEFLOPPY=y
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_CMD640 is not set
-CONFIG_BLK_DEV_IDEPNP=y
-CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
-# CONFIG_BLK_DEV_OPTI621 is not set
-CONFIG_BLK_DEV_RZ1000=y
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-CONFIG_IDEDMA_PCI_AUTO=y
-# CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
-CONFIG_BLK_DEV_AEC62XX=y
-CONFIG_BLK_DEV_ALI15X3=y
-# CONFIG_WDC_ALI15X3 is not set
-CONFIG_BLK_DEV_AMD74XX=y
-CONFIG_BLK_DEV_ATIIXP=y
-CONFIG_BLK_DEV_CMD64X=y
-CONFIG_BLK_DEV_TRIFLEX=y
-CONFIG_BLK_DEV_CY82C693=y
-CONFIG_BLK_DEV_CS5520=y
-CONFIG_BLK_DEV_CS5530=y
-CONFIG_BLK_DEV_HPT34X=y
-# CONFIG_HPT34X_AUTODMA is not set
-CONFIG_BLK_DEV_HPT366=y
-# CONFIG_BLK_DEV_SC1200 is not set
-CONFIG_BLK_DEV_PIIX=y
-# CONFIG_BLK_DEV_NS87415 is not set
-CONFIG_BLK_DEV_PDC202XX_OLD=y
-# CONFIG_PDC202XX_BURST is not set
-CONFIG_BLK_DEV_PDC202XX_NEW=y
-CONFIG_PDC202XX_FORCE=y
-CONFIG_BLK_DEV_SVWKS=y
-CONFIG_BLK_DEV_SIIMAGE=y
-CONFIG_BLK_DEV_SIS5513=y
-CONFIG_BLK_DEV_SLC90E66=y
-# CONFIG_BLK_DEV_TRM290 is not set
-CONFIG_BLK_DEV_VIA82CXXX=y
-# CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-CONFIG_SCSI=m
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=m
-CONFIG_CHR_DEV_ST=m
-CONFIG_CHR_DEV_OSST=m
-CONFIG_BLK_DEV_SR=m
-CONFIG_BLK_DEV_SR_VENDOR=y
-CONFIG_CHR_DEV_SG=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-CONFIG_SCSI_CONSTANTS=y
-CONFIG_SCSI_LOGGING=y
-
-#
-# SCSI Transport Attributes
-#
-CONFIG_SCSI_SPI_ATTRS=m
-CONFIG_SCSI_FC_ATTRS=m
-
-#
-# SCSI low-level drivers
-#
-CONFIG_BLK_DEV_3W_XXXX_RAID=m
-CONFIG_SCSI_3W_9XXX=m
-# CONFIG_SCSI_7000FASST is not set
-CONFIG_SCSI_ACARD=m
-CONFIG_SCSI_AHA152X=m
-CONFIG_SCSI_AHA1542=m
-CONFIG_SCSI_AACRAID=m
-CONFIG_SCSI_AIC7XXX=m
-CONFIG_AIC7XXX_CMDS_PER_DEVICE=4
-CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
-# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
-CONFIG_AIC7XXX_DEBUG_MASK=0
-# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
-CONFIG_SCSI_AIC7XXX_OLD=m
-CONFIG_SCSI_AIC79XX=m
-CONFIG_AIC79XX_CMDS_PER_DEVICE=4
-CONFIG_AIC79XX_RESET_DELAY_MS=15000
-# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
-# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
-# CONFIG_AIC79XX_DEBUG_ENABLE is not set
-CONFIG_AIC79XX_DEBUG_MASK=0
-# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
-# CONFIG_SCSI_DPT_I2O is not set
-CONFIG_SCSI_ADVANSYS=m
-CONFIG_SCSI_IN2000=m
-CONFIG_SCSI_MEGARAID=m
-CONFIG_SCSI_SATA=y
-CONFIG_SCSI_SATA_SVW=m
-CONFIG_SCSI_ATA_PIIX=m
-CONFIG_SCSI_SATA_PROMISE=m
-CONFIG_SCSI_SATA_SX4=m
-CONFIG_SCSI_SATA_SIL=m
-CONFIG_SCSI_SATA_SIS=m
-CONFIG_SCSI_SATA_VIA=m
-CONFIG_SCSI_SATA_VITESSE=m
-CONFIG_SCSI_BUSLOGIC=m
-# CONFIG_SCSI_OMIT_FLASHPOINT is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_PIO is not set
-CONFIG_SCSI_FUTURE_DOMAIN=m
-CONFIG_SCSI_GDTH=m
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
-CONFIG_SCSI_IPS=m
-CONFIG_SCSI_INIA100=m
-CONFIG_SCSI_PPA=m
-CONFIG_SCSI_IMM=m
-# CONFIG_SCSI_IZIP_EPP16 is not set
-# CONFIG_SCSI_IZIP_SLOW_CTR is not set
-# CONFIG_SCSI_NCR53C406A is not set
-CONFIG_SCSI_SYM53C8XX_2=m
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-CONFIG_SCSI_QLOGIC_FAS=m
-CONFIG_SCSI_QLOGIC_ISP=m
-# CONFIG_SCSI_QLOGIC_FC is not set
-CONFIG_SCSI_QLOGIC_1280=m
-CONFIG_SCSI_QLA2XXX=m
-CONFIG_SCSI_QLA21XX=m
-CONFIG_SCSI_QLA22XX=m
-CONFIG_SCSI_QLA2300=m
-CONFIG_SCSI_QLA2322=m
-CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
-# CONFIG_SCSI_SYM53C416 is not set
-# CONFIG_SCSI_DC395x is not set
-CONFIG_SCSI_DC390T=m
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_U14_34F is not set
-# CONFIG_SCSI_ULTRASTOR is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_DEBUG is not set
-
-#
-# PCMCIA SCSI adapter support
-#
-CONFIG_PCMCIA_AHA152X=m
-CONFIG_PCMCIA_FDOMAIN=m
-CONFIG_PCMCIA_NINJA_SCSI=m
-CONFIG_PCMCIA_QLOGIC=m
-CONFIG_PCMCIA_SYM53C500=m
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=m
-CONFIG_MD_RAID0=m
-CONFIG_MD_RAID1=m
-CONFIG_MD_RAID5=m
-CONFIG_MD_RAID6=m
-CONFIG_MD_MULTIPATH=m
-CONFIG_BLK_DEV_DM=m
-CONFIG_DM_CRYPT=m
-CONFIG_DM_SNAPSHOT=m
-CONFIG_DM_MIRROR=m
-CONFIG_DM_ZERO=m
-
-#
-# Fusion MPT device support
-#
-CONFIG_FUSION=m
-CONFIG_FUSION_MAX_SGE=40
-# CONFIG_FUSION_ISENSE is not set
-CONFIG_FUSION_CTL=m
-CONFIG_FUSION_LAN=m
-
-#
-# IEEE 1394 (FireWire) support
-#
-CONFIG_IEEE1394=m
-
-#
-# Subsystem Options
-#
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
-CONFIG_IEEE1394_OUI_DB=y
-# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
-
-#
-# Device Drivers
-#
-# CONFIG_IEEE1394_PCILYNX is not set
-CONFIG_IEEE1394_OHCI1394=m
-
-#
-# Protocol Drivers
-#
-CONFIG_IEEE1394_VIDEO1394=m
-CONFIG_IEEE1394_SBP2=m
-# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
-# CONFIG_IEEE1394_ETH1394 is not set
-CONFIG_IEEE1394_DV1394=m
-CONFIG_IEEE1394_RAWIO=m
-CONFIG_IEEE1394_CMP=m
-CONFIG_IEEE1394_AMDTP=m
-
-#
-# I2O device support
-#
-CONFIG_I2O=m
-CONFIG_I2O_CONFIG=m
-CONFIG_I2O_BLOCK=m
-CONFIG_I2O_SCSI=m
-CONFIG_I2O_PROC=m
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_FWMARK=y
-CONFIG_IP_ROUTE_NAT=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_TOS=y
-CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_PNP is not set
-CONFIG_NET_IPIP=m
-CONFIG_NET_IPGRE=m
-CONFIG_NET_IPGRE_BROADCAST=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-# CONFIG_ARPD is not set
-CONFIG_SYN_COOKIES=y
-CONFIG_INET_AH=m
-CONFIG_INET_ESP=m
-CONFIG_INET_IPCOMP=m
-
-#
-# IP: Virtual Server Configuration
-#
-CONFIG_IP_VS=m
-# CONFIG_IP_VS_DEBUG is not set
-CONFIG_IP_VS_TAB_BITS=12
-
-#
-# IPVS transport protocol load balancing support
-#
-CONFIG_IP_VS_PROTO_TCP=y
-CONFIG_IP_VS_PROTO_UDP=y
-CONFIG_IP_VS_PROTO_ESP=y
-CONFIG_IP_VS_PROTO_AH=y
-
-#
-# IPVS scheduler
-#
-CONFIG_IP_VS_RR=m
-CONFIG_IP_VS_WRR=m
-CONFIG_IP_VS_LC=m
-CONFIG_IP_VS_WLC=m
-CONFIG_IP_VS_LBLC=m
-CONFIG_IP_VS_LBLCR=m
-CONFIG_IP_VS_DH=m
-CONFIG_IP_VS_SH=m
-CONFIG_IP_VS_SED=m
-CONFIG_IP_VS_NQ=m
-
-#
-# IPVS application helper
-#
-CONFIG_IP_VS_FTP=m
-CONFIG_IPV6=m
-CONFIG_IPV6_PRIVACY=y
-CONFIG_INET6_AH=m
-CONFIG_INET6_ESP=m
-CONFIG_INET6_IPCOMP=m
-CONFIG_IPV6_TUNNEL=m
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-CONFIG_BRIDGE_NETFILTER=y
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_IP_NF_CONNTRACK=m
-CONFIG_IP_NF_FTP=m
-CONFIG_IP_NF_IRC=m
-CONFIG_IP_NF_TFTP=m
-CONFIG_IP_NF_AMANDA=m
-CONFIG_IP_NF_QUEUE=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_LIMIT=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_MAC=m
-CONFIG_IP_NF_MATCH_PKTTYPE=m
-CONFIG_IP_NF_MATCH_MARK=m
-CONFIG_IP_NF_MATCH_MULTIPORT=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
-CONFIG_IP_NF_MATCH_DSCP=m
-CONFIG_IP_NF_MATCH_AH_ESP=m
-CONFIG_IP_NF_MATCH_LENGTH=m
-CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_TCPMSS=m
-CONFIG_IP_NF_MATCH_HELPER=m
-CONFIG_IP_NF_MATCH_STATE=m
-CONFIG_IP_NF_MATCH_CONNTRACK=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_PHYSDEV=m
-CONFIG_IP_NF_FILTER=m
-CONFIG_IP_NF_TARGET_REJECT=m
-CONFIG_IP_NF_NAT=m
-CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
-CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
-CONFIG_IP_NF_NAT_LOCAL=y
-CONFIG_IP_NF_NAT_SNMP_BASIC=m
-CONFIG_IP_NF_NAT_IRC=m
-CONFIG_IP_NF_NAT_FTP=m
-CONFIG_IP_NF_NAT_TFTP=m
-CONFIG_IP_NF_NAT_AMANDA=m
-CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
-CONFIG_IP_NF_TARGET_ECN=m
-CONFIG_IP_NF_TARGET_DSCP=m
-CONFIG_IP_NF_TARGET_MARK=m
-CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
-CONFIG_IP_NF_ARPTABLES=m
-CONFIG_IP_NF_ARPFILTER=m
-CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
-
-#
-# IPv6: Netfilter Configuration
-#
-# CONFIG_IP6_NF_QUEUE is not set
-CONFIG_IP6_NF_IPTABLES=m
-CONFIG_IP6_NF_MATCH_LIMIT=m
-CONFIG_IP6_NF_MATCH_MAC=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_MATCH_OPTS=m
-CONFIG_IP6_NF_MATCH_FRAG=m
-CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_MULTIPORT=m
-CONFIG_IP6_NF_MATCH_OWNER=m
-CONFIG_IP6_NF_MATCH_MARK=m
-CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_AHESP=m
-CONFIG_IP6_NF_MATCH_LENGTH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_FILTER=m
-CONFIG_IP6_NF_TARGET_LOG=m
-CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_TARGET_MARK=m
-CONFIG_IP6_NF_RAW=m
-
-#
-# Bridge: Netfilter Configuration
-#
-CONFIG_BRIDGE_NF_EBTABLES=m
-CONFIG_BRIDGE_EBT_BROUTE=m
-CONFIG_BRIDGE_EBT_T_FILTER=m
-CONFIG_BRIDGE_EBT_T_NAT=m
-CONFIG_BRIDGE_EBT_802_3=m
-CONFIG_BRIDGE_EBT_AMONG=m
-CONFIG_BRIDGE_EBT_ARP=m
-CONFIG_BRIDGE_EBT_IP=m
-CONFIG_BRIDGE_EBT_LIMIT=m
-CONFIG_BRIDGE_EBT_MARK=m
-CONFIG_BRIDGE_EBT_PKTTYPE=m
-CONFIG_BRIDGE_EBT_STP=m
-CONFIG_BRIDGE_EBT_VLAN=m
-CONFIG_BRIDGE_EBT_ARPREPLY=m
-CONFIG_BRIDGE_EBT_DNAT=m
-CONFIG_BRIDGE_EBT_MARK_T=m
-CONFIG_BRIDGE_EBT_REDIRECT=m
-CONFIG_BRIDGE_EBT_SNAT=m
-CONFIG_BRIDGE_EBT_LOG=m
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-CONFIG_IP_SCTP=m
-# CONFIG_SCTP_DBG_MSG is not set
-# CONFIG_SCTP_DBG_OBJCNT is not set
-# CONFIG_SCTP_HMAC_NONE is not set
-# CONFIG_SCTP_HMAC_SHA1 is not set
-CONFIG_SCTP_HMAC_MD5=y
-# CONFIG_ATM is not set
-CONFIG_BRIDGE=m
-CONFIG_VLAN_8021Q=m
-# CONFIG_DECNET is not set
-CONFIG_LLC=m
-# CONFIG_LLC2 is not set
-CONFIG_IPX=m
-# CONFIG_IPX_INTERN is not set
-CONFIG_ATALK=m
-CONFIG_DEV_APPLETALK=y
-CONFIG_LTPC=m
-CONFIG_COPS=m
-CONFIG_COPS_DAYNA=y
-CONFIG_COPS_TANGENT=y
-CONFIG_IPDDP=m
-CONFIG_IPDDP_ENCAP=y
-CONFIG_IPDDP_DECAP=y
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-CONFIG_NET_DIVERT=y
-# CONFIG_ECONET is not set
-CONFIG_WAN_ROUTER=m
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
-
-#
-# QoS and/or fair queueing
-#
-CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
-CONFIG_NET_SCH_HTB=m
-CONFIG_NET_SCH_HFSC=m
-CONFIG_NET_SCH_CSZ=m
-CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RED=m
-CONFIG_NET_SCH_SFQ=m
-CONFIG_NET_SCH_TEQL=m
-CONFIG_NET_SCH_TBF=m
-CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
-CONFIG_NET_SCH_DELAY=m
-CONFIG_NET_SCH_INGRESS=m
-CONFIG_NET_QOS=y
-CONFIG_NET_ESTIMATOR=y
-CONFIG_NET_CLS=y
-CONFIG_NET_CLS_TCINDEX=m
-CONFIG_NET_CLS_ROUTE4=m
-CONFIG_NET_CLS_ROUTE=y
-CONFIG_NET_CLS_FW=m
-CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
-CONFIG_NET_CLS_POLICE=y
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-CONFIG_NETPOLL=y
-# CONFIG_NETPOLL_RX is not set
-# CONFIG_NETPOLL_TRAP is not set
-CONFIG_NET_POLL_CONTROLLER=y
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRNET=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-CONFIG_DONGLE=y
-CONFIG_ESI_DONGLE=m
-CONFIG_ACTISYS_DONGLE=m
-CONFIG_TEKRAM_DONGLE=m
-CONFIG_LITELINK_DONGLE=m
-CONFIG_MA600_DONGLE=m
-CONFIG_GIRBIL_DONGLE=m
-CONFIG_MCP2120_DONGLE=m
-CONFIG_OLD_BELKIN_DONGLE=m
-CONFIG_ACT200L_DONGLE=m
-
-#
-# Old SIR device drivers
-#
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_USB_IRDA=m
-CONFIG_SIGMATEL_FIR=m
-CONFIG_NSC_FIR=m
-# CONFIG_WINBOND_FIR is not set
-# CONFIG_TOSHIBA_FIR is not set
-# CONFIG_SMC_IRCC_FIR is not set
-# CONFIG_ALI_FIR is not set
-# CONFIG_VLSI_FIR is not set
-# CONFIG_VIA_FIR is not set
-CONFIG_BT=m
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_CMTP=m
-
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_HCIUSB=m
-CONFIG_BT_HCIUSB_SCO=y
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_BCSP_TXCRC=y
-CONFIG_BT_HCIBCM203X=m
-CONFIG_BT_HCIBFUSB=m
-CONFIG_BT_HCIDTL1=m
-CONFIG_BT_HCIBT3C=m
-CONFIG_BT_HCIBLUECARD=m
-CONFIG_BT_HCIBTUART=m
-CONFIG_BT_HCIVHCI=m
-CONFIG_TUX=m
-
-#
-# TUX options
-#
-CONFIG_TUX_EXTCGI=y
-# CONFIG_TUX_EXTENDED_LOG is not set
-# CONFIG_TUX_DEBUG is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-CONFIG_EQUALIZER=m
-CONFIG_TUN=m
-CONFIG_ETHERTAP=m
-CONFIG_NET_SB1000=m
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
-CONFIG_HAPPYMEAL=m
-CONFIG_SUNGEM=m
-CONFIG_NET_VENDOR_3COM=y
-CONFIG_EL1=m
-CONFIG_EL2=m
-CONFIG_ELPLUS=m
-CONFIG_EL16=m
-CONFIG_EL3=m
-CONFIG_3C515=m
-CONFIG_VORTEX=m
-# CONFIG_TYPHOON is not set
-CONFIG_LANCE=m
-CONFIG_NET_VENDOR_SMC=y
-CONFIG_WD80x3=m
-CONFIG_ULTRA=m
-CONFIG_SMC9194=m
-CONFIG_NET_VENDOR_RACAL=y
-CONFIG_NI52=m
-CONFIG_NI65=m
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-CONFIG_DE2104X=m
-CONFIG_TULIP=m
-# CONFIG_TULIP_MWI is not set
-CONFIG_TULIP_MMIO=y
-# CONFIG_TULIP_NAPI is not set
-CONFIG_DE4X5=m
-CONFIG_WINBOND_840=m
-CONFIG_DM9102=m
-CONFIG_PCMCIA_XIRCOM=m
-# CONFIG_AT1700 is not set
-CONFIG_DEPCA=m
-CONFIG_HP100=m
-# CONFIG_NET_ISA is not set
-CONFIG_NE2000=m
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-CONFIG_AMD8111_ETH=m
-CONFIG_AMD8111E_NAPI=y
-CONFIG_ADAPTEC_STARFIRE=m
-CONFIG_ADAPTEC_STARFIRE_NAPI=y
-CONFIG_AC3200=m
-CONFIG_APRICOT=m
-CONFIG_B44=m
-CONFIG_FORCEDETH=m
-CONFIG_CS89x0=m
-CONFIG_DGRS=m
-CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
-CONFIG_E100=m
-CONFIG_E100_NAPI=y
-CONFIG_FEALNX=m
-CONFIG_NATSEMI=m
-CONFIG_NE2K_PCI=m
-CONFIG_8139CP=m
-CONFIG_8139TOO=m
-CONFIG_8139TOO_PIO=y
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-CONFIG_8139TOO_8129=y
-# CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_SIS900=m
-CONFIG_EPIC100=m
-CONFIG_SUNDANCE=m
-# CONFIG_SUNDANCE_MMIO is not set
-CONFIG_TLAN=m
-CONFIG_VIA_RHINE=m
-CONFIG_VIA_RHINE_MMIO=y
-CONFIG_VIA_VELOCITY=m
-CONFIG_NET_POCKET=y
-CONFIG_ATP=m
-CONFIG_DE600=m
-CONFIG_DE620=m
-
-#
-# Ethernet (1000 Mbit)
-#
-CONFIG_ACENIC=m
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
-CONFIG_DL2K=m
-CONFIG_E1000=m
-CONFIG_E1000_NAPI=y
-CONFIG_NS83820=m
-CONFIG_HAMACHI=m
-CONFIG_YELLOWFIN=m
-CONFIG_R8169=m
-CONFIG_SK98LIN=m
-CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-CONFIG_IXGB_NAPI=y
-CONFIG_S2IO=m
-CONFIG_S2IO_NAPI=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-CONFIG_NET_RADIO=y
-
-#
-# Obsolete Wireless cards support (pre-802.11)
-#
-# CONFIG_STRIP is not set
-# CONFIG_ARLAN is not set
-CONFIG_WAVELAN=m
-CONFIG_PCMCIA_WAVELAN=m
-CONFIG_PCMCIA_NETWAVE=m
-
-#
-# Wireless 802.11 Frequency Hopping cards support
-#
-# CONFIG_PCMCIA_RAYCS is not set
-
-#
-# Wireless 802.11b ISA/PCI cards support
-#
-CONFIG_AIRO=m
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_PCI_HERMES=m
-CONFIG_ATMEL=m
-CONFIG_PCI_ATMEL=m
-
-#
-# Wireless 802.11b Pcmcia/Cardbus cards support
-#
-CONFIG_PCMCIA_HERMES=m
-CONFIG_AIRO_CS=m
-CONFIG_PCMCIA_ATMEL=m
-CONFIG_PCMCIA_WL3501=m
-
-#
-# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
-#
-CONFIG_PRISM54=m
-CONFIG_NET_WIRELESS=y
-
-#
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-CONFIG_FDDI=y
-# CONFIG_DEFXX is not set
-CONFIG_SKFP=m
-# CONFIG_HIPPI is not set
-CONFIG_PLIP=m
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-CONFIG_NET_FC=y
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=m
-
-#
-# ISDN subsystem
-#
-CONFIG_ISDN=m
-
-#
-# Old ISDN4Linux
-#
-CONFIG_ISDN_I4L=m
-CONFIG_ISDN_PPP=y
-CONFIG_ISDN_PPP_VJ=y
-CONFIG_ISDN_MPP=y
-CONFIG_IPPP_FILTER=y
-# CONFIG_ISDN_PPP_BSDCOMP is not set
-CONFIG_ISDN_AUDIO=y
-CONFIG_ISDN_TTY_FAX=y
-
-#
-# ISDN feature submodules
-#
-
-#
-# ISDN4Linux hardware drivers
-#
-
-#
-# Passive cards
-#
-CONFIG_ISDN_DRV_HISAX=m
-
-#
-# D-channel protocol features
-#
-CONFIG_HISAX_EURO=y
-CONFIG_DE_AOC=y
-CONFIG_HISAX_NO_SENDCOMPLETE=y
-CONFIG_HISAX_NO_LLC=y
-CONFIG_HISAX_NO_KEYPAD=y
-CONFIG_HISAX_1TR6=y
-CONFIG_HISAX_NI1=y
-CONFIG_HISAX_MAX_CARDS=8
-
-#
-# HiSax supported cards
-#
-CONFIG_HISAX_16_0=y
-CONFIG_HISAX_16_3=y
-CONFIG_HISAX_TELESPCI=y
-CONFIG_HISAX_S0BOX=y
-CONFIG_HISAX_AVM_A1=y
-CONFIG_HISAX_FRITZPCI=y
-CONFIG_HISAX_AVM_A1_PCMCIA=y
-CONFIG_HISAX_ELSA=y
-CONFIG_HISAX_IX1MICROR2=y
-CONFIG_HISAX_DIEHLDIVA=y
-CONFIG_HISAX_ASUSCOM=y
-CONFIG_HISAX_TELEINT=y
-CONFIG_HISAX_HFCS=y
-CONFIG_HISAX_SEDLBAUER=y
-CONFIG_HISAX_SPORTSTER=y
-CONFIG_HISAX_MIC=y
-CONFIG_HISAX_NETJET=y
-CONFIG_HISAX_NETJET_U=y
-CONFIG_HISAX_NICCY=y
-CONFIG_HISAX_ISURF=y
-CONFIG_HISAX_HSTSAPHIR=y
-CONFIG_HISAX_BKM_A4T=y
-CONFIG_HISAX_SCT_QUADRO=y
-CONFIG_HISAX_GAZEL=y
-CONFIG_HISAX_HFC_PCI=y
-CONFIG_HISAX_W6692=y
-CONFIG_HISAX_HFC_SX=y
-CONFIG_HISAX_ENTERNOW_PCI=y
-# CONFIG_HISAX_DEBUG is not set
-
-#
-# HiSax PCMCIA card service modules
-#
-CONFIG_HISAX_SEDLBAUER_CS=m
-CONFIG_HISAX_ELSA_CS=m
-CONFIG_HISAX_AVM_A1_CS=m
-CONFIG_HISAX_TELES_CS=m
-
-#
-# HiSax sub driver modules
-#
-CONFIG_HISAX_ST5481=m
-CONFIG_HISAX_HFCUSB=m
-CONFIG_HISAX_FRITZ_PCIPNP=m
-CONFIG_HISAX_HDLC=y
-
-#
-# Active cards
-#
-CONFIG_ISDN_DRV_ICN=m
-CONFIG_ISDN_DRV_PCBIT=m
-CONFIG_ISDN_DRV_SC=m
-CONFIG_ISDN_DRV_ACT2000=m
-CONFIG_ISDN_DRV_TPAM=m
-
-#
-# CAPI subsystem
-#
-CONFIG_ISDN_CAPI=m
-CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
-CONFIG_ISDN_CAPI_MIDDLEWARE=y
-CONFIG_ISDN_CAPI_CAPI20=m
-CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
-CONFIG_ISDN_CAPI_CAPIFS=m
-CONFIG_ISDN_CAPI_CAPIDRV=m
-
-#
-# CAPI hardware drivers
-#
-
-#
-# Active AVM cards
-#
-CONFIG_CAPI_AVM=y
-
-#
-# Active Eicon DIVA Server cards
-#
-CONFIG_CAPI_EICON=y
-CONFIG_ISDN_DIVAS=m
-CONFIG_ISDN_DIVAS_BRIPCI=y
-CONFIG_ISDN_DIVAS_PRIPCI=y
-CONFIG_ISDN_DIVAS_DIVACAPI=m
-CONFIG_ISDN_DIVAS_USERIDI=m
-CONFIG_ISDN_DIVAS_MAINT=m
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_JOYDEV=m
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=y
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-CONFIG_GAMEPORT=m
-CONFIG_SOUND_GAMEPORT=m
-CONFIG_GAMEPORT_NS558=m
-CONFIG_GAMEPORT_L4=m
-CONFIG_GAMEPORT_EMU10K1=m
-CONFIG_GAMEPORT_VORTEX=m
-CONFIG_GAMEPORT_FM801=m
-CONFIG_GAMEPORT_CS461x=m
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-# CONFIG_SERIO_PCIPS2 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_SERIAL=m
-CONFIG_MOUSE_INPORT=m
-CONFIG_MOUSE_ATIXL=y
-CONFIG_MOUSE_LOGIBM=m
-CONFIG_MOUSE_PC110PAD=m
-CONFIG_MOUSE_VSXXXAA=m
-CONFIG_INPUT_JOYSTICK=y
-CONFIG_JOYSTICK_ANALOG=m
-CONFIG_JOYSTICK_A3D=m
-CONFIG_JOYSTICK_ADI=m
-CONFIG_JOYSTICK_COBRA=m
-CONFIG_JOYSTICK_GF2K=m
-CONFIG_JOYSTICK_GRIP=m
-CONFIG_JOYSTICK_GRIP_MP=m
-CONFIG_JOYSTICK_GUILLEMOT=m
-CONFIG_JOYSTICK_INTERACT=m
-CONFIG_JOYSTICK_SIDEWINDER=m
-CONFIG_JOYSTICK_TMDC=m
-CONFIG_JOYSTICK_IFORCE=m
-CONFIG_JOYSTICK_IFORCE_USB=y
-CONFIG_JOYSTICK_IFORCE_232=y
-CONFIG_JOYSTICK_WARRIOR=m
-CONFIG_JOYSTICK_MAGELLAN=m
-CONFIG_JOYSTICK_SPACEORB=m
-CONFIG_JOYSTICK_SPACEBALL=m
-CONFIG_JOYSTICK_STINGER=m
-CONFIG_JOYSTICK_TWIDDLER=m
-CONFIG_JOYSTICK_DB9=m
-CONFIG_JOYSTICK_GAMECON=m
-CONFIG_JOYSTICK_TURBOGRAFX=m
-# CONFIG_INPUT_JOYDUMP is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_GUNZE=m
-CONFIG_INPUT_MISC=y
-CONFIG_INPUT_PCSPKR=m
-# CONFIG_INPUT_UINPUT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_SERIAL_NONSTANDARD=y
-CONFIG_ROCKETPORT=m
-# CONFIG_CYCLADES is not set
-CONFIG_SYNCLINK=m
-CONFIG_SYNCLINKMP=m
-CONFIG_N_HDLC=m
-CONFIG_STALDRV=y
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_CS=m
-# CONFIG_SERIAL_8250_ACPI is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_MULTIPORT=y
-CONFIG_SERIAL_8250_RSA=y
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-CONFIG_CRASH=m
-CONFIG_PRINTER=m
-CONFIG_LP_CONSOLE=y
-CONFIG_PPDEV=m
-CONFIG_TIPAR=m
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-CONFIG_IPMI_HANDLER=m
-# CONFIG_IPMI_PANIC_EVENT is not set
-CONFIG_IPMI_DEVICE_INTERFACE=m
-CONFIG_IPMI_SI=m
-CONFIG_IPMI_WATCHDOG=m
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-CONFIG_SOFT_WATCHDOG=m
-CONFIG_ACQUIRE_WDT=m
-CONFIG_ADVANTECH_WDT=m
-CONFIG_ALIM1535_WDT=m
-CONFIG_ALIM7101_WDT=m
-CONFIG_SC520_WDT=m
-CONFIG_EUROTECH_WDT=m
-CONFIG_IB700_WDT=m
-CONFIG_WAFER_WDT=m
-CONFIG_I8XX_TCO=m
-CONFIG_SC1200_WDT=m
-# CONFIG_SCx200_WDT is not set
-# CONFIG_60XX_WDT is not set
-CONFIG_CPU5_WDT=m
-CONFIG_W83627HF_WDT=m
-CONFIG_W83877F_WDT=m
-CONFIG_MACHZ_WDT=m
-
-#
-# ISA-based Watchdog Cards
-#
-CONFIG_PCWATCHDOG=m
-# CONFIG_MIXCOMWD is not set
-CONFIG_WDT=m
-# CONFIG_WDT_501 is not set
-
-#
-# PCI-based Watchdog Cards
-#
-CONFIG_PCIPCWATCHDOG=m
-CONFIG_WDTPCI=m
-CONFIG_WDT_501_PCI=y
-
-#
-# USB-based Watchdog Cards
-#
-CONFIG_USBPCWATCHDOG=m
-CONFIG_HW_RANDOM=m
-CONFIG_NVRAM=m
-CONFIG_RTC=y
-CONFIG_DTLK=m
-CONFIG_R3964=m
-# CONFIG_APPLICOM is not set
-CONFIG_SONYPI=m
-
-#
-# Ftape, the floppy tape device driver
-#
-CONFIG_AGP=y
-CONFIG_AGP_ALI=y
-CONFIG_AGP_ATI=y
-CONFIG_AGP_AMD=y
-CONFIG_AGP_AMD64=y
-CONFIG_AGP_INTEL=y
-CONFIG_AGP_INTEL_MCH=y
-CONFIG_AGP_NVIDIA=y
-CONFIG_AGP_SIS=y
-CONFIG_AGP_SWORKS=y
-CONFIG_AGP_VIA=y
-CONFIG_AGP_EFFICEON=y
-CONFIG_DRM=y
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_GAMMA=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_I810=m
-CONFIG_DRM_I830=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-
-#
-# PCMCIA character devices
-#
-CONFIG_SYNCLINK_CS=m
-CONFIG_MWAVE=m
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HPET is not set
-CONFIG_HANGCHECK_TIMER=m
-
-#
-# I2C support
-#
-CONFIG_I2C=m
-CONFIG_I2C_CHARDEV=m
-
-#
-# I2C Algorithms
-#
-CONFIG_I2C_ALGOBIT=m
-CONFIG_I2C_ALGOPCF=m
-
-#
-# I2C Hardware Bus support
-#
-CONFIG_I2C_ALI1535=m
-CONFIG_I2C_ALI1563=m
-CONFIG_I2C_ALI15X3=m
-CONFIG_I2C_AMD756=m
-CONFIG_I2C_AMD8111=m
-CONFIG_I2C_I801=m
-CONFIG_I2C_I810=m
-CONFIG_I2C_ISA=m
-CONFIG_I2C_NFORCE2=m
-# CONFIG_I2C_PARPORT is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-CONFIG_I2C_PIIX4=m
-CONFIG_I2C_PROSAVAGE=m
-CONFIG_I2C_SAVAGE4=m
-# CONFIG_SCx200_ACB is not set
-CONFIG_I2C_SIS5595=m
-CONFIG_I2C_SIS630=m
-CONFIG_I2C_SIS96X=m
-CONFIG_I2C_VIA=m
-CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_VOODOO3=m
-
-#
-# Hardware Sensors Chip support
-#
-CONFIG_I2C_SENSOR=m
-CONFIG_SENSORS_ADM1021=m
-CONFIG_SENSORS_ASB100=m
-CONFIG_SENSORS_DS1621=m
-CONFIG_SENSORS_FSCHER=m
-CONFIG_SENSORS_GL518SM=m
-CONFIG_SENSORS_IT87=m
-CONFIG_SENSORS_LM75=m
-CONFIG_SENSORS_LM78=m
-CONFIG_SENSORS_LM80=m
-CONFIG_SENSORS_LM83=m
-CONFIG_SENSORS_LM85=m
-CONFIG_SENSORS_LM90=m
-CONFIG_SENSORS_MAX1619=m
-CONFIG_SENSORS_VIA686A=m
-CONFIG_SENSORS_W83781D=m
-CONFIG_SENSORS_W83L785TS=m
-CONFIG_SENSORS_W83627HF=m
-
-#
-# Other I2C Chip support
-#
-CONFIG_SENSORS_EEPROM=m
-CONFIG_SENSORS_PCF8574=m
-CONFIG_SENSORS_PCF8591=m
-CONFIG_SENSORS_RTC8564=m
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-CONFIG_IBM_ASM=m
-
-#
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
-#
-
-#
-# Video Adapters
-#
-CONFIG_VIDEO_BT848=m
-CONFIG_VIDEO_PMS=m
-CONFIG_VIDEO_BWQCAM=m
-CONFIG_VIDEO_CQCAM=m
-CONFIG_VIDEO_W9966=m
-CONFIG_VIDEO_CPIA=m
-CONFIG_VIDEO_CPIA_PP=m
-CONFIG_VIDEO_CPIA_USB=m
-CONFIG_VIDEO_SAA5246A=m
-CONFIG_VIDEO_SAA5249=m
-CONFIG_TUNER_3036=m
-CONFIG_VIDEO_STRADIS=m
-CONFIG_VIDEO_ZORAN=m
-CONFIG_VIDEO_ZORAN_BUZ=m
-CONFIG_VIDEO_ZORAN_DC10=m
-CONFIG_VIDEO_ZORAN_DC30=m
-CONFIG_VIDEO_ZORAN_LML33=m
-CONFIG_VIDEO_ZORAN_LML33R10=m
-CONFIG_VIDEO_MEYE=m
-CONFIG_VIDEO_SAA7134=m
-CONFIG_VIDEO_MXB=m
-CONFIG_VIDEO_DPC=m
-CONFIG_VIDEO_HEXIUM_ORION=m
-CONFIG_VIDEO_HEXIUM_GEMINI=m
-CONFIG_VIDEO_CX88=m
-
-#
-# Radio Adapters
-#
-CONFIG_RADIO_CADET=m
-CONFIG_RADIO_RTRACK=m
-CONFIG_RADIO_RTRACK2=m
-CONFIG_RADIO_AZTECH=m
-CONFIG_RADIO_GEMTEK=m
-CONFIG_RADIO_GEMTEK_PCI=m
-CONFIG_RADIO_MAXIRADIO=m
-CONFIG_RADIO_MAESTRO=m
-CONFIG_RADIO_SF16FMI=m
-CONFIG_RADIO_SF16FMR2=m
-CONFIG_RADIO_TERRATEC=m
-CONFIG_RADIO_TRUST=m
-CONFIG_RADIO_TYPHOON=m
-CONFIG_RADIO_TYPHOON_PROC_FS=y
-CONFIG_RADIO_ZOLTRIX=m
-
-#
-# Digital Video Broadcasting Devices
-#
-CONFIG_DVB=y
-CONFIG_DVB_CORE=m
-
-#
-# Supported Frontend Modules
-#
-CONFIG_DVB_TWINHAN_DST=m
-CONFIG_DVB_STV0299=m
-# CONFIG_DVB_SP887X is not set
-# CONFIG_DVB_ALPS_TDLB7 is not set
-CONFIG_DVB_ALPS_TDMB7=m
-CONFIG_DVB_ATMEL_AT76C651=m
-CONFIG_DVB_CX24110=m
-CONFIG_DVB_GRUNDIG_29504_491=m
-CONFIG_DVB_GRUNDIG_29504_401=m
-CONFIG_DVB_MT312=m
-CONFIG_DVB_VES1820=m
-CONFIG_DVB_VES1X93=m
-# CONFIG_DVB_TDA1004X is not set
-CONFIG_DVB_NXT6000=m
-
-#
-# Supported SAA7146 based PCI Adapters
-#
-CONFIG_DVB_AV7110=m
-CONFIG_DVB_AV7110_OSD=y
-CONFIG_DVB_BUDGET=m
-CONFIG_DVB_BUDGET_CI=m
-CONFIG_DVB_BUDGET_AV=m
-CONFIG_DVB_BUDGET_PATCH=m
-
-#
-# Supported USB Adapters
-#
-CONFIG_DVB_TTUSB_BUDGET=m
-CONFIG_DVB_TTUSB_DEC=m
-
-#
-# Supported FlexCopII (B2C2) Adapters
-#
-CONFIG_DVB_B2C2_SKYSTAR=m
-
-#
-# Supported BT878 Adapters
-#
-CONFIG_DVB_BT8XX=m
-CONFIG_VIDEO_SAA7146=m
-CONFIG_VIDEO_SAA7146_VV=m
-CONFIG_VIDEO_VIDEOBUF=m
-CONFIG_VIDEO_TUNER=m
-CONFIG_VIDEO_BUF=m
-CONFIG_VIDEO_BTCX=m
-CONFIG_VIDEO_IR=m
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-CONFIG_FB_VGA16=m
-CONFIG_FB_VESA=y
-CONFIG_VIDEO_SELECT=y
-CONFIG_FB_HGA=m
-CONFIG_FB_HGA_ACCEL=y
-CONFIG_FB_RIVA=m
-# CONFIG_FB_RIVA_I2C is not set
-CONFIG_FB_I810=m
-CONFIG_FB_I810_GTF=y
-CONFIG_FB_MATROX=m
-CONFIG_FB_MATROX_MILLENIUM=y
-CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
-CONFIG_FB_MATROX_I2C=m
-CONFIG_FB_MATROX_MAVEN=m
-CONFIG_FB_MATROX_MULTIHEAD=y
-# CONFIG_FB_RADEON_OLD is not set
-CONFIG_FB_RADEON=m
-CONFIG_FB_RADEON_I2C=y
-# CONFIG_FB_RADEON_DEBUG is not set
-CONFIG_FB_ATY128=m
-CONFIG_FB_ATY=m
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-CONFIG_FB_NEOMAGIC=m
-CONFIG_FB_KYRO=m
-CONFIG_FB_3DFX=m
-CONFIG_FB_3DFX_ACCEL=y
-CONFIG_FB_VOODOO1=m
-CONFIG_FB_TRIDENT=m
-CONFIG_FB_TRIDENT_ACCEL=y
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-CONFIG_VGA_CONSOLE=y
-CONFIG_MDA_CONSOLE=m
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Sound
-#
-CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-CONFIG_SND_HWDEP=m
-CONFIG_SND_RAWMIDI=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
-CONFIG_SND_RTCTIMER=m
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_MPU401_UART=m
-CONFIG_SND_OPL3_LIB=m
-CONFIG_SND_OPL4_LIB=m
-CONFIG_SND_VX_LIB=m
-CONFIG_SND_DUMMY=m
-CONFIG_SND_VIRMIDI=m
-CONFIG_SND_MTPAV=m
-# CONFIG_SND_SERIAL_U16550 is not set
-CONFIG_SND_MPU401=m
-
-#
-# ISA devices
-#
-CONFIG_SND_AD1816A=m
-CONFIG_SND_AD1848=m
-CONFIG_SND_CS4231=m
-CONFIG_SND_CS4232=m
-CONFIG_SND_CS4236=m
-CONFIG_SND_ES968=m
-CONFIG_SND_ES1688=m
-CONFIG_SND_ES18XX=m
-CONFIG_SND_GUSCLASSIC=m
-CONFIG_SND_GUSEXTREME=m
-CONFIG_SND_GUSMAX=m
-CONFIG_SND_INTERWAVE=m
-CONFIG_SND_INTERWAVE_STB=m
-CONFIG_SND_OPTI92X_AD1848=m
-CONFIG_SND_OPTI92X_CS4231=m
-CONFIG_SND_OPTI93X=m
-CONFIG_SND_SB8=m
-CONFIG_SND_SB16=m
-CONFIG_SND_SBAWE=m
-CONFIG_SND_SB16_CSP=y
-# CONFIG_SND_WAVEFRONT is not set
-CONFIG_SND_ALS100=m
-CONFIG_SND_AZT2320=m
-CONFIG_SND_CMI8330=m
-CONFIG_SND_DT019X=m
-CONFIG_SND_OPL3SA2=m
-CONFIG_SND_SGALAXY=m
-CONFIG_SND_SSCAPE=m
-
-#
-# PCI devices
-#
-CONFIG_SND_AC97_CODEC=m
-CONFIG_SND_ALI5451=m
-CONFIG_SND_ATIIXP=m
-CONFIG_SND_AU8810=m
-CONFIG_SND_AU8820=m
-CONFIG_SND_AU8830=m
-CONFIG_SND_AZT3328=m
-CONFIG_SND_BT87X=m
-CONFIG_SND_CS46XX=m
-CONFIG_SND_CS46XX_NEW_DSP=y
-CONFIG_SND_CS4281=m
-CONFIG_SND_EMU10K1=m
-CONFIG_SND_KORG1212=m
-CONFIG_SND_MIXART=m
-CONFIG_SND_NM256=m
-CONFIG_SND_RME32=m
-CONFIG_SND_RME96=m
-CONFIG_SND_RME9652=m
-CONFIG_SND_HDSP=m
-CONFIG_SND_TRIDENT=m
-CONFIG_SND_YMFPCI=m
-CONFIG_SND_ALS4000=m
-CONFIG_SND_CMIPCI=m
-CONFIG_SND_ENS1370=m
-CONFIG_SND_ENS1371=m
-CONFIG_SND_ES1938=m
-CONFIG_SND_ES1968=m
-CONFIG_SND_MAESTRO3=m
-CONFIG_SND_FM801=m
-CONFIG_SND_FM801_TEA575X=m
-CONFIG_SND_ICE1712=m
-CONFIG_SND_ICE1724=m
-CONFIG_SND_INTEL8X0=m
-CONFIG_SND_INTEL8X0M=m
-CONFIG_SND_SONICVIBES=m
-CONFIG_SND_VIA82XX=m
-CONFIG_SND_VX222=m
-
-#
-# ALSA USB devices
-#
-CONFIG_SND_USB_AUDIO=m
-
-#
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
-CONFIG_SND_PDAUDIOCF=m
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# USB support
-#
-CONFIG_USB=y
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_BANDWIDTH is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-
-#
-# USB Host Controller Drivers
-#
-CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_SPLIT_ISO=y
-CONFIG_USB_EHCI_ROOT_HUB_TT=y
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_UHCI_HCD=m
-
-#
-# USB Device Class drivers
-#
-CONFIG_USB_AUDIO=m
-
-#
-# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
-#
-CONFIG_USB_MIDI=m
-CONFIG_USB_ACM=m
-CONFIG_USB_PRINTER=m
-CONFIG_USB_STORAGE=m
-# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_RW_DETECT=y
-CONFIG_USB_STORAGE_DATAFAB=y
-CONFIG_USB_STORAGE_FREECOM=y
-CONFIG_USB_STORAGE_ISD200=y
-CONFIG_USB_STORAGE_DPCM=y
-CONFIG_USB_STORAGE_HP8200e=y
-CONFIG_USB_STORAGE_SDDR09=y
-CONFIG_USB_STORAGE_SDDR55=y
-CONFIG_USB_STORAGE_JUMPSHOT=y
-
-#
-# USB Human Interface Devices (HID)
-#
-CONFIG_USB_HID=y
-CONFIG_USB_HIDINPUT=y
-CONFIG_HID_FF=y
-CONFIG_HID_PID=y
-CONFIG_LOGITECH_FF=y
-CONFIG_THRUSTMASTER_FF=y
-CONFIG_USB_HIDDEV=y
-CONFIG_USB_AIPTEK=m
-CONFIG_USB_WACOM=m
-CONFIG_USB_KBTAB=m
-CONFIG_USB_POWERMATE=m
-CONFIG_USB_MTOUCH=m
-CONFIG_USB_EGALAX=m
-CONFIG_USB_XPAD=m
-CONFIG_USB_ATI_REMOTE=m
-
-#
-# USB Imaging devices
-#
-CONFIG_USB_MDC800=m
-CONFIG_USB_MICROTEK=m
-CONFIG_USB_HPUSBSCSI=m
-
-#
-# USB Multimedia devices
-#
-CONFIG_USB_DABUSB=m
-CONFIG_USB_VICAM=m
-CONFIG_USB_DSBR=m
-CONFIG_USB_IBMCAM=m
-CONFIG_USB_KONICAWC=m
-CONFIG_USB_OV511=m
-CONFIG_USB_SE401=m
-CONFIG_USB_STV680=m
-CONFIG_USB_W9968CF=m
-
-#
-# USB Network adaptors
-#
-CONFIG_USB_CATC=m
-CONFIG_USB_KAWETH=m
-CONFIG_USB_PEGASUS=m
-CONFIG_USB_RTL8150=m
-CONFIG_USB_USBNET=m
-
-#
-# USB Host-to-Host Cables
-#
-CONFIG_USB_ALI_M5632=y
-CONFIG_USB_AN2720=y
-CONFIG_USB_BELKIN=y
-CONFIG_USB_GENESYS=y
-CONFIG_USB_NET1080=y
-CONFIG_USB_PL2301=y
-
-#
-# Intelligent USB Devices/Gadgets
-#
-CONFIG_USB_ARMLINUX=y
-CONFIG_USB_EPSON2888=y
-CONFIG_USB_ZAURUS=y
-CONFIG_USB_CDCETHER=y
-
-#
-# USB Network Adapters
-#
-CONFIG_USB_AX8817X=y
-
-#
-# USB port drivers
-#
-CONFIG_USB_USS720=m
-
-#
-# USB Serial Converter support
-#
-CONFIG_USB_SERIAL=m
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_SERIAL_BELKIN=m
-CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
-CONFIG_USB_SERIAL_EMPEG=m
-CONFIG_USB_SERIAL_FTDI_SIO=m
-CONFIG_USB_SERIAL_VISOR=m
-CONFIG_USB_SERIAL_IPAQ=m
-CONFIG_USB_SERIAL_IR=m
-CONFIG_USB_SERIAL_EDGEPORT=m
-CONFIG_USB_SERIAL_EDGEPORT_TI=m
-CONFIG_USB_SERIAL_KEYSPAN_PDA=m
-CONFIG_USB_SERIAL_KEYSPAN=m
-CONFIG_USB_SERIAL_KEYSPAN_MPR=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19=y
-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
-CONFIG_USB_SERIAL_KLSI=m
-CONFIG_USB_SERIAL_KOBIL_SCT=m
-CONFIG_USB_SERIAL_MCT_U232=m
-CONFIG_USB_SERIAL_PL2303=m
-CONFIG_USB_SERIAL_SAFE=m
-CONFIG_USB_SERIAL_SAFE_PADDED=y
-CONFIG_USB_SERIAL_CYBERJACK=m
-CONFIG_USB_SERIAL_XIRCOM=m
-CONFIG_USB_SERIAL_OMNINET=m
-CONFIG_USB_EZUSB=y
-
-#
-# USB Miscellaneous drivers
-#
-CONFIG_USB_EMI62=m
-# CONFIG_USB_EMI26 is not set
-CONFIG_USB_TIGL=m
-CONFIG_USB_AUERSWALD=m
-CONFIG_USB_RIO500=m
-CONFIG_USB_LEGOTOWER=m
-CONFIG_USB_LCD=m
-CONFIG_USB_LED=m
-# CONFIG_USB_CYTHERM is not set
-CONFIG_USB_PHIDGETSERVO=m
-CONFIG_USB_TEST=m
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-CONFIG_EXT2_FS_POSIX_ACL=y
-CONFIG_EXT2_FS_SECURITY=y
-CONFIG_EXT3_FS=m
-CONFIG_EXT3_FS_XATTR=y
-CONFIG_EXT3_FS_POSIX_ACL=y
-CONFIG_EXT3_FS_SECURITY=y
-CONFIG_JBD=m
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-CONFIG_REISERFS_PROC_INFO=y
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
-CONFIG_JFS_FS=m
-CONFIG_JFS_POSIX_ACL=y
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
-CONFIG_XFS_FS=m
-# CONFIG_XFS_RT is not set
-CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-CONFIG_MINIX_FS=m
-CONFIG_ROMFS_FS=m
-CONFIG_QUOTA=y
-# CONFIG_QFMT_V1 is not set
-CONFIG_QFMT_V2=y
-CONFIG_QUOTACTL=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-
-#
-# CD-ROM/DVD Filesystems
-#
-CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_ZISOFS_FS=y
-CONFIG_UDF_FS=m
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS_XATTR=y
-CONFIG_DEVPTS_FS_SECURITY=y
-CONFIG_TMPFS=y
-CONFIG_HUGETLBFS=y
-CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-# CONFIG_BEFS_DEBUG is not set
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-# CONFIG_JFFS_FS is not set
-CONFIG_JFFS2_FS=m
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_NAND=y
-CONFIG_CRAMFS=m
-CONFIG_VXFS_FS=m
-# CONFIG_HPFS_FS is not set
-CONFIG_QNX4FS_FS=m
-# CONFIG_QNX4FS_RW is not set
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-# CONFIG_UFS_FS_WRITE is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=m
-CONFIG_NFS_V3=y
-CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
-CONFIG_NFSD=m
-CONFIG_NFSD_V3=y
-CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_LOCKD=m
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
-CONFIG_SUNRPC=m
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT is not set
-CONFIG_CIFS=m
-# CONFIG_CIFS_STATS is not set
-CONFIG_NCP_FS=m
-CONFIG_NCPFS_PACKET_SIGNING=y
-CONFIG_NCPFS_IOCTL_LOCKING=y
-CONFIG_NCPFS_STRONG=y
-CONFIG_NCPFS_NFS_NS=y
-CONFIG_NCPFS_OS2_NS=y
-CONFIG_NCPFS_SMALLDOS=y
-CONFIG_NCPFS_NLS=y
-CONFIG_NCPFS_EXTRAS=y
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-CONFIG_OSF_PARTITION=y
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-CONFIG_MAC_PARTITION=y
-CONFIG_MSDOS_PARTITION=y
-CONFIG_BSD_DISKLABEL=y
-CONFIG_MINIX_SUBPARTITION=y
-CONFIG_SOLARIS_X86_PARTITION=y
-CONFIG_UNIXWARE_DISKLABEL=y
-# CONFIG_LDM_PARTITION is not set
-CONFIG_SGI_PARTITION=y
-# CONFIG_ULTRIX_PARTITION is not set
-CONFIG_SUN_PARTITION=y
-CONFIG_EFI_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="utf8"
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_CODEPAGE_737=m
-CONFIG_NLS_CODEPAGE_775=m
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-CONFIG_NLS_CODEPAGE_855=m
-CONFIG_NLS_CODEPAGE_857=m
-CONFIG_NLS_CODEPAGE_860=m
-CONFIG_NLS_CODEPAGE_861=m
-CONFIG_NLS_CODEPAGE_862=m
-CONFIG_NLS_CODEPAGE_863=m
-CONFIG_NLS_CODEPAGE_864=m
-CONFIG_NLS_CODEPAGE_865=m
-CONFIG_NLS_CODEPAGE_866=m
-CONFIG_NLS_CODEPAGE_869=m
-CONFIG_NLS_CODEPAGE_936=m
-CONFIG_NLS_CODEPAGE_950=m
-CONFIG_NLS_CODEPAGE_932=m
-CONFIG_NLS_CODEPAGE_949=m
-CONFIG_NLS_CODEPAGE_874=m
-CONFIG_NLS_ISO8859_8=m
-CONFIG_NLS_CODEPAGE_1250=m
-CONFIG_NLS_CODEPAGE_1251=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-CONFIG_NLS_ISO8859_5=m
-CONFIG_NLS_ISO8859_6=m
-CONFIG_NLS_ISO8859_7=m
-CONFIG_NLS_ISO8859_9=m
-CONFIG_NLS_ISO8859_13=m
-CONFIG_NLS_ISO8859_14=m
-CONFIG_NLS_ISO8859_15=m
-CONFIG_NLS_KOI8_R=m
-CONFIG_NLS_KOI8_U=m
-CONFIG_NLS_UTF8=m
-
-#
-# Profiling support
-#
-CONFIG_PROFILING=y
-CONFIG_OPROFILE=m
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_DEBUG_STACKOVERFLOW=y
-# CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_SLAB is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
-# CONFIG_DEBUG_HIGHMEM is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_SPINLOCK_SLEEP=y
-# CONFIG_FRAME_POINTER is not set
-CONFIG_X86_FIND_SMP_CONFIG=y
-CONFIG_X86_MPPARSE=y
-
-#
-# Security options
-#
-CONFIG_SECURITY=y
-CONFIG_SECURITY_NETWORK=y
-CONFIG_SECURITY_CAPABILITIES=y
-# CONFIG_SECURITY_ROOTPLUG is not set
-CONFIG_SECURITY_SELINUX=y
-CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
-CONFIG_SECURITY_SELINUX_DEVELOP=y
-# CONFIG_SECURITY_SELINUX_MLS is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_CAST5=m
-CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Library routines
-#
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_X86_SMP=y
-CONFIG_X86_HT=y
-CONFIG_X86_BIOS_REBOOT=y
-CONFIG_X86_TRAMPOLINE=y
-CONFIG_PC=y
diff --git a/configs/kernel-2.6.7-i586.config b/configs/kernel-2.6.7-i586.config
deleted file mode 100644 (file)
index 9c0db66..0000000
+++ /dev/null
@@ -1,2416 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_X86=y
-CONFIG_MMU=y
-CONFIG_UID16=y
-CONFIG_GENERIC_ISA_DMA=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
-CONFIG_LOG_BUF_SHIFT=17
-CONFIG_HOTPLUG=y
-# CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-CONFIG_KMOD=y
-
-#
-# Processor type and features
-#
-CONFIG_X86_PC=y
-# CONFIG_X86_ELAN is not set
-# CONFIG_X86_VOYAGER is not set
-# CONFIG_X86_NUMAQ is not set
-# CONFIG_X86_SUMMIT is not set
-# CONFIG_X86_BIGSMP is not set
-# CONFIG_X86_VISWS is not set
-# CONFIG_X86_GENERICARCH is not set
-# CONFIG_X86_ES7000 is not set
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-CONFIG_M586=y
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-# CONFIG_M686 is not set
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP2 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-CONFIG_X86_GENERIC=y
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_XADD=y
-CONFIG_X86_L1_CACHE_SHIFT=7
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_F00F_BUG=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_ALIGNMENT_16=y
-CONFIG_X86_INTEL_USERCOPY=y
-# CONFIG_X86_4G is not set
-# CONFIG_X86_SWITCH_PAGETABLES is not set
-# CONFIG_X86_4G_VM_LAYOUT is not set
-# CONFIG_X86_UACCESS_INDIRECT is not set
-# CONFIG_X86_HIGH_ENTRY is not set
-CONFIG_HPET_TIMER=y
-CONFIG_HPET_EMULATE_RTC=y
-# CONFIG_SMP is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_X86_UP_APIC is not set
-CONFIG_X86_MCE=y
-# CONFIG_X86_MCE_NONFATAL is not set
-CONFIG_TOSHIBA=m
-CONFIG_I8K=m
-# CONFIG_MICROCODE is not set
-CONFIG_X86_MSR=m
-CONFIG_X86_CPUID=m
-
-#
-# Firmware Drivers
-#
-CONFIG_EDD=m
-# CONFIG_NOHIGHMEM is not set
-CONFIG_HIGHMEM4G=y
-# CONFIG_HIGHMEM64G is not set
-CONFIG_HIGHMEM=y
-CONFIG_HIGHPTE=y
-# CONFIG_MATH_EMULATION is not set
-CONFIG_MTRR=y
-# CONFIG_EFI is not set
-CONFIG_REGPARM=y
-
-#
-# Power management options (ACPI, APM)
-#
-CONFIG_PM=y
-# CONFIG_SOFTWARE_SUSPEND is not set
-# CONFIG_PM_DISK is not set
-
-#
-# ACPI (Advanced Configuration and Power Interface) Support
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_AC=m
-CONFIG_ACPI_BATTERY=m
-CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_FAN=y
-CONFIG_ACPI_PROCESSOR=y
-CONFIG_ACPI_THERMAL=y
-CONFIG_ACPI_ASUS=m
-CONFIG_ACPI_TOSHIBA=m
-# CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
-CONFIG_ACPI_EC=y
-CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
-CONFIG_ACPI_SYSTEM=y
-CONFIG_X86_PM_TIMER=y
-
-#
-# APM (Advanced Power Management) BIOS Support
-#
-CONFIG_APM=y
-# CONFIG_APM_IGNORE_USER_SUSPEND is not set
-# CONFIG_APM_DO_ENABLE is not set
-CONFIG_APM_CPU_IDLE=y
-# CONFIG_APM_DISPLAY_BLANK is not set
-CONFIG_APM_RTC_IS_GMT=y
-# CONFIG_APM_ALLOW_INTS is not set
-# CONFIG_APM_REAL_MODE_POWER_OFF is not set
-
-#
-# CPU Frequency scaling
-#
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_PROC_INTF is not set
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-CONFIG_CPU_FREQ_GOV_POWERSAVE=m
-CONFIG_CPU_FREQ_GOV_USERSPACE=y
-# CONFIG_CPU_FREQ_24_API is not set
-CONFIG_CPU_FREQ_TABLE=y
-
-#
-# CPUFreq processor drivers
-#
-CONFIG_X86_ACPI_CPUFREQ=m
-# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
-CONFIG_X86_POWERNOW_K6=m
-CONFIG_X86_POWERNOW_K7=y
-CONFIG_X86_POWERNOW_K8=m
-# CONFIG_X86_GX_SUSPMOD is not set
-CONFIG_X86_SPEEDSTEP_CENTRINO=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y
-CONFIG_X86_SPEEDSTEP_ICH=y
-CONFIG_X86_SPEEDSTEP_SMI=m
-CONFIG_X86_P4_CLOCKMOD=m
-CONFIG_X86_SPEEDSTEP_LIB=y
-# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
-CONFIG_X86_LONGRUN=y
-# CONFIG_X86_LONGHAUL is not set
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-CONFIG_PCI=y
-# CONFIG_PCI_GOBIOS is not set
-# CONFIG_PCI_GOMMCONFIG is not set
-# CONFIG_PCI_GODIRECT is not set
-CONFIG_PCI_GOANY=y
-CONFIG_PCI_BIOS=y
-CONFIG_PCI_DIRECT=y
-CONFIG_PCI_MMCONFIG=y
-CONFIG_PCI_LEGACY_PROC=y
-# CONFIG_PCI_NAMES is not set
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SCx200 is not set
-
-#
-# PCMCIA/CardBus support
-#
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
-CONFIG_CARDBUS=y
-CONFIG_I82092=m
-CONFIG_I82365=m
-CONFIG_TCIC=m
-CONFIG_PCMCIA_PROBE=y
-
-#
-# PCI Hotplug Support
-#
-CONFIG_HOTPLUG_PCI=y
-# CONFIG_HOTPLUG_PCI_FAKE is not set
-CONFIG_HOTPLUG_PCI_COMPAQ=m
-# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
-# CONFIG_HOTPLUG_PCI_ACPI is not set
-# CONFIG_HOTPLUG_PCI_CPCI is not set
-CONFIG_HOTPLUG_PCI_PCIE=m
-CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y
-CONFIG_HOTPLUG_PCI_SHPC=m
-CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_FW_LOADER=y
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=m
-# CONFIG_MTD_DEBUG is not set
-CONFIG_MTD_PARTITIONS=m
-CONFIG_MTD_CONCAT=m
-CONFIG_MTD_REDBOOT_PARTS=m
-CONFIG_MTD_CMDLINE_PARTS=m
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=m
-CONFIG_MTD_BLOCK=m
-CONFIG_MTD_BLOCK_RO=m
-CONFIG_FTL=m
-CONFIG_NFTL=m
-CONFIG_NFTL_RW=y
-CONFIG_INFTL=m
-
-#
-# RAM/ROM/Flash chip drivers
-#
-CONFIG_MTD_CFI=m
-CONFIG_MTD_JEDECPROBE=m
-CONFIG_MTD_GEN_PROBE=m
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_CFI_INTELEXT=m
-CONFIG_MTD_CFI_AMDSTD=m
-CONFIG_MTD_CFI_STAA=m
-CONFIG_MTD_RAM=m
-CONFIG_MTD_ROM=m
-CONFIG_MTD_ABSENT=m
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_PNC2000 is not set
-CONFIG_MTD_SC520CDP=m
-CONFIG_MTD_NETSC520=m
-CONFIG_MTD_SBC_GXX=m
-CONFIG_MTD_ELAN_104NC=m
-CONFIG_MTD_SCx200_DOCFLASH=m
-CONFIG_MTD_AMD76XROM=m
-CONFIG_MTD_ICH2ROM=m
-CONFIG_MTD_SCB2_FLASH=m
-# CONFIG_MTD_NETtel is not set
-# CONFIG_MTD_DILNETPC is not set
-CONFIG_MTD_L440GX=m
-CONFIG_MTD_PCI=m
-
-#
-# Self-contained MTD device drivers
-#
-CONFIG_MTD_PMC551=m
-# CONFIG_MTD_PMC551_BUGFIX is not set
-# CONFIG_MTD_PMC551_DEBUG is not set
-# CONFIG_MTD_SLRAM is not set
-CONFIG_MTD_MTDRAM=m
-CONFIG_MTDRAM_TOTAL_SIZE=4096
-CONFIG_MTDRAM_ERASE_SIZE=128
-# CONFIG_MTD_BLKMTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-CONFIG_MTD_DOC2000=m
-# CONFIG_MTD_DOC2001 is not set
-CONFIG_MTD_DOC2001PLUS=m
-CONFIG_MTD_DOCPROBE=m
-# CONFIG_MTD_DOCPROBE_ADVANCED is not set
-CONFIG_MTD_DOCPROBE_ADDRESS=0
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-CONFIG_MTD_NAND_IDS=m
-
-#
-# Parallel port support
-#
-CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-CONFIG_PARPORT_SERIAL=m
-# CONFIG_PARPORT_PC_FIFO is not set
-# CONFIG_PARPORT_PC_SUPERIO is not set
-CONFIG_PARPORT_PC_PCMCIA=m
-# CONFIG_PARPORT_OTHER is not set
-CONFIG_PARPORT_1284=y
-
-#
-# Plug and Play support
-#
-CONFIG_PNP=y
-# CONFIG_PNP_DEBUG is not set
-
-#
-# Protocols
-#
-CONFIG_ISAPNP=y
-# CONFIG_PNPBIOS is not set
-
-#
-# Block devices
-#
-CONFIG_BLK_DEV_FD=m
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-CONFIG_BLK_CPQ_DA=m
-CONFIG_BLK_CPQ_CISS_DA=m
-CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_DEV_DAC960=m
-CONFIG_BLK_DEV_UMEM=m
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_CRYPTOLOOP=m
-CONFIG_BLK_DEV_NBD=m
-CONFIG_BLK_DEV_CARMEL=m
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=16384
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_LBD=y
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_HD_IDE is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
-CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDETAPE=m
-CONFIG_BLK_DEV_IDEFLOPPY=y
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_CMD640 is not set
-CONFIG_BLK_DEV_IDEPNP=y
-CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
-# CONFIG_BLK_DEV_OPTI621 is not set
-CONFIG_BLK_DEV_RZ1000=y
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-CONFIG_IDEDMA_PCI_AUTO=y
-# CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
-CONFIG_BLK_DEV_AEC62XX=y
-CONFIG_BLK_DEV_ALI15X3=y
-# CONFIG_WDC_ALI15X3 is not set
-CONFIG_BLK_DEV_AMD74XX=y
-CONFIG_BLK_DEV_ATIIXP=y
-CONFIG_BLK_DEV_CMD64X=y
-CONFIG_BLK_DEV_TRIFLEX=y
-CONFIG_BLK_DEV_CY82C693=y
-CONFIG_BLK_DEV_CS5520=y
-CONFIG_BLK_DEV_CS5530=y
-CONFIG_BLK_DEV_HPT34X=y
-# CONFIG_HPT34X_AUTODMA is not set
-CONFIG_BLK_DEV_HPT366=y
-# CONFIG_BLK_DEV_SC1200 is not set
-CONFIG_BLK_DEV_PIIX=y
-# CONFIG_BLK_DEV_NS87415 is not set
-CONFIG_BLK_DEV_PDC202XX_OLD=y
-# CONFIG_PDC202XX_BURST is not set
-CONFIG_BLK_DEV_PDC202XX_NEW=y
-CONFIG_PDC202XX_FORCE=y
-CONFIG_BLK_DEV_SVWKS=y
-CONFIG_BLK_DEV_SIIMAGE=y
-CONFIG_BLK_DEV_SIS5513=y
-CONFIG_BLK_DEV_SLC90E66=y
-# CONFIG_BLK_DEV_TRM290 is not set
-CONFIG_BLK_DEV_VIA82CXXX=y
-# CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-CONFIG_SCSI=m
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=m
-CONFIG_CHR_DEV_ST=m
-CONFIG_CHR_DEV_OSST=m
-CONFIG_BLK_DEV_SR=m
-CONFIG_BLK_DEV_SR_VENDOR=y
-CONFIG_CHR_DEV_SG=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-CONFIG_SCSI_CONSTANTS=y
-CONFIG_SCSI_LOGGING=y
-
-#
-# SCSI Transport Attributes
-#
-CONFIG_SCSI_SPI_ATTRS=m
-CONFIG_SCSI_FC_ATTRS=m
-
-#
-# SCSI low-level drivers
-#
-CONFIG_BLK_DEV_3W_XXXX_RAID=m
-CONFIG_SCSI_3W_9XXX=m
-# CONFIG_SCSI_7000FASST is not set
-CONFIG_SCSI_ACARD=m
-CONFIG_SCSI_AHA152X=m
-CONFIG_SCSI_AHA1542=m
-CONFIG_SCSI_AACRAID=m
-CONFIG_SCSI_AIC7XXX=m
-CONFIG_AIC7XXX_CMDS_PER_DEVICE=4
-CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
-# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
-CONFIG_AIC7XXX_DEBUG_MASK=0
-# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
-CONFIG_SCSI_AIC7XXX_OLD=m
-CONFIG_SCSI_AIC79XX=m
-CONFIG_AIC79XX_CMDS_PER_DEVICE=4
-CONFIG_AIC79XX_RESET_DELAY_MS=15000
-# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
-# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
-# CONFIG_AIC79XX_DEBUG_ENABLE is not set
-CONFIG_AIC79XX_DEBUG_MASK=0
-# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
-# CONFIG_SCSI_DPT_I2O is not set
-CONFIG_SCSI_ADVANSYS=m
-CONFIG_SCSI_IN2000=m
-CONFIG_SCSI_MEGARAID=m
-CONFIG_SCSI_SATA=y
-CONFIG_SCSI_SATA_SVW=m
-CONFIG_SCSI_ATA_PIIX=m
-CONFIG_SCSI_SATA_PROMISE=m
-CONFIG_SCSI_SATA_SX4=m
-CONFIG_SCSI_SATA_SIL=m
-CONFIG_SCSI_SATA_SIS=m
-CONFIG_SCSI_SATA_VIA=m
-CONFIG_SCSI_SATA_VITESSE=m
-CONFIG_SCSI_BUSLOGIC=m
-# CONFIG_SCSI_OMIT_FLASHPOINT is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_PIO is not set
-CONFIG_SCSI_FUTURE_DOMAIN=m
-CONFIG_SCSI_GDTH=m
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
-CONFIG_SCSI_IPS=m
-CONFIG_SCSI_INIA100=m
-CONFIG_SCSI_PPA=m
-CONFIG_SCSI_IMM=m
-# CONFIG_SCSI_IZIP_EPP16 is not set
-# CONFIG_SCSI_IZIP_SLOW_CTR is not set
-# CONFIG_SCSI_NCR53C406A is not set
-CONFIG_SCSI_SYM53C8XX_2=m
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-CONFIG_SCSI_QLOGIC_FAS=m
-CONFIG_SCSI_QLOGIC_ISP=m
-# CONFIG_SCSI_QLOGIC_FC is not set
-CONFIG_SCSI_QLOGIC_1280=m
-CONFIG_SCSI_QLA2XXX=m
-CONFIG_SCSI_QLA21XX=m
-CONFIG_SCSI_QLA22XX=m
-CONFIG_SCSI_QLA2300=m
-CONFIG_SCSI_QLA2322=m
-CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
-# CONFIG_SCSI_SYM53C416 is not set
-# CONFIG_SCSI_DC395x is not set
-CONFIG_SCSI_DC390T=m
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_U14_34F is not set
-# CONFIG_SCSI_ULTRASTOR is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_DEBUG is not set
-
-#
-# PCMCIA SCSI adapter support
-#
-CONFIG_PCMCIA_AHA152X=m
-CONFIG_PCMCIA_FDOMAIN=m
-CONFIG_PCMCIA_NINJA_SCSI=m
-CONFIG_PCMCIA_QLOGIC=m
-CONFIG_PCMCIA_SYM53C500=m
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=m
-CONFIG_MD_RAID0=m
-CONFIG_MD_RAID1=m
-CONFIG_MD_RAID5=m
-CONFIG_MD_RAID6=m
-CONFIG_MD_MULTIPATH=m
-CONFIG_BLK_DEV_DM=m
-CONFIG_DM_CRYPT=m
-CONFIG_DM_SNAPSHOT=m
-CONFIG_DM_MIRROR=m
-CONFIG_DM_ZERO=m
-
-#
-# Fusion MPT device support
-#
-CONFIG_FUSION=m
-CONFIG_FUSION_MAX_SGE=40
-# CONFIG_FUSION_ISENSE is not set
-CONFIG_FUSION_CTL=m
-CONFIG_FUSION_LAN=m
-
-#
-# IEEE 1394 (FireWire) support
-#
-CONFIG_IEEE1394=m
-
-#
-# Subsystem Options
-#
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
-CONFIG_IEEE1394_OUI_DB=y
-# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
-
-#
-# Device Drivers
-#
-# CONFIG_IEEE1394_PCILYNX is not set
-CONFIG_IEEE1394_OHCI1394=m
-
-#
-# Protocol Drivers
-#
-CONFIG_IEEE1394_VIDEO1394=m
-CONFIG_IEEE1394_SBP2=m
-# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
-# CONFIG_IEEE1394_ETH1394 is not set
-CONFIG_IEEE1394_DV1394=m
-CONFIG_IEEE1394_RAWIO=m
-CONFIG_IEEE1394_CMP=m
-CONFIG_IEEE1394_AMDTP=m
-
-#
-# I2O device support
-#
-CONFIG_I2O=m
-CONFIG_I2O_CONFIG=m
-CONFIG_I2O_BLOCK=m
-CONFIG_I2O_SCSI=m
-CONFIG_I2O_PROC=m
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_FWMARK=y
-CONFIG_IP_ROUTE_NAT=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_TOS=y
-CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_PNP is not set
-CONFIG_NET_IPIP=m
-CONFIG_NET_IPGRE=m
-CONFIG_NET_IPGRE_BROADCAST=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-# CONFIG_ARPD is not set
-CONFIG_SYN_COOKIES=y
-CONFIG_INET_AH=m
-CONFIG_INET_ESP=m
-CONFIG_INET_IPCOMP=m
-
-#
-# IP: Virtual Server Configuration
-#
-CONFIG_IP_VS=m
-# CONFIG_IP_VS_DEBUG is not set
-CONFIG_IP_VS_TAB_BITS=12
-
-#
-# IPVS transport protocol load balancing support
-#
-CONFIG_IP_VS_PROTO_TCP=y
-CONFIG_IP_VS_PROTO_UDP=y
-CONFIG_IP_VS_PROTO_ESP=y
-CONFIG_IP_VS_PROTO_AH=y
-
-#
-# IPVS scheduler
-#
-CONFIG_IP_VS_RR=m
-CONFIG_IP_VS_WRR=m
-CONFIG_IP_VS_LC=m
-CONFIG_IP_VS_WLC=m
-CONFIG_IP_VS_LBLC=m
-CONFIG_IP_VS_LBLCR=m
-CONFIG_IP_VS_DH=m
-CONFIG_IP_VS_SH=m
-CONFIG_IP_VS_SED=m
-CONFIG_IP_VS_NQ=m
-
-#
-# IPVS application helper
-#
-CONFIG_IP_VS_FTP=m
-CONFIG_IPV6=m
-CONFIG_IPV6_PRIVACY=y
-CONFIG_INET6_AH=m
-CONFIG_INET6_ESP=m
-CONFIG_INET6_IPCOMP=m
-CONFIG_IPV6_TUNNEL=m
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-CONFIG_BRIDGE_NETFILTER=y
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_IP_NF_CONNTRACK=m
-CONFIG_IP_NF_FTP=m
-CONFIG_IP_NF_IRC=m
-CONFIG_IP_NF_TFTP=m
-CONFIG_IP_NF_AMANDA=m
-CONFIG_IP_NF_QUEUE=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_LIMIT=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_MAC=m
-CONFIG_IP_NF_MATCH_PKTTYPE=m
-CONFIG_IP_NF_MATCH_MARK=m
-CONFIG_IP_NF_MATCH_MULTIPORT=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
-CONFIG_IP_NF_MATCH_DSCP=m
-CONFIG_IP_NF_MATCH_AH_ESP=m
-CONFIG_IP_NF_MATCH_LENGTH=m
-CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_TCPMSS=m
-CONFIG_IP_NF_MATCH_HELPER=m
-CONFIG_IP_NF_MATCH_STATE=m
-CONFIG_IP_NF_MATCH_CONNTRACK=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_PHYSDEV=m
-CONFIG_IP_NF_FILTER=m
-CONFIG_IP_NF_TARGET_REJECT=m
-CONFIG_IP_NF_NAT=m
-CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
-CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
-CONFIG_IP_NF_NAT_LOCAL=y
-CONFIG_IP_NF_NAT_SNMP_BASIC=m
-CONFIG_IP_NF_NAT_IRC=m
-CONFIG_IP_NF_NAT_FTP=m
-CONFIG_IP_NF_NAT_TFTP=m
-CONFIG_IP_NF_NAT_AMANDA=m
-CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
-CONFIG_IP_NF_TARGET_ECN=m
-CONFIG_IP_NF_TARGET_DSCP=m
-CONFIG_IP_NF_TARGET_MARK=m
-CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
-CONFIG_IP_NF_ARPTABLES=m
-CONFIG_IP_NF_ARPFILTER=m
-CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
-
-#
-# IPv6: Netfilter Configuration
-#
-# CONFIG_IP6_NF_QUEUE is not set
-CONFIG_IP6_NF_IPTABLES=m
-CONFIG_IP6_NF_MATCH_LIMIT=m
-CONFIG_IP6_NF_MATCH_MAC=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_MATCH_OPTS=m
-CONFIG_IP6_NF_MATCH_FRAG=m
-CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_MULTIPORT=m
-CONFIG_IP6_NF_MATCH_OWNER=m
-CONFIG_IP6_NF_MATCH_MARK=m
-CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_AHESP=m
-CONFIG_IP6_NF_MATCH_LENGTH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_FILTER=m
-CONFIG_IP6_NF_TARGET_LOG=m
-CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_TARGET_MARK=m
-CONFIG_IP6_NF_RAW=m
-
-#
-# Bridge: Netfilter Configuration
-#
-CONFIG_BRIDGE_NF_EBTABLES=m
-CONFIG_BRIDGE_EBT_BROUTE=m
-CONFIG_BRIDGE_EBT_T_FILTER=m
-CONFIG_BRIDGE_EBT_T_NAT=m
-CONFIG_BRIDGE_EBT_802_3=m
-CONFIG_BRIDGE_EBT_AMONG=m
-CONFIG_BRIDGE_EBT_ARP=m
-CONFIG_BRIDGE_EBT_IP=m
-CONFIG_BRIDGE_EBT_LIMIT=m
-CONFIG_BRIDGE_EBT_MARK=m
-CONFIG_BRIDGE_EBT_PKTTYPE=m
-CONFIG_BRIDGE_EBT_STP=m
-CONFIG_BRIDGE_EBT_VLAN=m
-CONFIG_BRIDGE_EBT_ARPREPLY=m
-CONFIG_BRIDGE_EBT_DNAT=m
-CONFIG_BRIDGE_EBT_MARK_T=m
-CONFIG_BRIDGE_EBT_REDIRECT=m
-CONFIG_BRIDGE_EBT_SNAT=m
-CONFIG_BRIDGE_EBT_LOG=m
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-CONFIG_IP_SCTP=m
-# CONFIG_SCTP_DBG_MSG is not set
-# CONFIG_SCTP_DBG_OBJCNT is not set
-# CONFIG_SCTP_HMAC_NONE is not set
-# CONFIG_SCTP_HMAC_SHA1 is not set
-CONFIG_SCTP_HMAC_MD5=y
-# CONFIG_ATM is not set
-CONFIG_BRIDGE=m
-CONFIG_VLAN_8021Q=m
-# CONFIG_DECNET is not set
-CONFIG_LLC=m
-# CONFIG_LLC2 is not set
-CONFIG_IPX=m
-# CONFIG_IPX_INTERN is not set
-CONFIG_ATALK=m
-CONFIG_DEV_APPLETALK=y
-CONFIG_LTPC=m
-CONFIG_COPS=m
-CONFIG_COPS_DAYNA=y
-CONFIG_COPS_TANGENT=y
-CONFIG_IPDDP=m
-CONFIG_IPDDP_ENCAP=y
-CONFIG_IPDDP_DECAP=y
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-CONFIG_NET_DIVERT=y
-# CONFIG_ECONET is not set
-CONFIG_WAN_ROUTER=m
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
-
-#
-# QoS and/or fair queueing
-#
-CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
-CONFIG_NET_SCH_HTB=m
-CONFIG_NET_SCH_HFSC=m
-CONFIG_NET_SCH_CSZ=m
-CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RED=m
-CONFIG_NET_SCH_SFQ=m
-CONFIG_NET_SCH_TEQL=m
-CONFIG_NET_SCH_TBF=m
-CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
-CONFIG_NET_SCH_DELAY=m
-CONFIG_NET_SCH_INGRESS=m
-CONFIG_NET_QOS=y
-CONFIG_NET_ESTIMATOR=y
-CONFIG_NET_CLS=y
-CONFIG_NET_CLS_TCINDEX=m
-CONFIG_NET_CLS_ROUTE4=m
-CONFIG_NET_CLS_ROUTE=y
-CONFIG_NET_CLS_FW=m
-CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
-CONFIG_NET_CLS_POLICE=y
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-CONFIG_NETPOLL=y
-# CONFIG_NETPOLL_RX is not set
-# CONFIG_NETPOLL_TRAP is not set
-CONFIG_NET_POLL_CONTROLLER=y
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRNET=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-CONFIG_DONGLE=y
-CONFIG_ESI_DONGLE=m
-CONFIG_ACTISYS_DONGLE=m
-CONFIG_TEKRAM_DONGLE=m
-CONFIG_LITELINK_DONGLE=m
-CONFIG_MA600_DONGLE=m
-CONFIG_GIRBIL_DONGLE=m
-CONFIG_MCP2120_DONGLE=m
-CONFIG_OLD_BELKIN_DONGLE=m
-CONFIG_ACT200L_DONGLE=m
-
-#
-# Old SIR device drivers
-#
-CONFIG_IRPORT_SIR=m
-
-#
-# Old Serial dongle support
-#
-# CONFIG_DONGLE_OLD is not set
-
-#
-# FIR device drivers
-#
-CONFIG_USB_IRDA=m
-CONFIG_SIGMATEL_FIR=m
-CONFIG_NSC_FIR=m
-# CONFIG_WINBOND_FIR is not set
-# CONFIG_TOSHIBA_FIR is not set
-# CONFIG_SMC_IRCC_FIR is not set
-# CONFIG_ALI_FIR is not set
-# CONFIG_VLSI_FIR is not set
-# CONFIG_VIA_FIR is not set
-CONFIG_BT=m
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_CMTP=m
-
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_HCIUSB=m
-CONFIG_BT_HCIUSB_SCO=y
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_BCSP_TXCRC=y
-CONFIG_BT_HCIBCM203X=m
-CONFIG_BT_HCIBFUSB=m
-CONFIG_BT_HCIDTL1=m
-CONFIG_BT_HCIBT3C=m
-CONFIG_BT_HCIBLUECARD=m
-CONFIG_BT_HCIBTUART=m
-CONFIG_BT_HCIVHCI=m
-CONFIG_TUX=m
-
-#
-# TUX options
-#
-CONFIG_TUX_EXTCGI=y
-# CONFIG_TUX_EXTENDED_LOG is not set
-# CONFIG_TUX_DEBUG is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-CONFIG_EQUALIZER=m
-CONFIG_TUN=m
-CONFIG_ETHERTAP=m
-CONFIG_NET_SB1000=m
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
-CONFIG_HAPPYMEAL=m
-CONFIG_SUNGEM=m
-CONFIG_NET_VENDOR_3COM=y
-CONFIG_EL1=m
-CONFIG_EL2=m
-CONFIG_ELPLUS=m
-CONFIG_EL16=m
-CONFIG_EL3=m
-CONFIG_3C515=m
-CONFIG_VORTEX=m
-# CONFIG_TYPHOON is not set
-CONFIG_LANCE=m
-CONFIG_NET_VENDOR_SMC=y
-CONFIG_WD80x3=m
-CONFIG_ULTRA=m
-CONFIG_SMC9194=m
-CONFIG_NET_VENDOR_RACAL=y
-# CONFIG_NI5010 is not set
-CONFIG_NI52=m
-CONFIG_NI65=m
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-CONFIG_DE2104X=m
-CONFIG_TULIP=m
-# CONFIG_TULIP_MWI is not set
-CONFIG_TULIP_MMIO=y
-# CONFIG_TULIP_NAPI is not set
-CONFIG_DE4X5=m
-CONFIG_WINBOND_840=m
-CONFIG_DM9102=m
-CONFIG_PCMCIA_XIRCOM=m
-# CONFIG_PCMCIA_XIRTULIP is not set
-# CONFIG_AT1700 is not set
-CONFIG_DEPCA=m
-CONFIG_HP100=m
-# CONFIG_NET_ISA is not set
-CONFIG_NE2000=m
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-CONFIG_AMD8111_ETH=m
-CONFIG_AMD8111E_NAPI=y
-CONFIG_ADAPTEC_STARFIRE=m
-CONFIG_ADAPTEC_STARFIRE_NAPI=y
-CONFIG_AC3200=m
-CONFIG_APRICOT=m
-CONFIG_B44=m
-CONFIG_FORCEDETH=m
-CONFIG_CS89x0=m
-CONFIG_DGRS=m
-CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
-CONFIG_E100=m
-CONFIG_E100_NAPI=y
-CONFIG_FEALNX=m
-CONFIG_NATSEMI=m
-CONFIG_NE2K_PCI=m
-CONFIG_8139CP=m
-CONFIG_8139TOO=m
-CONFIG_8139TOO_PIO=y
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-CONFIG_8139TOO_8129=y
-# CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_SIS900=m
-CONFIG_EPIC100=m
-CONFIG_SUNDANCE=m
-# CONFIG_SUNDANCE_MMIO is not set
-CONFIG_TLAN=m
-CONFIG_VIA_RHINE=m
-CONFIG_VIA_RHINE_MMIO=y
-CONFIG_VIA_VELOCITY=m
-CONFIG_NET_POCKET=y
-CONFIG_ATP=m
-CONFIG_DE600=m
-CONFIG_DE620=m
-
-#
-# Ethernet (1000 Mbit)
-#
-CONFIG_ACENIC=m
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
-CONFIG_DL2K=m
-CONFIG_E1000=m
-CONFIG_E1000_NAPI=y
-CONFIG_NS83820=m
-CONFIG_HAMACHI=m
-CONFIG_YELLOWFIN=m
-CONFIG_R8169=m
-CONFIG_SK98LIN=m
-CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-CONFIG_IXGB_NAPI=y
-CONFIG_S2IO=m
-CONFIG_S2IO_NAPI=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-CONFIG_NET_RADIO=y
-
-#
-# Obsolete Wireless cards support (pre-802.11)
-#
-# CONFIG_STRIP is not set
-# CONFIG_ARLAN is not set
-CONFIG_WAVELAN=m
-CONFIG_PCMCIA_WAVELAN=m
-CONFIG_PCMCIA_NETWAVE=m
-
-#
-# Wireless 802.11 Frequency Hopping cards support
-#
-# CONFIG_PCMCIA_RAYCS is not set
-
-#
-# Wireless 802.11b ISA/PCI cards support
-#
-CONFIG_AIRO=m
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_PCI_HERMES=m
-CONFIG_ATMEL=m
-CONFIG_PCI_ATMEL=m
-
-#
-# Wireless 802.11b Pcmcia/Cardbus cards support
-#
-CONFIG_PCMCIA_HERMES=m
-CONFIG_AIRO_CS=m
-CONFIG_PCMCIA_ATMEL=m
-CONFIG_PCMCIA_WL3501=m
-
-#
-# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
-#
-CONFIG_PRISM54=m
-CONFIG_NET_WIRELESS=y
-
-#
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-CONFIG_FDDI=y
-# CONFIG_DEFXX is not set
-CONFIG_SKFP=m
-# CONFIG_HIPPI is not set
-CONFIG_PLIP=m
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-CONFIG_NET_FC=y
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=m
-
-#
-# ISDN subsystem
-#
-CONFIG_ISDN=m
-
-#
-# Old ISDN4Linux
-#
-CONFIG_ISDN_I4L=m
-CONFIG_ISDN_PPP=y
-CONFIG_ISDN_PPP_VJ=y
-CONFIG_ISDN_MPP=y
-CONFIG_IPPP_FILTER=y
-# CONFIG_ISDN_PPP_BSDCOMP is not set
-CONFIG_ISDN_AUDIO=y
-CONFIG_ISDN_TTY_FAX=y
-
-#
-# ISDN feature submodules
-#
-CONFIG_ISDN_DRV_LOOP=m
-
-#
-# ISDN4Linux hardware drivers
-#
-
-#
-# Passive cards
-#
-CONFIG_ISDN_DRV_HISAX=m
-
-#
-# D-channel protocol features
-#
-CONFIG_HISAX_EURO=y
-CONFIG_DE_AOC=y
-CONFIG_HISAX_NO_SENDCOMPLETE=y
-CONFIG_HISAX_NO_LLC=y
-CONFIG_HISAX_NO_KEYPAD=y
-CONFIG_HISAX_1TR6=y
-CONFIG_HISAX_NI1=y
-CONFIG_HISAX_MAX_CARDS=8
-
-#
-# HiSax supported cards
-#
-CONFIG_HISAX_16_0=y
-CONFIG_HISAX_16_3=y
-CONFIG_HISAX_TELESPCI=y
-CONFIG_HISAX_S0BOX=y
-CONFIG_HISAX_AVM_A1=y
-CONFIG_HISAX_FRITZPCI=y
-CONFIG_HISAX_AVM_A1_PCMCIA=y
-CONFIG_HISAX_ELSA=y
-CONFIG_HISAX_IX1MICROR2=y
-CONFIG_HISAX_DIEHLDIVA=y
-CONFIG_HISAX_ASUSCOM=y
-CONFIG_HISAX_TELEINT=y
-CONFIG_HISAX_HFCS=y
-CONFIG_HISAX_SEDLBAUER=y
-CONFIG_HISAX_SPORTSTER=y
-CONFIG_HISAX_MIC=y
-CONFIG_HISAX_NETJET=y
-CONFIG_HISAX_NETJET_U=y
-CONFIG_HISAX_NICCY=y
-CONFIG_HISAX_ISURF=y
-CONFIG_HISAX_HSTSAPHIR=y
-CONFIG_HISAX_BKM_A4T=y
-CONFIG_HISAX_SCT_QUADRO=y
-CONFIG_HISAX_GAZEL=y
-CONFIG_HISAX_HFC_PCI=y
-CONFIG_HISAX_W6692=y
-CONFIG_HISAX_HFC_SX=y
-CONFIG_HISAX_ENTERNOW_PCI=y
-# CONFIG_HISAX_DEBUG is not set
-
-#
-# HiSax PCMCIA card service modules
-#
-CONFIG_HISAX_SEDLBAUER_CS=m
-CONFIG_HISAX_ELSA_CS=m
-CONFIG_HISAX_AVM_A1_CS=m
-CONFIG_HISAX_TELES_CS=m
-
-#
-# HiSax sub driver modules
-#
-CONFIG_HISAX_ST5481=m
-CONFIG_HISAX_HFCUSB=m
-CONFIG_HISAX_FRITZ_PCIPNP=m
-CONFIG_HISAX_HDLC=y
-
-#
-# Active cards
-#
-CONFIG_ISDN_DRV_ICN=m
-CONFIG_ISDN_DRV_PCBIT=m
-CONFIG_ISDN_DRV_SC=m
-CONFIG_ISDN_DRV_ACT2000=m
-CONFIG_ISDN_DRV_TPAM=m
-CONFIG_HYSDN=m
-CONFIG_HYSDN_CAPI=y
-
-#
-# CAPI subsystem
-#
-CONFIG_ISDN_CAPI=m
-CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
-CONFIG_ISDN_CAPI_MIDDLEWARE=y
-CONFIG_ISDN_CAPI_CAPI20=m
-CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
-CONFIG_ISDN_CAPI_CAPIFS=m
-CONFIG_ISDN_CAPI_CAPIDRV=m
-
-#
-# CAPI hardware drivers
-#
-
-#
-# Active AVM cards
-#
-CONFIG_CAPI_AVM=y
-CONFIG_ISDN_DRV_AVMB1_B1ISA=m
-CONFIG_ISDN_DRV_AVMB1_B1PCI=m
-CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y
-CONFIG_ISDN_DRV_AVMB1_T1ISA=m
-CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
-CONFIG_ISDN_DRV_AVMB1_AVM_CS=m
-CONFIG_ISDN_DRV_AVMB1_T1PCI=m
-CONFIG_ISDN_DRV_AVMB1_C4=m
-
-#
-# Active Eicon DIVA Server cards
-#
-CONFIG_CAPI_EICON=y
-CONFIG_ISDN_DIVAS=m
-CONFIG_ISDN_DIVAS_BRIPCI=y
-CONFIG_ISDN_DIVAS_PRIPCI=y
-CONFIG_ISDN_DIVAS_DIVACAPI=m
-CONFIG_ISDN_DIVAS_USERIDI=m
-CONFIG_ISDN_DIVAS_MAINT=m
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_JOYDEV=m
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=y
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-CONFIG_GAMEPORT=m
-CONFIG_SOUND_GAMEPORT=m
-CONFIG_GAMEPORT_NS558=m
-CONFIG_GAMEPORT_L4=m
-CONFIG_GAMEPORT_EMU10K1=m
-CONFIG_GAMEPORT_VORTEX=m
-CONFIG_GAMEPORT_FM801=m
-CONFIG_GAMEPORT_CS461x=m
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-# CONFIG_SERIO_PCIPS2 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_SERIAL=m
-CONFIG_MOUSE_INPORT=m
-CONFIG_MOUSE_ATIXL=y
-CONFIG_MOUSE_LOGIBM=m
-CONFIG_MOUSE_PC110PAD=m
-CONFIG_MOUSE_VSXXXAA=m
-CONFIG_INPUT_JOYSTICK=y
-CONFIG_JOYSTICK_ANALOG=m
-CONFIG_JOYSTICK_A3D=m
-CONFIG_JOYSTICK_ADI=m
-CONFIG_JOYSTICK_COBRA=m
-CONFIG_JOYSTICK_GF2K=m
-CONFIG_JOYSTICK_GRIP=m
-CONFIG_JOYSTICK_GRIP_MP=m
-CONFIG_JOYSTICK_GUILLEMOT=m
-CONFIG_JOYSTICK_INTERACT=m
-CONFIG_JOYSTICK_SIDEWINDER=m
-CONFIG_JOYSTICK_TMDC=m
-CONFIG_JOYSTICK_IFORCE=m
-CONFIG_JOYSTICK_IFORCE_USB=y
-CONFIG_JOYSTICK_IFORCE_232=y
-CONFIG_JOYSTICK_WARRIOR=m
-CONFIG_JOYSTICK_MAGELLAN=m
-CONFIG_JOYSTICK_SPACEORB=m
-CONFIG_JOYSTICK_SPACEBALL=m
-CONFIG_JOYSTICK_STINGER=m
-CONFIG_JOYSTICK_TWIDDLER=m
-CONFIG_JOYSTICK_DB9=m
-CONFIG_JOYSTICK_GAMECON=m
-CONFIG_JOYSTICK_TURBOGRAFX=m
-# CONFIG_INPUT_JOYDUMP is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_GUNZE=m
-CONFIG_INPUT_MISC=y
-CONFIG_INPUT_PCSPKR=m
-# CONFIG_INPUT_UINPUT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_SERIAL_NONSTANDARD=y
-# CONFIG_COMPUTONE is not set
-CONFIG_ROCKETPORT=m
-# CONFIG_CYCLADES is not set
-# CONFIG_DIGIEPCA is not set
-# CONFIG_DIGI is not set
-# CONFIG_ESPSERIAL is not set
-# CONFIG_MOXA_INTELLIO is not set
-# CONFIG_MOXA_SMARTIO is not set
-# CONFIG_ISI is not set
-CONFIG_SYNCLINK=m
-CONFIG_SYNCLINKMP=m
-CONFIG_N_HDLC=m
-# CONFIG_RISCOM8 is not set
-# CONFIG_SPECIALIX is not set
-# CONFIG_SX is not set
-# CONFIG_RIO is not set
-CONFIG_STALDRV=y
-# CONFIG_STALLION is not set
-# CONFIG_ISTALLION is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_CS=m
-# CONFIG_SERIAL_8250_ACPI is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_MULTIPORT=y
-CONFIG_SERIAL_8250_RSA=y
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-CONFIG_CRASH=m
-CONFIG_PRINTER=m
-CONFIG_LP_CONSOLE=y
-CONFIG_PPDEV=m
-CONFIG_TIPAR=m
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-CONFIG_IPMI_HANDLER=m
-# CONFIG_IPMI_PANIC_EVENT is not set
-CONFIG_IPMI_DEVICE_INTERFACE=m
-CONFIG_IPMI_SI=m
-CONFIG_IPMI_WATCHDOG=m
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-CONFIG_SOFT_WATCHDOG=m
-CONFIG_ACQUIRE_WDT=m
-CONFIG_ADVANTECH_WDT=m
-CONFIG_ALIM1535_WDT=m
-CONFIG_ALIM7101_WDT=m
-CONFIG_SC520_WDT=m
-CONFIG_EUROTECH_WDT=m
-CONFIG_IB700_WDT=m
-CONFIG_WAFER_WDT=m
-CONFIG_I8XX_TCO=m
-CONFIG_SC1200_WDT=m
-# CONFIG_SCx200_WDT is not set
-# CONFIG_60XX_WDT is not set
-CONFIG_CPU5_WDT=m
-CONFIG_W83627HF_WDT=m
-CONFIG_W83877F_WDT=m
-CONFIG_MACHZ_WDT=m
-
-#
-# ISA-based Watchdog Cards
-#
-CONFIG_PCWATCHDOG=m
-# CONFIG_MIXCOMWD is not set
-CONFIG_WDT=m
-# CONFIG_WDT_501 is not set
-
-#
-# PCI-based Watchdog Cards
-#
-CONFIG_PCIPCWATCHDOG=m
-CONFIG_WDTPCI=m
-CONFIG_WDT_501_PCI=y
-
-#
-# USB-based Watchdog Cards
-#
-CONFIG_USBPCWATCHDOG=m
-CONFIG_HW_RANDOM=m
-CONFIG_NVRAM=m
-CONFIG_RTC=y
-CONFIG_DTLK=m
-CONFIG_R3964=m
-# CONFIG_APPLICOM is not set
-CONFIG_SONYPI=m
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_FTAPE is not set
-CONFIG_AGP=y
-CONFIG_AGP_ALI=y
-CONFIG_AGP_ATI=y
-CONFIG_AGP_AMD=y
-CONFIG_AGP_AMD64=y
-CONFIG_AGP_INTEL=y
-CONFIG_AGP_INTEL_MCH=y
-CONFIG_AGP_NVIDIA=y
-CONFIG_AGP_SIS=y
-CONFIG_AGP_SWORKS=y
-CONFIG_AGP_VIA=y
-CONFIG_AGP_EFFICEON=y
-CONFIG_DRM=y
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_GAMMA=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_I810=m
-CONFIG_DRM_I830=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-
-#
-# PCMCIA character devices
-#
-CONFIG_SYNCLINK_CS=m
-CONFIG_MWAVE=m
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HPET is not set
-CONFIG_HANGCHECK_TIMER=m
-
-#
-# I2C support
-#
-CONFIG_I2C=m
-CONFIG_I2C_CHARDEV=m
-
-#
-# I2C Algorithms
-#
-CONFIG_I2C_ALGOBIT=m
-CONFIG_I2C_ALGOPCF=m
-
-#
-# I2C Hardware Bus support
-#
-CONFIG_I2C_ALI1535=m
-CONFIG_I2C_ALI1563=m
-CONFIG_I2C_ALI15X3=m
-CONFIG_I2C_AMD756=m
-CONFIG_I2C_AMD8111=m
-# CONFIG_I2C_ELEKTOR is not set
-CONFIG_I2C_I801=m
-CONFIG_I2C_I810=m
-CONFIG_I2C_ISA=m
-CONFIG_I2C_NFORCE2=m
-# CONFIG_I2C_PARPORT is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-CONFIG_I2C_PIIX4=m
-CONFIG_I2C_PROSAVAGE=m
-CONFIG_I2C_SAVAGE4=m
-# CONFIG_SCx200_ACB is not set
-CONFIG_I2C_SIS5595=m
-CONFIG_I2C_SIS630=m
-CONFIG_I2C_SIS96X=m
-CONFIG_I2C_VIA=m
-CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_VOODOO3=m
-
-#
-# Hardware Sensors Chip support
-#
-CONFIG_I2C_SENSOR=m
-CONFIG_SENSORS_ADM1021=m
-CONFIG_SENSORS_ASB100=m
-CONFIG_SENSORS_DS1621=m
-CONFIG_SENSORS_FSCHER=m
-CONFIG_SENSORS_GL518SM=m
-CONFIG_SENSORS_IT87=m
-CONFIG_SENSORS_LM75=m
-CONFIG_SENSORS_LM78=m
-CONFIG_SENSORS_LM80=m
-CONFIG_SENSORS_LM83=m
-CONFIG_SENSORS_LM85=m
-CONFIG_SENSORS_LM90=m
-CONFIG_SENSORS_MAX1619=m
-CONFIG_SENSORS_VIA686A=m
-CONFIG_SENSORS_W83781D=m
-CONFIG_SENSORS_W83L785TS=m
-CONFIG_SENSORS_W83627HF=m
-
-#
-# Other I2C Chip support
-#
-CONFIG_SENSORS_EEPROM=m
-CONFIG_SENSORS_PCF8574=m
-CONFIG_SENSORS_PCF8591=m
-CONFIG_SENSORS_RTC8564=m
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-CONFIG_IBM_ASM=m
-
-#
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
-#
-
-#
-# Video Adapters
-#
-CONFIG_VIDEO_BT848=m
-CONFIG_VIDEO_PMS=m
-CONFIG_VIDEO_BWQCAM=m
-CONFIG_VIDEO_CQCAM=m
-CONFIG_VIDEO_W9966=m
-CONFIG_VIDEO_CPIA=m
-CONFIG_VIDEO_CPIA_PP=m
-CONFIG_VIDEO_CPIA_USB=m
-CONFIG_VIDEO_SAA5246A=m
-CONFIG_VIDEO_SAA5249=m
-CONFIG_TUNER_3036=m
-CONFIG_VIDEO_STRADIS=m
-CONFIG_VIDEO_ZORAN=m
-CONFIG_VIDEO_ZORAN_BUZ=m
-CONFIG_VIDEO_ZORAN_DC10=m
-CONFIG_VIDEO_ZORAN_DC30=m
-CONFIG_VIDEO_ZORAN_LML33=m
-CONFIG_VIDEO_ZORAN_LML33R10=m
-CONFIG_VIDEO_MEYE=m
-CONFIG_VIDEO_SAA7134=m
-CONFIG_VIDEO_MXB=m
-CONFIG_VIDEO_DPC=m
-CONFIG_VIDEO_HEXIUM_ORION=m
-CONFIG_VIDEO_HEXIUM_GEMINI=m
-CONFIG_VIDEO_CX88=m
-
-#
-# Radio Adapters
-#
-CONFIG_RADIO_CADET=m
-CONFIG_RADIO_RTRACK=m
-CONFIG_RADIO_RTRACK2=m
-CONFIG_RADIO_AZTECH=m
-CONFIG_RADIO_GEMTEK=m
-CONFIG_RADIO_GEMTEK_PCI=m
-CONFIG_RADIO_MAXIRADIO=m
-CONFIG_RADIO_MAESTRO=m
-CONFIG_RADIO_SF16FMI=m
-CONFIG_RADIO_SF16FMR2=m
-CONFIG_RADIO_TERRATEC=m
-CONFIG_RADIO_TRUST=m
-CONFIG_RADIO_TYPHOON=m
-CONFIG_RADIO_TYPHOON_PROC_FS=y
-CONFIG_RADIO_ZOLTRIX=m
-
-#
-# Digital Video Broadcasting Devices
-#
-CONFIG_DVB=y
-CONFIG_DVB_CORE=m
-
-#
-# Supported Frontend Modules
-#
-CONFIG_DVB_TWINHAN_DST=m
-CONFIG_DVB_STV0299=m
-# CONFIG_DVB_SP887X is not set
-# CONFIG_DVB_ALPS_TDLB7 is not set
-CONFIG_DVB_ALPS_TDMB7=m
-CONFIG_DVB_ATMEL_AT76C651=m
-CONFIG_DVB_CX24110=m
-CONFIG_DVB_GRUNDIG_29504_491=m
-CONFIG_DVB_GRUNDIG_29504_401=m
-CONFIG_DVB_MT312=m
-CONFIG_DVB_VES1820=m
-CONFIG_DVB_VES1X93=m
-# CONFIG_DVB_TDA1004X is not set
-CONFIG_DVB_NXT6000=m
-
-#
-# Supported SAA7146 based PCI Adapters
-#
-CONFIG_DVB_AV7110=m
-CONFIG_DVB_AV7110_OSD=y
-CONFIG_DVB_BUDGET=m
-CONFIG_DVB_BUDGET_CI=m
-CONFIG_DVB_BUDGET_AV=m
-CONFIG_DVB_BUDGET_PATCH=m
-
-#
-# Supported USB Adapters
-#
-CONFIG_DVB_TTUSB_BUDGET=m
-CONFIG_DVB_TTUSB_DEC=m
-
-#
-# Supported FlexCopII (B2C2) Adapters
-#
-CONFIG_DVB_B2C2_SKYSTAR=m
-
-#
-# Supported BT878 Adapters
-#
-CONFIG_DVB_BT8XX=m
-CONFIG_VIDEO_SAA7146=m
-CONFIG_VIDEO_SAA7146_VV=m
-CONFIG_VIDEO_VIDEOBUF=m
-CONFIG_VIDEO_TUNER=m
-CONFIG_VIDEO_BUF=m
-CONFIG_VIDEO_BTCX=m
-CONFIG_VIDEO_IR=m
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-CONFIG_FB_VGA16=m
-CONFIG_FB_VESA=y
-CONFIG_VIDEO_SELECT=y
-CONFIG_FB_HGA=m
-CONFIG_FB_HGA_ACCEL=y
-CONFIG_FB_RIVA=m
-# CONFIG_FB_RIVA_I2C is not set
-CONFIG_FB_I810=m
-CONFIG_FB_I810_GTF=y
-CONFIG_FB_MATROX=m
-CONFIG_FB_MATROX_MILLENIUM=y
-CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
-CONFIG_FB_MATROX_I2C=m
-CONFIG_FB_MATROX_MAVEN=m
-CONFIG_FB_MATROX_MULTIHEAD=y
-# CONFIG_FB_RADEON_OLD is not set
-CONFIG_FB_RADEON=m
-CONFIG_FB_RADEON_I2C=y
-# CONFIG_FB_RADEON_DEBUG is not set
-CONFIG_FB_ATY128=m
-CONFIG_FB_ATY=m
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-CONFIG_FB_NEOMAGIC=m
-CONFIG_FB_KYRO=m
-CONFIG_FB_3DFX=m
-CONFIG_FB_3DFX_ACCEL=y
-CONFIG_FB_VOODOO1=m
-CONFIG_FB_TRIDENT=m
-CONFIG_FB_TRIDENT_ACCEL=y
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-CONFIG_VGA_CONSOLE=y
-CONFIG_MDA_CONSOLE=m
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Sound
-#
-CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-CONFIG_SND_HWDEP=m
-CONFIG_SND_RAWMIDI=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
-CONFIG_SND_RTCTIMER=m
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_MPU401_UART=m
-CONFIG_SND_OPL3_LIB=m
-CONFIG_SND_OPL4_LIB=m
-CONFIG_SND_VX_LIB=m
-CONFIG_SND_DUMMY=m
-CONFIG_SND_VIRMIDI=m
-CONFIG_SND_MTPAV=m
-# CONFIG_SND_SERIAL_U16550 is not set
-CONFIG_SND_MPU401=m
-
-#
-# ISA devices
-#
-CONFIG_SND_AD1816A=m
-CONFIG_SND_AD1848=m
-CONFIG_SND_CS4231=m
-CONFIG_SND_CS4232=m
-CONFIG_SND_CS4236=m
-CONFIG_SND_ES968=m
-CONFIG_SND_ES1688=m
-CONFIG_SND_ES18XX=m
-CONFIG_SND_GUSCLASSIC=m
-CONFIG_SND_GUSEXTREME=m
-CONFIG_SND_GUSMAX=m
-CONFIG_SND_INTERWAVE=m
-CONFIG_SND_INTERWAVE_STB=m
-CONFIG_SND_OPTI92X_AD1848=m
-CONFIG_SND_OPTI92X_CS4231=m
-CONFIG_SND_OPTI93X=m
-CONFIG_SND_SB8=m
-CONFIG_SND_SB16=m
-CONFIG_SND_SBAWE=m
-CONFIG_SND_SB16_CSP=y
-# CONFIG_SND_WAVEFRONT is not set
-CONFIG_SND_ALS100=m
-CONFIG_SND_AZT2320=m
-CONFIG_SND_CMI8330=m
-CONFIG_SND_DT019X=m
-CONFIG_SND_OPL3SA2=m
-CONFIG_SND_SGALAXY=m
-CONFIG_SND_SSCAPE=m
-
-#
-# PCI devices
-#
-CONFIG_SND_AC97_CODEC=m
-CONFIG_SND_ALI5451=m
-CONFIG_SND_ATIIXP=m
-CONFIG_SND_AU8810=m
-CONFIG_SND_AU8820=m
-CONFIG_SND_AU8830=m
-CONFIG_SND_AZT3328=m
-CONFIG_SND_BT87X=m
-CONFIG_SND_CS46XX=m
-CONFIG_SND_CS46XX_NEW_DSP=y
-CONFIG_SND_CS4281=m
-CONFIG_SND_EMU10K1=m
-CONFIG_SND_KORG1212=m
-CONFIG_SND_MIXART=m
-CONFIG_SND_NM256=m
-CONFIG_SND_RME32=m
-CONFIG_SND_RME96=m
-CONFIG_SND_RME9652=m
-CONFIG_SND_HDSP=m
-CONFIG_SND_TRIDENT=m
-CONFIG_SND_YMFPCI=m
-CONFIG_SND_ALS4000=m
-CONFIG_SND_CMIPCI=m
-CONFIG_SND_ENS1370=m
-CONFIG_SND_ENS1371=m
-CONFIG_SND_ES1938=m
-CONFIG_SND_ES1968=m
-CONFIG_SND_MAESTRO3=m
-CONFIG_SND_FM801=m
-CONFIG_SND_FM801_TEA575X=m
-CONFIG_SND_ICE1712=m
-CONFIG_SND_ICE1724=m
-CONFIG_SND_INTEL8X0=m
-CONFIG_SND_INTEL8X0M=m
-CONFIG_SND_SONICVIBES=m
-CONFIG_SND_VIA82XX=m
-CONFIG_SND_VX222=m
-
-#
-# ALSA USB devices
-#
-CONFIG_SND_USB_AUDIO=m
-
-#
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
-CONFIG_SND_PDAUDIOCF=m
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# USB support
-#
-CONFIG_USB=y
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_BANDWIDTH is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-
-#
-# USB Host Controller Drivers
-#
-CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_SPLIT_ISO=y
-CONFIG_USB_EHCI_ROOT_HUB_TT=y
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_UHCI_HCD=m
-
-#
-# USB Device Class drivers
-#
-CONFIG_USB_AUDIO=m
-
-#
-# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
-#
-CONFIG_USB_MIDI=m
-CONFIG_USB_ACM=m
-CONFIG_USB_PRINTER=m
-CONFIG_USB_STORAGE=m
-# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_RW_DETECT=y
-CONFIG_USB_STORAGE_DATAFAB=y
-CONFIG_USB_STORAGE_FREECOM=y
-CONFIG_USB_STORAGE_ISD200=y
-CONFIG_USB_STORAGE_DPCM=y
-CONFIG_USB_STORAGE_HP8200e=y
-CONFIG_USB_STORAGE_SDDR09=y
-CONFIG_USB_STORAGE_SDDR55=y
-CONFIG_USB_STORAGE_JUMPSHOT=y
-
-#
-# USB Human Interface Devices (HID)
-#
-CONFIG_USB_HID=y
-CONFIG_USB_HIDINPUT=y
-CONFIG_HID_FF=y
-CONFIG_HID_PID=y
-CONFIG_LOGITECH_FF=y
-CONFIG_THRUSTMASTER_FF=y
-CONFIG_USB_HIDDEV=y
-CONFIG_USB_AIPTEK=m
-CONFIG_USB_WACOM=m
-CONFIG_USB_KBTAB=m
-CONFIG_USB_POWERMATE=m
-CONFIG_USB_MTOUCH=m
-CONFIG_USB_EGALAX=m
-CONFIG_USB_XPAD=m
-CONFIG_USB_ATI_REMOTE=m
-
-#
-# USB Imaging devices
-#
-CONFIG_USB_MDC800=m
-CONFIG_USB_MICROTEK=m
-CONFIG_USB_HPUSBSCSI=m
-
-#
-# USB Multimedia devices
-#
-CONFIG_USB_DABUSB=m
-CONFIG_USB_VICAM=m
-CONFIG_USB_DSBR=m
-CONFIG_USB_IBMCAM=m
-CONFIG_USB_KONICAWC=m
-CONFIG_USB_OV511=m
-CONFIG_USB_SE401=m
-CONFIG_USB_STV680=m
-CONFIG_USB_W9968CF=m
-
-#
-# USB Network adaptors
-#
-CONFIG_USB_CATC=m
-CONFIG_USB_KAWETH=m
-CONFIG_USB_PEGASUS=m
-CONFIG_USB_RTL8150=m
-CONFIG_USB_USBNET=m
-
-#
-# USB Host-to-Host Cables
-#
-CONFIG_USB_ALI_M5632=y
-CONFIG_USB_AN2720=y
-CONFIG_USB_BELKIN=y
-CONFIG_USB_GENESYS=y
-CONFIG_USB_NET1080=y
-CONFIG_USB_PL2301=y
-
-#
-# Intelligent USB Devices/Gadgets
-#
-CONFIG_USB_ARMLINUX=y
-CONFIG_USB_EPSON2888=y
-CONFIG_USB_ZAURUS=y
-CONFIG_USB_CDCETHER=y
-
-#
-# USB Network Adapters
-#
-CONFIG_USB_AX8817X=y
-
-#
-# USB port drivers
-#
-CONFIG_USB_USS720=m
-
-#
-# USB Serial Converter support
-#
-CONFIG_USB_SERIAL=m
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_SERIAL_BELKIN=m
-CONFIG_USB_SERIAL_WHITEHEAT=m
-CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
-CONFIG_USB_SERIAL_EMPEG=m
-CONFIG_USB_SERIAL_FTDI_SIO=m
-CONFIG_USB_SERIAL_VISOR=m
-CONFIG_USB_SERIAL_IPAQ=m
-CONFIG_USB_SERIAL_IR=m
-CONFIG_USB_SERIAL_EDGEPORT=m
-CONFIG_USB_SERIAL_EDGEPORT_TI=m
-CONFIG_USB_SERIAL_KEYSPAN_PDA=m
-CONFIG_USB_SERIAL_KEYSPAN=m
-CONFIG_USB_SERIAL_KEYSPAN_MPR=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19=y
-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
-CONFIG_USB_SERIAL_KLSI=m
-CONFIG_USB_SERIAL_KOBIL_SCT=m
-CONFIG_USB_SERIAL_MCT_U232=m
-CONFIG_USB_SERIAL_PL2303=m
-CONFIG_USB_SERIAL_SAFE=m
-CONFIG_USB_SERIAL_SAFE_PADDED=y
-CONFIG_USB_SERIAL_CYBERJACK=m
-CONFIG_USB_SERIAL_XIRCOM=m
-CONFIG_USB_SERIAL_OMNINET=m
-CONFIG_USB_EZUSB=y
-
-#
-# USB Miscellaneous drivers
-#
-CONFIG_USB_EMI62=m
-# CONFIG_USB_EMI26 is not set
-CONFIG_USB_TIGL=m
-CONFIG_USB_AUERSWALD=m
-CONFIG_USB_RIO500=m
-CONFIG_USB_LEGOTOWER=m
-CONFIG_USB_LCD=m
-CONFIG_USB_LED=m
-# CONFIG_USB_CYTHERM is not set
-CONFIG_USB_PHIDGETSERVO=m
-CONFIG_USB_TEST=m
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-CONFIG_EXT2_FS_POSIX_ACL=y
-CONFIG_EXT2_FS_SECURITY=y
-CONFIG_EXT3_FS=m
-CONFIG_EXT3_FS_XATTR=y
-CONFIG_EXT3_FS_POSIX_ACL=y
-CONFIG_EXT3_FS_SECURITY=y
-CONFIG_JBD=m
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-CONFIG_REISERFS_PROC_INFO=y
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
-CONFIG_JFS_FS=m
-CONFIG_JFS_POSIX_ACL=y
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
-CONFIG_XFS_FS=m
-# CONFIG_XFS_RT is not set
-CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-CONFIG_MINIX_FS=m
-CONFIG_ROMFS_FS=m
-CONFIG_QUOTA=y
-# CONFIG_QFMT_V1 is not set
-CONFIG_QFMT_V2=y
-CONFIG_QUOTACTL=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-
-#
-# CD-ROM/DVD Filesystems
-#
-CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_ZISOFS_FS=y
-CONFIG_UDF_FS=m
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS_XATTR=y
-CONFIG_DEVPTS_FS_SECURITY=y
-CONFIG_TMPFS=y
-CONFIG_HUGETLBFS=y
-CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-# CONFIG_BEFS_DEBUG is not set
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-# CONFIG_JFFS_FS is not set
-CONFIG_JFFS2_FS=m
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_NAND=y
-CONFIG_CRAMFS=m
-CONFIG_VXFS_FS=m
-# CONFIG_HPFS_FS is not set
-CONFIG_QNX4FS_FS=m
-# CONFIG_QNX4FS_RW is not set
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-# CONFIG_UFS_FS_WRITE is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=m
-CONFIG_NFS_V3=y
-CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
-CONFIG_NFSD=m
-CONFIG_NFSD_V3=y
-CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_LOCKD=m
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
-CONFIG_SUNRPC=m
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT is not set
-CONFIG_CIFS=m
-# CONFIG_CIFS_STATS is not set
-CONFIG_NCP_FS=m
-CONFIG_NCPFS_PACKET_SIGNING=y
-CONFIG_NCPFS_IOCTL_LOCKING=y
-CONFIG_NCPFS_STRONG=y
-CONFIG_NCPFS_NFS_NS=y
-CONFIG_NCPFS_OS2_NS=y
-CONFIG_NCPFS_SMALLDOS=y
-CONFIG_NCPFS_NLS=y
-CONFIG_NCPFS_EXTRAS=y
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-CONFIG_OSF_PARTITION=y
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-CONFIG_MAC_PARTITION=y
-CONFIG_MSDOS_PARTITION=y
-CONFIG_BSD_DISKLABEL=y
-CONFIG_MINIX_SUBPARTITION=y
-CONFIG_SOLARIS_X86_PARTITION=y
-CONFIG_UNIXWARE_DISKLABEL=y
-# CONFIG_LDM_PARTITION is not set
-CONFIG_SGI_PARTITION=y
-# CONFIG_ULTRIX_PARTITION is not set
-CONFIG_SUN_PARTITION=y
-CONFIG_EFI_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="utf8"
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_CODEPAGE_737=m
-CONFIG_NLS_CODEPAGE_775=m
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-CONFIG_NLS_CODEPAGE_855=m
-CONFIG_NLS_CODEPAGE_857=m
-CONFIG_NLS_CODEPAGE_860=m
-CONFIG_NLS_CODEPAGE_861=m
-CONFIG_NLS_CODEPAGE_862=m
-CONFIG_NLS_CODEPAGE_863=m
-CONFIG_NLS_CODEPAGE_864=m
-CONFIG_NLS_CODEPAGE_865=m
-CONFIG_NLS_CODEPAGE_866=m
-CONFIG_NLS_CODEPAGE_869=m
-CONFIG_NLS_CODEPAGE_936=m
-CONFIG_NLS_CODEPAGE_950=m
-CONFIG_NLS_CODEPAGE_932=m
-CONFIG_NLS_CODEPAGE_949=m
-CONFIG_NLS_CODEPAGE_874=m
-CONFIG_NLS_ISO8859_8=m
-CONFIG_NLS_CODEPAGE_1250=m
-CONFIG_NLS_CODEPAGE_1251=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-CONFIG_NLS_ISO8859_5=m
-CONFIG_NLS_ISO8859_6=m
-CONFIG_NLS_ISO8859_7=m
-CONFIG_NLS_ISO8859_9=m
-CONFIG_NLS_ISO8859_13=m
-CONFIG_NLS_ISO8859_14=m
-CONFIG_NLS_ISO8859_15=m
-CONFIG_NLS_KOI8_R=m
-CONFIG_NLS_KOI8_U=m
-CONFIG_NLS_UTF8=m
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_DEBUG_STACKOVERFLOW=y
-# CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_SLAB is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
-# CONFIG_DEBUG_HIGHMEM is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_SPINLOCK_SLEEP=y
-# CONFIG_FRAME_POINTER is not set
-
-#
-# Security options
-#
-CONFIG_SECURITY=y
-CONFIG_SECURITY_NETWORK=y
-CONFIG_SECURITY_CAPABILITIES=y
-# CONFIG_SECURITY_ROOTPLUG is not set
-CONFIG_SECURITY_SELINUX=y
-CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
-CONFIG_SECURITY_SELINUX_DEVELOP=y
-# CONFIG_SECURITY_SELINUX_MLS is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_CAST5=m
-CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Library routines
-#
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_X86_BIOS_REBOOT=y
-CONFIG_PC=y
diff --git a/configs/kernel-2.6.7-i686-smp.config b/configs/kernel-2.6.7-i686-smp.config
deleted file mode 100644 (file)
index 9cf67ea..0000000
+++ /dev/null
@@ -1,2402 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_X86=y
-CONFIG_MMU=y
-CONFIG_UID16=y
-CONFIG_GENERIC_ISA_DMA=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
-CONFIG_LOG_BUF_SHIFT=17
-CONFIG_HOTPLUG=y
-# CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-CONFIG_KMOD=y
-CONFIG_STOP_MACHINE=y
-
-#
-# Processor type and features
-#
-# CONFIG_X86_PC is not set
-# CONFIG_X86_ELAN is not set
-# CONFIG_X86_VOYAGER is not set
-# CONFIG_X86_NUMAQ is not set
-# CONFIG_X86_SUMMIT is not set
-# CONFIG_X86_BIGSMP is not set
-# CONFIG_X86_VISWS is not set
-CONFIG_X86_GENERICARCH=y
-# CONFIG_X86_ES7000 is not set
-CONFIG_X86_CYCLONE_TIMER=y
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-CONFIG_M686=y
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP2 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-CONFIG_X86_GENERIC=y
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_XADD=y
-CONFIG_X86_L1_CACHE_SHIFT=7
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_GOOD_APIC=y
-CONFIG_X86_INTEL_USERCOPY=y
-CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_4G=y
-CONFIG_X86_SWITCH_PAGETABLES=y
-CONFIG_X86_4G_VM_LAYOUT=y
-CONFIG_X86_UACCESS_INDIRECT=y
-CONFIG_X86_HIGH_ENTRY=y
-CONFIG_HPET_TIMER=y
-CONFIG_HPET_EMULATE_RTC=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=32
-CONFIG_SCHED_SMT=y
-# CONFIG_PREEMPT is not set
-CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_IO_APIC=y
-CONFIG_X86_TSC=y
-CONFIG_X86_MCE=y
-# CONFIG_X86_MCE_NONFATAL is not set
-CONFIG_X86_MCE_P4THERMAL=y
-CONFIG_TOSHIBA=m
-CONFIG_I8K=m
-CONFIG_MICROCODE=m
-CONFIG_X86_MSR=m
-CONFIG_X86_CPUID=m
-
-#
-# Firmware Drivers
-#
-CONFIG_EDD=m
-# CONFIG_NOHIGHMEM is not set
-# CONFIG_HIGHMEM4G is not set
-CONFIG_HIGHMEM64G=y
-CONFIG_HIGHMEM=y
-CONFIG_X86_PAE=y
-# CONFIG_NUMA is not set
-CONFIG_HIGHPTE=y
-# CONFIG_MATH_EMULATION is not set
-CONFIG_MTRR=y
-# CONFIG_EFI is not set
-# CONFIG_IRQBALANCE is not set
-CONFIG_HAVE_DEC_LOCK=y
-CONFIG_REGPARM=y
-
-#
-# Power management options (ACPI, APM)
-#
-CONFIG_PM=y
-# CONFIG_SOFTWARE_SUSPEND is not set
-# CONFIG_PM_DISK is not set
-
-#
-# ACPI (Advanced Configuration and Power Interface) Support
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_AC=m
-CONFIG_ACPI_BATTERY=m
-CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_FAN=y
-CONFIG_ACPI_PROCESSOR=y
-CONFIG_ACPI_THERMAL=y
-CONFIG_ACPI_ASUS=m
-CONFIG_ACPI_TOSHIBA=m
-# CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
-CONFIG_ACPI_EC=y
-CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
-CONFIG_ACPI_SYSTEM=y
-CONFIG_X86_PM_TIMER=y
-
-#
-# APM (Advanced Power Management) BIOS Support
-#
-CONFIG_APM=y
-# CONFIG_APM_IGNORE_USER_SUSPEND is not set
-# CONFIG_APM_DO_ENABLE is not set
-CONFIG_APM_CPU_IDLE=y
-# CONFIG_APM_DISPLAY_BLANK is not set
-CONFIG_APM_RTC_IS_GMT=y
-# CONFIG_APM_ALLOW_INTS is not set
-# CONFIG_APM_REAL_MODE_POWER_OFF is not set
-
-#
-# CPU Frequency scaling
-#
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_PROC_INTF is not set
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-CONFIG_CPU_FREQ_GOV_POWERSAVE=m
-CONFIG_CPU_FREQ_GOV_USERSPACE=y
-# CONFIG_CPU_FREQ_24_API is not set
-CONFIG_CPU_FREQ_TABLE=y
-
-#
-# CPUFreq processor drivers
-#
-CONFIG_X86_ACPI_CPUFREQ=m
-# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
-CONFIG_X86_POWERNOW_K6=m
-CONFIG_X86_POWERNOW_K7=y
-CONFIG_X86_POWERNOW_K8=m
-# CONFIG_X86_GX_SUSPMOD is not set
-CONFIG_X86_SPEEDSTEP_CENTRINO=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y
-CONFIG_X86_SPEEDSTEP_ICH=y
-CONFIG_X86_SPEEDSTEP_SMI=m
-CONFIG_X86_P4_CLOCKMOD=m
-CONFIG_X86_SPEEDSTEP_LIB=y
-# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
-CONFIG_X86_LONGRUN=y
-# CONFIG_X86_LONGHAUL is not set
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-CONFIG_PCI=y
-# CONFIG_PCI_GOBIOS is not set
-# CONFIG_PCI_GOMMCONFIG is not set
-# CONFIG_PCI_GODIRECT is not set
-CONFIG_PCI_GOANY=y
-CONFIG_PCI_BIOS=y
-CONFIG_PCI_DIRECT=y
-CONFIG_PCI_MMCONFIG=y
-CONFIG_PCI_USE_VECTOR=y
-CONFIG_PCI_LEGACY_PROC=y
-# CONFIG_PCI_NAMES is not set
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SCx200 is not set
-
-#
-# PCMCIA/CardBus support
-#
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
-CONFIG_CARDBUS=y
-CONFIG_I82092=m
-CONFIG_I82365=m
-CONFIG_TCIC=m
-CONFIG_PCMCIA_PROBE=y
-
-#
-# PCI Hotplug Support
-#
-CONFIG_HOTPLUG_PCI=y
-# CONFIG_HOTPLUG_PCI_FAKE is not set
-CONFIG_HOTPLUG_PCI_COMPAQ=m
-# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
-CONFIG_HOTPLUG_PCI_IBM=m
-# CONFIG_HOTPLUG_PCI_ACPI is not set
-# CONFIG_HOTPLUG_PCI_CPCI is not set
-CONFIG_HOTPLUG_PCI_PCIE=m
-CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y
-CONFIG_HOTPLUG_PCI_SHPC=m
-CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_FW_LOADER=y
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=m
-# CONFIG_MTD_DEBUG is not set
-CONFIG_MTD_PARTITIONS=m
-CONFIG_MTD_CONCAT=m
-CONFIG_MTD_REDBOOT_PARTS=m
-CONFIG_MTD_CMDLINE_PARTS=m
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=m
-CONFIG_MTD_BLOCK=m
-CONFIG_MTD_BLOCK_RO=m
-CONFIG_FTL=m
-CONFIG_NFTL=m
-CONFIG_NFTL_RW=y
-CONFIG_INFTL=m
-
-#
-# RAM/ROM/Flash chip drivers
-#
-CONFIG_MTD_CFI=m
-CONFIG_MTD_JEDECPROBE=m
-CONFIG_MTD_GEN_PROBE=m
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_CFI_INTELEXT=m
-CONFIG_MTD_CFI_AMDSTD=m
-CONFIG_MTD_CFI_STAA=m
-CONFIG_MTD_RAM=m
-CONFIG_MTD_ROM=m
-CONFIG_MTD_ABSENT=m
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_PNC2000 is not set
-CONFIG_MTD_SC520CDP=m
-CONFIG_MTD_NETSC520=m
-CONFIG_MTD_SBC_GXX=m
-CONFIG_MTD_ELAN_104NC=m
-CONFIG_MTD_SCx200_DOCFLASH=m
-CONFIG_MTD_AMD76XROM=m
-CONFIG_MTD_ICH2ROM=m
-CONFIG_MTD_SCB2_FLASH=m
-# CONFIG_MTD_NETtel is not set
-# CONFIG_MTD_DILNETPC is not set
-CONFIG_MTD_L440GX=m
-CONFIG_MTD_PCI=m
-
-#
-# Self-contained MTD device drivers
-#
-CONFIG_MTD_PMC551=m
-# CONFIG_MTD_PMC551_BUGFIX is not set
-# CONFIG_MTD_PMC551_DEBUG is not set
-# CONFIG_MTD_SLRAM is not set
-CONFIG_MTD_MTDRAM=m
-CONFIG_MTDRAM_TOTAL_SIZE=4096
-CONFIG_MTDRAM_ERASE_SIZE=128
-# CONFIG_MTD_BLKMTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-CONFIG_MTD_DOC2000=m
-# CONFIG_MTD_DOC2001 is not set
-CONFIG_MTD_DOC2001PLUS=m
-CONFIG_MTD_DOCPROBE=m
-# CONFIG_MTD_DOCPROBE_ADVANCED is not set
-CONFIG_MTD_DOCPROBE_ADDRESS=0
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-CONFIG_MTD_NAND_IDS=m
-
-#
-# Parallel port support
-#
-CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-CONFIG_PARPORT_SERIAL=m
-# CONFIG_PARPORT_PC_FIFO is not set
-# CONFIG_PARPORT_PC_SUPERIO is not set
-CONFIG_PARPORT_PC_PCMCIA=m
-# CONFIG_PARPORT_OTHER is not set
-CONFIG_PARPORT_1284=y
-
-#
-# Plug and Play support
-#
-CONFIG_PNP=y
-# CONFIG_PNP_DEBUG is not set
-
-#
-# Protocols
-#
-CONFIG_ISAPNP=y
-# CONFIG_PNPBIOS is not set
-
-#
-# Block devices
-#
-CONFIG_BLK_DEV_FD=m
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-CONFIG_BLK_CPQ_DA=m
-CONFIG_BLK_CPQ_CISS_DA=m
-CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_DEV_DAC960=m
-CONFIG_BLK_DEV_UMEM=m
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_CRYPTOLOOP=m
-CONFIG_BLK_DEV_NBD=m
-CONFIG_BLK_DEV_CARMEL=m
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=16384
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_LBD=y
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_HD_IDE is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
-CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDETAPE=m
-CONFIG_BLK_DEV_IDEFLOPPY=y
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_CMD640 is not set
-CONFIG_BLK_DEV_IDEPNP=y
-CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
-# CONFIG_BLK_DEV_OPTI621 is not set
-CONFIG_BLK_DEV_RZ1000=y
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-CONFIG_IDEDMA_PCI_AUTO=y
-# CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
-CONFIG_BLK_DEV_AEC62XX=y
-CONFIG_BLK_DEV_ALI15X3=y
-# CONFIG_WDC_ALI15X3 is not set
-CONFIG_BLK_DEV_AMD74XX=y
-CONFIG_BLK_DEV_ATIIXP=y
-CONFIG_BLK_DEV_CMD64X=y
-CONFIG_BLK_DEV_TRIFLEX=y
-CONFIG_BLK_DEV_CY82C693=y
-CONFIG_BLK_DEV_CS5520=y
-CONFIG_BLK_DEV_CS5530=y
-CONFIG_BLK_DEV_HPT34X=y
-# CONFIG_HPT34X_AUTODMA is not set
-CONFIG_BLK_DEV_HPT366=y
-# CONFIG_BLK_DEV_SC1200 is not set
-CONFIG_BLK_DEV_PIIX=y
-# CONFIG_BLK_DEV_NS87415 is not set
-CONFIG_BLK_DEV_PDC202XX_OLD=y
-# CONFIG_PDC202XX_BURST is not set
-CONFIG_BLK_DEV_PDC202XX_NEW=y
-CONFIG_PDC202XX_FORCE=y
-CONFIG_BLK_DEV_SVWKS=y
-CONFIG_BLK_DEV_SIIMAGE=y
-CONFIG_BLK_DEV_SIS5513=y
-CONFIG_BLK_DEV_SLC90E66=y
-# CONFIG_BLK_DEV_TRM290 is not set
-CONFIG_BLK_DEV_VIA82CXXX=y
-# CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-CONFIG_SCSI=m
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=m
-CONFIG_CHR_DEV_ST=m
-CONFIG_CHR_DEV_OSST=m
-CONFIG_BLK_DEV_SR=m
-CONFIG_BLK_DEV_SR_VENDOR=y
-CONFIG_CHR_DEV_SG=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-CONFIG_SCSI_CONSTANTS=y
-CONFIG_SCSI_LOGGING=y
-
-#
-# SCSI Transport Attributes
-#
-CONFIG_SCSI_SPI_ATTRS=m
-CONFIG_SCSI_FC_ATTRS=m
-
-#
-# SCSI low-level drivers
-#
-CONFIG_BLK_DEV_3W_XXXX_RAID=m
-CONFIG_SCSI_3W_9XXX=m
-# CONFIG_SCSI_7000FASST is not set
-CONFIG_SCSI_ACARD=m
-CONFIG_SCSI_AHA152X=m
-CONFIG_SCSI_AHA1542=m
-CONFIG_SCSI_AACRAID=m
-CONFIG_SCSI_AIC7XXX=m
-CONFIG_AIC7XXX_CMDS_PER_DEVICE=4
-CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
-# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
-CONFIG_AIC7XXX_DEBUG_MASK=0
-# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
-CONFIG_SCSI_AIC7XXX_OLD=m
-CONFIG_SCSI_AIC79XX=m
-CONFIG_AIC79XX_CMDS_PER_DEVICE=4
-CONFIG_AIC79XX_RESET_DELAY_MS=15000
-# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
-# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
-# CONFIG_AIC79XX_DEBUG_ENABLE is not set
-CONFIG_AIC79XX_DEBUG_MASK=0
-# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
-# CONFIG_SCSI_DPT_I2O is not set
-CONFIG_SCSI_ADVANSYS=m
-CONFIG_SCSI_IN2000=m
-CONFIG_SCSI_MEGARAID=m
-CONFIG_SCSI_SATA=y
-CONFIG_SCSI_SATA_SVW=m
-CONFIG_SCSI_ATA_PIIX=m
-CONFIG_SCSI_SATA_PROMISE=m
-CONFIG_SCSI_SATA_SX4=m
-CONFIG_SCSI_SATA_SIL=m
-CONFIG_SCSI_SATA_SIS=m
-CONFIG_SCSI_SATA_VIA=m
-CONFIG_SCSI_SATA_VITESSE=m
-CONFIG_SCSI_BUSLOGIC=m
-# CONFIG_SCSI_OMIT_FLASHPOINT is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_PIO is not set
-CONFIG_SCSI_FUTURE_DOMAIN=m
-CONFIG_SCSI_GDTH=m
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
-CONFIG_SCSI_IPS=m
-CONFIG_SCSI_INIA100=m
-CONFIG_SCSI_PPA=m
-CONFIG_SCSI_IMM=m
-# CONFIG_SCSI_IZIP_EPP16 is not set
-# CONFIG_SCSI_IZIP_SLOW_CTR is not set
-# CONFIG_SCSI_NCR53C406A is not set
-CONFIG_SCSI_SYM53C8XX_2=m
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-CONFIG_SCSI_QLOGIC_FAS=m
-CONFIG_SCSI_QLOGIC_ISP=m
-# CONFIG_SCSI_QLOGIC_FC is not set
-CONFIG_SCSI_QLOGIC_1280=m
-CONFIG_SCSI_QLA2XXX=m
-CONFIG_SCSI_QLA21XX=m
-CONFIG_SCSI_QLA22XX=m
-CONFIG_SCSI_QLA2300=m
-CONFIG_SCSI_QLA2322=m
-CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
-# CONFIG_SCSI_SYM53C416 is not set
-# CONFIG_SCSI_DC395x is not set
-CONFIG_SCSI_DC390T=m
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_U14_34F is not set
-# CONFIG_SCSI_ULTRASTOR is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_DEBUG is not set
-
-#
-# PCMCIA SCSI adapter support
-#
-CONFIG_PCMCIA_AHA152X=m
-CONFIG_PCMCIA_FDOMAIN=m
-CONFIG_PCMCIA_NINJA_SCSI=m
-CONFIG_PCMCIA_QLOGIC=m
-CONFIG_PCMCIA_SYM53C500=m
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=m
-CONFIG_MD_RAID0=m
-CONFIG_MD_RAID1=m
-CONFIG_MD_RAID5=m
-CONFIG_MD_RAID6=m
-CONFIG_MD_MULTIPATH=m
-CONFIG_BLK_DEV_DM=m
-CONFIG_DM_CRYPT=m
-CONFIG_DM_SNAPSHOT=m
-CONFIG_DM_MIRROR=m
-CONFIG_DM_ZERO=m
-
-#
-# Fusion MPT device support
-#
-CONFIG_FUSION=m
-CONFIG_FUSION_MAX_SGE=40
-# CONFIG_FUSION_ISENSE is not set
-CONFIG_FUSION_CTL=m
-CONFIG_FUSION_LAN=m
-
-#
-# IEEE 1394 (FireWire) support
-#
-CONFIG_IEEE1394=m
-
-#
-# Subsystem Options
-#
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
-CONFIG_IEEE1394_OUI_DB=y
-# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
-
-#
-# Device Drivers
-#
-# CONFIG_IEEE1394_PCILYNX is not set
-CONFIG_IEEE1394_OHCI1394=m
-
-#
-# Protocol Drivers
-#
-CONFIG_IEEE1394_VIDEO1394=m
-CONFIG_IEEE1394_SBP2=m
-# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
-# CONFIG_IEEE1394_ETH1394 is not set
-CONFIG_IEEE1394_DV1394=m
-CONFIG_IEEE1394_RAWIO=m
-CONFIG_IEEE1394_CMP=m
-CONFIG_IEEE1394_AMDTP=m
-
-#
-# I2O device support
-#
-CONFIG_I2O=m
-CONFIG_I2O_CONFIG=m
-CONFIG_I2O_BLOCK=m
-CONFIG_I2O_SCSI=m
-CONFIG_I2O_PROC=m
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_FWMARK=y
-CONFIG_IP_ROUTE_NAT=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_TOS=y
-CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_PNP is not set
-CONFIG_NET_IPIP=m
-CONFIG_NET_IPGRE=m
-CONFIG_NET_IPGRE_BROADCAST=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-# CONFIG_ARPD is not set
-CONFIG_SYN_COOKIES=y
-CONFIG_INET_AH=m
-CONFIG_INET_ESP=m
-CONFIG_INET_IPCOMP=m
-
-#
-# IP: Virtual Server Configuration
-#
-CONFIG_IP_VS=m
-# CONFIG_IP_VS_DEBUG is not set
-CONFIG_IP_VS_TAB_BITS=12
-
-#
-# IPVS transport protocol load balancing support
-#
-CONFIG_IP_VS_PROTO_TCP=y
-CONFIG_IP_VS_PROTO_UDP=y
-CONFIG_IP_VS_PROTO_ESP=y
-CONFIG_IP_VS_PROTO_AH=y
-
-#
-# IPVS scheduler
-#
-CONFIG_IP_VS_RR=m
-CONFIG_IP_VS_WRR=m
-CONFIG_IP_VS_LC=m
-CONFIG_IP_VS_WLC=m
-CONFIG_IP_VS_LBLC=m
-CONFIG_IP_VS_LBLCR=m
-CONFIG_IP_VS_DH=m
-CONFIG_IP_VS_SH=m
-CONFIG_IP_VS_SED=m
-CONFIG_IP_VS_NQ=m
-
-#
-# IPVS application helper
-#
-CONFIG_IP_VS_FTP=m
-CONFIG_IPV6=m
-CONFIG_IPV6_PRIVACY=y
-CONFIG_INET6_AH=m
-CONFIG_INET6_ESP=m
-CONFIG_INET6_IPCOMP=m
-CONFIG_IPV6_TUNNEL=m
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-CONFIG_BRIDGE_NETFILTER=y
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_IP_NF_CONNTRACK=m
-CONFIG_IP_NF_FTP=m
-CONFIG_IP_NF_IRC=m
-CONFIG_IP_NF_TFTP=m
-CONFIG_IP_NF_AMANDA=m
-CONFIG_IP_NF_QUEUE=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_LIMIT=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_MAC=m
-CONFIG_IP_NF_MATCH_PKTTYPE=m
-CONFIG_IP_NF_MATCH_MARK=m
-CONFIG_IP_NF_MATCH_MULTIPORT=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
-CONFIG_IP_NF_MATCH_DSCP=m
-CONFIG_IP_NF_MATCH_AH_ESP=m
-CONFIG_IP_NF_MATCH_LENGTH=m
-CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_TCPMSS=m
-CONFIG_IP_NF_MATCH_HELPER=m
-CONFIG_IP_NF_MATCH_STATE=m
-CONFIG_IP_NF_MATCH_CONNTRACK=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_PHYSDEV=m
-CONFIG_IP_NF_FILTER=m
-CONFIG_IP_NF_TARGET_REJECT=m
-CONFIG_IP_NF_NAT=m
-CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
-CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
-CONFIG_IP_NF_NAT_LOCAL=y
-CONFIG_IP_NF_NAT_SNMP_BASIC=m
-CONFIG_IP_NF_NAT_IRC=m
-CONFIG_IP_NF_NAT_FTP=m
-CONFIG_IP_NF_NAT_TFTP=m
-CONFIG_IP_NF_NAT_AMANDA=m
-CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
-CONFIG_IP_NF_TARGET_ECN=m
-CONFIG_IP_NF_TARGET_DSCP=m
-CONFIG_IP_NF_TARGET_MARK=m
-CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
-CONFIG_IP_NF_ARPTABLES=m
-CONFIG_IP_NF_ARPFILTER=m
-CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
-
-#
-# IPv6: Netfilter Configuration
-#
-# CONFIG_IP6_NF_QUEUE is not set
-CONFIG_IP6_NF_IPTABLES=m
-CONFIG_IP6_NF_MATCH_LIMIT=m
-CONFIG_IP6_NF_MATCH_MAC=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_MATCH_OPTS=m
-CONFIG_IP6_NF_MATCH_FRAG=m
-CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_MULTIPORT=m
-CONFIG_IP6_NF_MATCH_OWNER=m
-CONFIG_IP6_NF_MATCH_MARK=m
-CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_AHESP=m
-CONFIG_IP6_NF_MATCH_LENGTH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_FILTER=m
-CONFIG_IP6_NF_TARGET_LOG=m
-CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_TARGET_MARK=m
-CONFIG_IP6_NF_RAW=m
-
-#
-# Bridge: Netfilter Configuration
-#
-CONFIG_BRIDGE_NF_EBTABLES=m
-CONFIG_BRIDGE_EBT_BROUTE=m
-CONFIG_BRIDGE_EBT_T_FILTER=m
-CONFIG_BRIDGE_EBT_T_NAT=m
-CONFIG_BRIDGE_EBT_802_3=m
-CONFIG_BRIDGE_EBT_AMONG=m
-CONFIG_BRIDGE_EBT_ARP=m
-CONFIG_BRIDGE_EBT_IP=m
-CONFIG_BRIDGE_EBT_LIMIT=m
-CONFIG_BRIDGE_EBT_MARK=m
-CONFIG_BRIDGE_EBT_PKTTYPE=m
-CONFIG_BRIDGE_EBT_STP=m
-CONFIG_BRIDGE_EBT_VLAN=m
-CONFIG_BRIDGE_EBT_ARPREPLY=m
-CONFIG_BRIDGE_EBT_DNAT=m
-CONFIG_BRIDGE_EBT_MARK_T=m
-CONFIG_BRIDGE_EBT_REDIRECT=m
-CONFIG_BRIDGE_EBT_SNAT=m
-CONFIG_BRIDGE_EBT_LOG=m
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-CONFIG_IP_SCTP=m
-# CONFIG_SCTP_DBG_MSG is not set
-# CONFIG_SCTP_DBG_OBJCNT is not set
-# CONFIG_SCTP_HMAC_NONE is not set
-# CONFIG_SCTP_HMAC_SHA1 is not set
-CONFIG_SCTP_HMAC_MD5=y
-# CONFIG_ATM is not set
-CONFIG_BRIDGE=m
-CONFIG_VLAN_8021Q=m
-# CONFIG_DECNET is not set
-CONFIG_LLC=m
-# CONFIG_LLC2 is not set
-CONFIG_IPX=m
-# CONFIG_IPX_INTERN is not set
-CONFIG_ATALK=m
-CONFIG_DEV_APPLETALK=y
-CONFIG_LTPC=m
-CONFIG_COPS=m
-CONFIG_COPS_DAYNA=y
-CONFIG_COPS_TANGENT=y
-CONFIG_IPDDP=m
-CONFIG_IPDDP_ENCAP=y
-CONFIG_IPDDP_DECAP=y
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-CONFIG_NET_DIVERT=y
-# CONFIG_ECONET is not set
-CONFIG_WAN_ROUTER=m
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
-
-#
-# QoS and/or fair queueing
-#
-CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
-CONFIG_NET_SCH_HTB=m
-CONFIG_NET_SCH_HFSC=m
-CONFIG_NET_SCH_CSZ=m
-CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RED=m
-CONFIG_NET_SCH_SFQ=m
-CONFIG_NET_SCH_TEQL=m
-CONFIG_NET_SCH_TBF=m
-CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
-CONFIG_NET_SCH_DELAY=m
-CONFIG_NET_SCH_INGRESS=m
-CONFIG_NET_QOS=y
-CONFIG_NET_ESTIMATOR=y
-CONFIG_NET_CLS=y
-CONFIG_NET_CLS_TCINDEX=m
-CONFIG_NET_CLS_ROUTE4=m
-CONFIG_NET_CLS_ROUTE=y
-CONFIG_NET_CLS_FW=m
-CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
-CONFIG_NET_CLS_POLICE=y
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-CONFIG_NETPOLL=y
-# CONFIG_NETPOLL_RX is not set
-# CONFIG_NETPOLL_TRAP is not set
-CONFIG_NET_POLL_CONTROLLER=y
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRNET=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-CONFIG_DONGLE=y
-CONFIG_ESI_DONGLE=m
-CONFIG_ACTISYS_DONGLE=m
-CONFIG_TEKRAM_DONGLE=m
-CONFIG_LITELINK_DONGLE=m
-CONFIG_MA600_DONGLE=m
-CONFIG_GIRBIL_DONGLE=m
-CONFIG_MCP2120_DONGLE=m
-CONFIG_OLD_BELKIN_DONGLE=m
-CONFIG_ACT200L_DONGLE=m
-
-#
-# Old SIR device drivers
-#
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_USB_IRDA=m
-CONFIG_SIGMATEL_FIR=m
-CONFIG_NSC_FIR=m
-# CONFIG_WINBOND_FIR is not set
-# CONFIG_TOSHIBA_FIR is not set
-# CONFIG_SMC_IRCC_FIR is not set
-# CONFIG_ALI_FIR is not set
-# CONFIG_VLSI_FIR is not set
-# CONFIG_VIA_FIR is not set
-CONFIG_BT=m
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_CMTP=m
-
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_HCIUSB=m
-CONFIG_BT_HCIUSB_SCO=y
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_BCSP_TXCRC=y
-CONFIG_BT_HCIBCM203X=m
-CONFIG_BT_HCIBFUSB=m
-CONFIG_BT_HCIDTL1=m
-CONFIG_BT_HCIBT3C=m
-CONFIG_BT_HCIBLUECARD=m
-CONFIG_BT_HCIBTUART=m
-CONFIG_BT_HCIVHCI=m
-CONFIG_TUX=m
-
-#
-# TUX options
-#
-CONFIG_TUX_EXTCGI=y
-# CONFIG_TUX_EXTENDED_LOG is not set
-# CONFIG_TUX_DEBUG is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-CONFIG_EQUALIZER=m
-CONFIG_TUN=m
-CONFIG_ETHERTAP=m
-CONFIG_NET_SB1000=m
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
-CONFIG_HAPPYMEAL=m
-CONFIG_SUNGEM=m
-CONFIG_NET_VENDOR_3COM=y
-CONFIG_EL1=m
-CONFIG_EL2=m
-CONFIG_ELPLUS=m
-CONFIG_EL16=m
-CONFIG_EL3=m
-CONFIG_3C515=m
-CONFIG_VORTEX=m
-CONFIG_TYPHOON=m
-CONFIG_LANCE=m
-CONFIG_NET_VENDOR_SMC=y
-CONFIG_WD80x3=m
-CONFIG_ULTRA=m
-CONFIG_SMC9194=m
-CONFIG_NET_VENDOR_RACAL=y
-CONFIG_NI52=m
-CONFIG_NI65=m
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-CONFIG_DE2104X=m
-CONFIG_TULIP=m
-# CONFIG_TULIP_MWI is not set
-CONFIG_TULIP_MMIO=y
-# CONFIG_TULIP_NAPI is not set
-CONFIG_DE4X5=m
-CONFIG_WINBOND_840=m
-CONFIG_DM9102=m
-CONFIG_PCMCIA_XIRCOM=m
-# CONFIG_AT1700 is not set
-CONFIG_DEPCA=m
-CONFIG_HP100=m
-# CONFIG_NET_ISA is not set
-CONFIG_NE2000=m
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-CONFIG_AMD8111_ETH=m
-CONFIG_AMD8111E_NAPI=y
-CONFIG_ADAPTEC_STARFIRE=m
-CONFIG_ADAPTEC_STARFIRE_NAPI=y
-CONFIG_AC3200=m
-CONFIG_APRICOT=m
-CONFIG_B44=m
-CONFIG_FORCEDETH=m
-CONFIG_CS89x0=m
-CONFIG_DGRS=m
-CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
-CONFIG_E100=m
-CONFIG_E100_NAPI=y
-CONFIG_FEALNX=m
-CONFIG_NATSEMI=m
-CONFIG_NE2K_PCI=m
-CONFIG_8139CP=m
-CONFIG_8139TOO=m
-CONFIG_8139TOO_PIO=y
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-CONFIG_8139TOO_8129=y
-# CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_SIS900=m
-CONFIG_EPIC100=m
-CONFIG_SUNDANCE=m
-# CONFIG_SUNDANCE_MMIO is not set
-CONFIG_TLAN=m
-CONFIG_VIA_RHINE=m
-CONFIG_VIA_RHINE_MMIO=y
-CONFIG_VIA_VELOCITY=m
-CONFIG_NET_POCKET=y
-CONFIG_ATP=m
-CONFIG_DE600=m
-CONFIG_DE620=m
-
-#
-# Ethernet (1000 Mbit)
-#
-CONFIG_ACENIC=m
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
-CONFIG_DL2K=m
-CONFIG_E1000=m
-CONFIG_E1000_NAPI=y
-CONFIG_NS83820=m
-CONFIG_HAMACHI=m
-CONFIG_YELLOWFIN=m
-CONFIG_R8169=m
-CONFIG_SK98LIN=m
-CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-CONFIG_IXGB_NAPI=y
-CONFIG_S2IO=m
-CONFIG_S2IO_NAPI=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-CONFIG_NET_RADIO=y
-
-#
-# Obsolete Wireless cards support (pre-802.11)
-#
-# CONFIG_STRIP is not set
-# CONFIG_ARLAN is not set
-CONFIG_WAVELAN=m
-CONFIG_PCMCIA_WAVELAN=m
-CONFIG_PCMCIA_NETWAVE=m
-
-#
-# Wireless 802.11 Frequency Hopping cards support
-#
-# CONFIG_PCMCIA_RAYCS is not set
-
-#
-# Wireless 802.11b ISA/PCI cards support
-#
-CONFIG_AIRO=m
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_PCI_HERMES=m
-CONFIG_ATMEL=m
-CONFIG_PCI_ATMEL=m
-
-#
-# Wireless 802.11b Pcmcia/Cardbus cards support
-#
-CONFIG_PCMCIA_HERMES=m
-CONFIG_AIRO_CS=m
-CONFIG_PCMCIA_ATMEL=m
-CONFIG_PCMCIA_WL3501=m
-
-#
-# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
-#
-CONFIG_PRISM54=m
-CONFIG_NET_WIRELESS=y
-
-#
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-CONFIG_FDDI=y
-# CONFIG_DEFXX is not set
-CONFIG_SKFP=m
-# CONFIG_HIPPI is not set
-CONFIG_PLIP=m
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-CONFIG_NET_FC=y
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=m
-
-#
-# ISDN subsystem
-#
-CONFIG_ISDN=m
-
-#
-# Old ISDN4Linux
-#
-CONFIG_ISDN_I4L=m
-CONFIG_ISDN_PPP=y
-CONFIG_ISDN_PPP_VJ=y
-CONFIG_ISDN_MPP=y
-CONFIG_IPPP_FILTER=y
-# CONFIG_ISDN_PPP_BSDCOMP is not set
-CONFIG_ISDN_AUDIO=y
-CONFIG_ISDN_TTY_FAX=y
-
-#
-# ISDN feature submodules
-#
-
-#
-# ISDN4Linux hardware drivers
-#
-
-#
-# Passive cards
-#
-CONFIG_ISDN_DRV_HISAX=m
-
-#
-# D-channel protocol features
-#
-CONFIG_HISAX_EURO=y
-CONFIG_DE_AOC=y
-CONFIG_HISAX_NO_SENDCOMPLETE=y
-CONFIG_HISAX_NO_LLC=y
-CONFIG_HISAX_NO_KEYPAD=y
-CONFIG_HISAX_1TR6=y
-CONFIG_HISAX_NI1=y
-CONFIG_HISAX_MAX_CARDS=8
-
-#
-# HiSax supported cards
-#
-CONFIG_HISAX_16_0=y
-CONFIG_HISAX_16_3=y
-CONFIG_HISAX_TELESPCI=y
-CONFIG_HISAX_S0BOX=y
-CONFIG_HISAX_AVM_A1=y
-CONFIG_HISAX_FRITZPCI=y
-CONFIG_HISAX_AVM_A1_PCMCIA=y
-CONFIG_HISAX_ELSA=y
-CONFIG_HISAX_IX1MICROR2=y
-CONFIG_HISAX_DIEHLDIVA=y
-CONFIG_HISAX_ASUSCOM=y
-CONFIG_HISAX_TELEINT=y
-CONFIG_HISAX_HFCS=y
-CONFIG_HISAX_SEDLBAUER=y
-CONFIG_HISAX_SPORTSTER=y
-CONFIG_HISAX_MIC=y
-CONFIG_HISAX_NETJET=y
-CONFIG_HISAX_NETJET_U=y
-CONFIG_HISAX_NICCY=y
-CONFIG_HISAX_ISURF=y
-CONFIG_HISAX_HSTSAPHIR=y
-CONFIG_HISAX_BKM_A4T=y
-CONFIG_HISAX_SCT_QUADRO=y
-CONFIG_HISAX_GAZEL=y
-CONFIG_HISAX_HFC_PCI=y
-CONFIG_HISAX_W6692=y
-CONFIG_HISAX_HFC_SX=y
-CONFIG_HISAX_ENTERNOW_PCI=y
-# CONFIG_HISAX_DEBUG is not set
-
-#
-# HiSax PCMCIA card service modules
-#
-CONFIG_HISAX_SEDLBAUER_CS=m
-CONFIG_HISAX_ELSA_CS=m
-CONFIG_HISAX_AVM_A1_CS=m
-CONFIG_HISAX_TELES_CS=m
-
-#
-# HiSax sub driver modules
-#
-CONFIG_HISAX_ST5481=m
-CONFIG_HISAX_HFCUSB=m
-CONFIG_HISAX_FRITZ_PCIPNP=m
-CONFIG_HISAX_HDLC=y
-
-#
-# Active cards
-#
-CONFIG_ISDN_DRV_ICN=m
-CONFIG_ISDN_DRV_PCBIT=m
-CONFIG_ISDN_DRV_SC=m
-CONFIG_ISDN_DRV_ACT2000=m
-CONFIG_ISDN_DRV_TPAM=m
-
-#
-# CAPI subsystem
-#
-CONFIG_ISDN_CAPI=m
-CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
-CONFIG_ISDN_CAPI_MIDDLEWARE=y
-CONFIG_ISDN_CAPI_CAPI20=m
-CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
-CONFIG_ISDN_CAPI_CAPIFS=m
-CONFIG_ISDN_CAPI_CAPIDRV=m
-
-#
-# CAPI hardware drivers
-#
-
-#
-# Active AVM cards
-#
-CONFIG_CAPI_AVM=y
-
-#
-# Active Eicon DIVA Server cards
-#
-CONFIG_CAPI_EICON=y
-CONFIG_ISDN_DIVAS=m
-CONFIG_ISDN_DIVAS_BRIPCI=y
-CONFIG_ISDN_DIVAS_PRIPCI=y
-CONFIG_ISDN_DIVAS_DIVACAPI=m
-CONFIG_ISDN_DIVAS_USERIDI=m
-CONFIG_ISDN_DIVAS_MAINT=m
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_JOYDEV=m
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=y
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-CONFIG_GAMEPORT=m
-CONFIG_SOUND_GAMEPORT=m
-CONFIG_GAMEPORT_NS558=m
-CONFIG_GAMEPORT_L4=m
-CONFIG_GAMEPORT_EMU10K1=m
-CONFIG_GAMEPORT_VORTEX=m
-CONFIG_GAMEPORT_FM801=m
-CONFIG_GAMEPORT_CS461x=m
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-# CONFIG_SERIO_PCIPS2 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_SERIAL=m
-CONFIG_MOUSE_INPORT=m
-CONFIG_MOUSE_ATIXL=y
-CONFIG_MOUSE_LOGIBM=m
-CONFIG_MOUSE_PC110PAD=m
-CONFIG_MOUSE_VSXXXAA=m
-CONFIG_INPUT_JOYSTICK=y
-CONFIG_JOYSTICK_ANALOG=m
-CONFIG_JOYSTICK_A3D=m
-CONFIG_JOYSTICK_ADI=m
-CONFIG_JOYSTICK_COBRA=m
-CONFIG_JOYSTICK_GF2K=m
-CONFIG_JOYSTICK_GRIP=m
-CONFIG_JOYSTICK_GRIP_MP=m
-CONFIG_JOYSTICK_GUILLEMOT=m
-CONFIG_JOYSTICK_INTERACT=m
-CONFIG_JOYSTICK_SIDEWINDER=m
-CONFIG_JOYSTICK_TMDC=m
-CONFIG_JOYSTICK_IFORCE=m
-CONFIG_JOYSTICK_IFORCE_USB=y
-CONFIG_JOYSTICK_IFORCE_232=y
-CONFIG_JOYSTICK_WARRIOR=m
-CONFIG_JOYSTICK_MAGELLAN=m
-CONFIG_JOYSTICK_SPACEORB=m
-CONFIG_JOYSTICK_SPACEBALL=m
-CONFIG_JOYSTICK_STINGER=m
-CONFIG_JOYSTICK_TWIDDLER=m
-CONFIG_JOYSTICK_DB9=m
-CONFIG_JOYSTICK_GAMECON=m
-CONFIG_JOYSTICK_TURBOGRAFX=m
-# CONFIG_INPUT_JOYDUMP is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_GUNZE=m
-CONFIG_INPUT_MISC=y
-CONFIG_INPUT_PCSPKR=m
-# CONFIG_INPUT_UINPUT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_SERIAL_NONSTANDARD=y
-CONFIG_ROCKETPORT=m
-# CONFIG_CYCLADES is not set
-CONFIG_SYNCLINK=m
-CONFIG_SYNCLINKMP=m
-CONFIG_N_HDLC=m
-CONFIG_STALDRV=y
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_CS=m
-# CONFIG_SERIAL_8250_ACPI is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_MULTIPORT=y
-CONFIG_SERIAL_8250_RSA=y
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-CONFIG_CRASH=m
-CONFIG_PRINTER=m
-CONFIG_LP_CONSOLE=y
-CONFIG_PPDEV=m
-CONFIG_TIPAR=m
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-CONFIG_IPMI_HANDLER=m
-# CONFIG_IPMI_PANIC_EVENT is not set
-CONFIG_IPMI_DEVICE_INTERFACE=m
-CONFIG_IPMI_SI=m
-CONFIG_IPMI_WATCHDOG=m
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-CONFIG_SOFT_WATCHDOG=m
-CONFIG_ACQUIRE_WDT=m
-CONFIG_ADVANTECH_WDT=m
-CONFIG_ALIM1535_WDT=m
-CONFIG_ALIM7101_WDT=m
-CONFIG_SC520_WDT=m
-CONFIG_EUROTECH_WDT=m
-CONFIG_IB700_WDT=m
-CONFIG_WAFER_WDT=m
-CONFIG_I8XX_TCO=m
-CONFIG_SC1200_WDT=m
-# CONFIG_SCx200_WDT is not set
-# CONFIG_60XX_WDT is not set
-CONFIG_CPU5_WDT=m
-CONFIG_W83627HF_WDT=m
-CONFIG_W83877F_WDT=m
-CONFIG_MACHZ_WDT=m
-
-#
-# ISA-based Watchdog Cards
-#
-CONFIG_PCWATCHDOG=m
-# CONFIG_MIXCOMWD is not set
-CONFIG_WDT=m
-# CONFIG_WDT_501 is not set
-
-#
-# PCI-based Watchdog Cards
-#
-CONFIG_PCIPCWATCHDOG=m
-CONFIG_WDTPCI=m
-CONFIG_WDT_501_PCI=y
-
-#
-# USB-based Watchdog Cards
-#
-CONFIG_USBPCWATCHDOG=m
-CONFIG_HW_RANDOM=m
-CONFIG_NVRAM=m
-CONFIG_RTC=y
-CONFIG_DTLK=m
-CONFIG_R3964=m
-# CONFIG_APPLICOM is not set
-CONFIG_SONYPI=m
-
-#
-# Ftape, the floppy tape device driver
-#
-CONFIG_AGP=y
-CONFIG_AGP_ALI=y
-CONFIG_AGP_ATI=y
-CONFIG_AGP_AMD=y
-CONFIG_AGP_AMD64=y
-CONFIG_AGP_INTEL=y
-CONFIG_AGP_INTEL_MCH=y
-CONFIG_AGP_NVIDIA=y
-CONFIG_AGP_SIS=y
-CONFIG_AGP_SWORKS=y
-CONFIG_AGP_VIA=y
-CONFIG_AGP_EFFICEON=y
-CONFIG_DRM=y
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_GAMMA=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_I810=m
-CONFIG_DRM_I830=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-
-#
-# PCMCIA character devices
-#
-CONFIG_SYNCLINK_CS=m
-CONFIG_MWAVE=m
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HPET is not set
-CONFIG_HANGCHECK_TIMER=m
-
-#
-# I2C support
-#
-CONFIG_I2C=m
-CONFIG_I2C_CHARDEV=m
-
-#
-# I2C Algorithms
-#
-CONFIG_I2C_ALGOBIT=m
-CONFIG_I2C_ALGOPCF=m
-
-#
-# I2C Hardware Bus support
-#
-CONFIG_I2C_ALI1535=m
-CONFIG_I2C_ALI1563=m
-CONFIG_I2C_ALI15X3=m
-CONFIG_I2C_AMD756=m
-CONFIG_I2C_AMD8111=m
-CONFIG_I2C_I801=m
-CONFIG_I2C_I810=m
-CONFIG_I2C_ISA=m
-CONFIG_I2C_NFORCE2=m
-# CONFIG_I2C_PARPORT is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-CONFIG_I2C_PIIX4=m
-CONFIG_I2C_PROSAVAGE=m
-CONFIG_I2C_SAVAGE4=m
-# CONFIG_SCx200_ACB is not set
-CONFIG_I2C_SIS5595=m
-CONFIG_I2C_SIS630=m
-CONFIG_I2C_SIS96X=m
-CONFIG_I2C_VIA=m
-CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_VOODOO3=m
-
-#
-# Hardware Sensors Chip support
-#
-CONFIG_I2C_SENSOR=m
-CONFIG_SENSORS_ADM1021=m
-CONFIG_SENSORS_ASB100=m
-CONFIG_SENSORS_DS1621=m
-CONFIG_SENSORS_FSCHER=m
-CONFIG_SENSORS_GL518SM=m
-CONFIG_SENSORS_IT87=m
-CONFIG_SENSORS_LM75=m
-CONFIG_SENSORS_LM78=m
-CONFIG_SENSORS_LM80=m
-CONFIG_SENSORS_LM83=m
-CONFIG_SENSORS_LM85=m
-CONFIG_SENSORS_LM90=m
-CONFIG_SENSORS_MAX1619=m
-CONFIG_SENSORS_VIA686A=m
-CONFIG_SENSORS_W83781D=m
-CONFIG_SENSORS_W83L785TS=m
-CONFIG_SENSORS_W83627HF=m
-
-#
-# Other I2C Chip support
-#
-CONFIG_SENSORS_EEPROM=m
-CONFIG_SENSORS_PCF8574=m
-CONFIG_SENSORS_PCF8591=m
-CONFIG_SENSORS_RTC8564=m
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-CONFIG_IBM_ASM=m
-
-#
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
-#
-
-#
-# Video Adapters
-#
-CONFIG_VIDEO_BT848=m
-CONFIG_VIDEO_PMS=m
-CONFIG_VIDEO_BWQCAM=m
-CONFIG_VIDEO_CQCAM=m
-CONFIG_VIDEO_W9966=m
-CONFIG_VIDEO_CPIA=m
-CONFIG_VIDEO_CPIA_PP=m
-CONFIG_VIDEO_CPIA_USB=m
-CONFIG_VIDEO_SAA5246A=m
-CONFIG_VIDEO_SAA5249=m
-CONFIG_TUNER_3036=m
-CONFIG_VIDEO_STRADIS=m
-CONFIG_VIDEO_ZORAN=m
-CONFIG_VIDEO_ZORAN_BUZ=m
-CONFIG_VIDEO_ZORAN_DC10=m
-CONFIG_VIDEO_ZORAN_DC30=m
-CONFIG_VIDEO_ZORAN_LML33=m
-CONFIG_VIDEO_ZORAN_LML33R10=m
-CONFIG_VIDEO_SAA7134=m
-CONFIG_VIDEO_MXB=m
-CONFIG_VIDEO_DPC=m
-CONFIG_VIDEO_HEXIUM_ORION=m
-CONFIG_VIDEO_HEXIUM_GEMINI=m
-CONFIG_VIDEO_CX88=m
-
-#
-# Radio Adapters
-#
-CONFIG_RADIO_CADET=m
-CONFIG_RADIO_RTRACK=m
-CONFIG_RADIO_RTRACK2=m
-CONFIG_RADIO_AZTECH=m
-CONFIG_RADIO_GEMTEK=m
-CONFIG_RADIO_GEMTEK_PCI=m
-CONFIG_RADIO_MAXIRADIO=m
-CONFIG_RADIO_MAESTRO=m
-CONFIG_RADIO_SF16FMI=m
-CONFIG_RADIO_SF16FMR2=m
-CONFIG_RADIO_TERRATEC=m
-CONFIG_RADIO_TRUST=m
-CONFIG_RADIO_TYPHOON=m
-CONFIG_RADIO_TYPHOON_PROC_FS=y
-CONFIG_RADIO_ZOLTRIX=m
-
-#
-# Digital Video Broadcasting Devices
-#
-CONFIG_DVB=y
-CONFIG_DVB_CORE=m
-
-#
-# Supported Frontend Modules
-#
-CONFIG_DVB_TWINHAN_DST=m
-CONFIG_DVB_STV0299=m
-# CONFIG_DVB_SP887X is not set
-# CONFIG_DVB_ALPS_TDLB7 is not set
-CONFIG_DVB_ALPS_TDMB7=m
-CONFIG_DVB_ATMEL_AT76C651=m
-CONFIG_DVB_CX24110=m
-CONFIG_DVB_GRUNDIG_29504_491=m
-CONFIG_DVB_GRUNDIG_29504_401=m
-CONFIG_DVB_MT312=m
-CONFIG_DVB_VES1820=m
-CONFIG_DVB_VES1X93=m
-# CONFIG_DVB_TDA1004X is not set
-CONFIG_DVB_NXT6000=m
-
-#
-# Supported SAA7146 based PCI Adapters
-#
-CONFIG_DVB_AV7110=m
-CONFIG_DVB_AV7110_OSD=y
-CONFIG_DVB_BUDGET=m
-CONFIG_DVB_BUDGET_CI=m
-CONFIG_DVB_BUDGET_AV=m
-CONFIG_DVB_BUDGET_PATCH=m
-
-#
-# Supported USB Adapters
-#
-CONFIG_DVB_TTUSB_BUDGET=m
-CONFIG_DVB_TTUSB_DEC=m
-
-#
-# Supported FlexCopII (B2C2) Adapters
-#
-CONFIG_DVB_B2C2_SKYSTAR=m
-
-#
-# Supported BT878 Adapters
-#
-CONFIG_DVB_BT8XX=m
-CONFIG_VIDEO_SAA7146=m
-CONFIG_VIDEO_SAA7146_VV=m
-CONFIG_VIDEO_VIDEOBUF=m
-CONFIG_VIDEO_TUNER=m
-CONFIG_VIDEO_BUF=m
-CONFIG_VIDEO_BTCX=m
-CONFIG_VIDEO_IR=m
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-CONFIG_FB_VGA16=m
-CONFIG_FB_VESA=y
-CONFIG_VIDEO_SELECT=y
-CONFIG_FB_HGA=m
-CONFIG_FB_HGA_ACCEL=y
-CONFIG_FB_RIVA=m
-# CONFIG_FB_RIVA_I2C is not set
-CONFIG_FB_I810=m
-CONFIG_FB_I810_GTF=y
-CONFIG_FB_MATROX=m
-CONFIG_FB_MATROX_MILLENIUM=y
-CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
-CONFIG_FB_MATROX_I2C=m
-CONFIG_FB_MATROX_MAVEN=m
-CONFIG_FB_MATROX_MULTIHEAD=y
-# CONFIG_FB_RADEON_OLD is not set
-CONFIG_FB_RADEON=m
-CONFIG_FB_RADEON_I2C=y
-# CONFIG_FB_RADEON_DEBUG is not set
-CONFIG_FB_ATY128=m
-CONFIG_FB_ATY=m
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-CONFIG_FB_NEOMAGIC=m
-CONFIG_FB_KYRO=m
-CONFIG_FB_3DFX=m
-CONFIG_FB_3DFX_ACCEL=y
-CONFIG_FB_VOODOO1=m
-CONFIG_FB_TRIDENT=m
-CONFIG_FB_TRIDENT_ACCEL=y
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-CONFIG_VGA_CONSOLE=y
-CONFIG_MDA_CONSOLE=m
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Sound
-#
-CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-CONFIG_SND_HWDEP=m
-CONFIG_SND_RAWMIDI=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
-CONFIG_SND_RTCTIMER=m
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_MPU401_UART=m
-CONFIG_SND_OPL3_LIB=m
-CONFIG_SND_OPL4_LIB=m
-CONFIG_SND_VX_LIB=m
-CONFIG_SND_DUMMY=m
-CONFIG_SND_VIRMIDI=m
-CONFIG_SND_MTPAV=m
-# CONFIG_SND_SERIAL_U16550 is not set
-CONFIG_SND_MPU401=m
-
-#
-# ISA devices
-#
-CONFIG_SND_AD1816A=m
-CONFIG_SND_AD1848=m
-CONFIG_SND_CS4231=m
-CONFIG_SND_CS4232=m
-CONFIG_SND_CS4236=m
-CONFIG_SND_ES968=m
-CONFIG_SND_ES1688=m
-CONFIG_SND_ES18XX=m
-CONFIG_SND_GUSCLASSIC=m
-CONFIG_SND_GUSEXTREME=m
-CONFIG_SND_GUSMAX=m
-CONFIG_SND_INTERWAVE=m
-CONFIG_SND_INTERWAVE_STB=m
-CONFIG_SND_OPTI92X_AD1848=m
-CONFIG_SND_OPTI92X_CS4231=m
-CONFIG_SND_OPTI93X=m
-CONFIG_SND_SB8=m
-CONFIG_SND_SB16=m
-CONFIG_SND_SBAWE=m
-CONFIG_SND_SB16_CSP=y
-# CONFIG_SND_WAVEFRONT is not set
-CONFIG_SND_ALS100=m
-CONFIG_SND_AZT2320=m
-CONFIG_SND_CMI8330=m
-CONFIG_SND_DT019X=m
-CONFIG_SND_OPL3SA2=m
-CONFIG_SND_SGALAXY=m
-CONFIG_SND_SSCAPE=m
-
-#
-# PCI devices
-#
-CONFIG_SND_AC97_CODEC=m
-CONFIG_SND_ALI5451=m
-CONFIG_SND_ATIIXP=m
-CONFIG_SND_AU8810=m
-CONFIG_SND_AU8820=m
-CONFIG_SND_AU8830=m
-CONFIG_SND_AZT3328=m
-CONFIG_SND_BT87X=m
-CONFIG_SND_CS46XX=m
-CONFIG_SND_CS46XX_NEW_DSP=y
-CONFIG_SND_CS4281=m
-CONFIG_SND_EMU10K1=m
-CONFIG_SND_KORG1212=m
-CONFIG_SND_MIXART=m
-CONFIG_SND_NM256=m
-CONFIG_SND_RME32=m
-CONFIG_SND_RME96=m
-CONFIG_SND_RME9652=m
-CONFIG_SND_HDSP=m
-CONFIG_SND_TRIDENT=m
-CONFIG_SND_YMFPCI=m
-CONFIG_SND_ALS4000=m
-CONFIG_SND_CMIPCI=m
-CONFIG_SND_ENS1370=m
-CONFIG_SND_ENS1371=m
-CONFIG_SND_ES1938=m
-CONFIG_SND_ES1968=m
-CONFIG_SND_MAESTRO3=m
-CONFIG_SND_FM801=m
-CONFIG_SND_FM801_TEA575X=m
-CONFIG_SND_ICE1712=m
-CONFIG_SND_ICE1724=m
-CONFIG_SND_INTEL8X0=m
-CONFIG_SND_INTEL8X0M=m
-CONFIG_SND_SONICVIBES=m
-CONFIG_SND_VIA82XX=m
-CONFIG_SND_VX222=m
-
-#
-# ALSA USB devices
-#
-CONFIG_SND_USB_AUDIO=m
-
-#
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
-CONFIG_SND_PDAUDIOCF=m
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# USB support
-#
-CONFIG_USB=y
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_BANDWIDTH is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-
-#
-# USB Host Controller Drivers
-#
-CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_SPLIT_ISO=y
-CONFIG_USB_EHCI_ROOT_HUB_TT=y
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_UHCI_HCD=m
-
-#
-# USB Device Class drivers
-#
-CONFIG_USB_AUDIO=m
-
-#
-# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
-#
-CONFIG_USB_MIDI=m
-CONFIG_USB_ACM=m
-CONFIG_USB_PRINTER=m
-CONFIG_USB_STORAGE=m
-# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_RW_DETECT=y
-CONFIG_USB_STORAGE_DATAFAB=y
-CONFIG_USB_STORAGE_FREECOM=y
-CONFIG_USB_STORAGE_ISD200=y
-CONFIG_USB_STORAGE_DPCM=y
-CONFIG_USB_STORAGE_HP8200e=y
-CONFIG_USB_STORAGE_SDDR09=y
-CONFIG_USB_STORAGE_SDDR55=y
-CONFIG_USB_STORAGE_JUMPSHOT=y
-
-#
-# USB Human Interface Devices (HID)
-#
-CONFIG_USB_HID=y
-CONFIG_USB_HIDINPUT=y
-CONFIG_HID_FF=y
-CONFIG_HID_PID=y
-CONFIG_LOGITECH_FF=y
-CONFIG_THRUSTMASTER_FF=y
-CONFIG_USB_HIDDEV=y
-CONFIG_USB_AIPTEK=m
-CONFIG_USB_WACOM=m
-CONFIG_USB_KBTAB=m
-CONFIG_USB_POWERMATE=m
-CONFIG_USB_MTOUCH=m
-CONFIG_USB_EGALAX=m
-CONFIG_USB_XPAD=m
-CONFIG_USB_ATI_REMOTE=m
-
-#
-# USB Imaging devices
-#
-CONFIG_USB_MDC800=m
-CONFIG_USB_MICROTEK=m
-CONFIG_USB_HPUSBSCSI=m
-
-#
-# USB Multimedia devices
-#
-CONFIG_USB_DABUSB=m
-CONFIG_USB_VICAM=m
-CONFIG_USB_DSBR=m
-CONFIG_USB_IBMCAM=m
-CONFIG_USB_KONICAWC=m
-CONFIG_USB_OV511=m
-CONFIG_USB_SE401=m
-CONFIG_USB_STV680=m
-CONFIG_USB_W9968CF=m
-
-#
-# USB Network adaptors
-#
-CONFIG_USB_CATC=m
-CONFIG_USB_KAWETH=m
-CONFIG_USB_PEGASUS=m
-CONFIG_USB_RTL8150=m
-CONFIG_USB_USBNET=m
-
-#
-# USB Host-to-Host Cables
-#
-CONFIG_USB_ALI_M5632=y
-CONFIG_USB_AN2720=y
-CONFIG_USB_BELKIN=y
-CONFIG_USB_GENESYS=y
-CONFIG_USB_NET1080=y
-CONFIG_USB_PL2301=y
-
-#
-# Intelligent USB Devices/Gadgets
-#
-CONFIG_USB_ARMLINUX=y
-CONFIG_USB_EPSON2888=y
-CONFIG_USB_ZAURUS=y
-CONFIG_USB_CDCETHER=y
-
-#
-# USB Network Adapters
-#
-CONFIG_USB_AX8817X=y
-
-#
-# USB port drivers
-#
-CONFIG_USB_USS720=m
-
-#
-# USB Serial Converter support
-#
-CONFIG_USB_SERIAL=m
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_SERIAL_BELKIN=m
-CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
-CONFIG_USB_SERIAL_EMPEG=m
-CONFIG_USB_SERIAL_FTDI_SIO=m
-CONFIG_USB_SERIAL_VISOR=m
-CONFIG_USB_SERIAL_IPAQ=m
-CONFIG_USB_SERIAL_IR=m
-CONFIG_USB_SERIAL_EDGEPORT=m
-CONFIG_USB_SERIAL_EDGEPORT_TI=m
-CONFIG_USB_SERIAL_KEYSPAN_PDA=m
-CONFIG_USB_SERIAL_KEYSPAN=m
-CONFIG_USB_SERIAL_KEYSPAN_MPR=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19=y
-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
-CONFIG_USB_SERIAL_KLSI=m
-CONFIG_USB_SERIAL_KOBIL_SCT=m
-CONFIG_USB_SERIAL_MCT_U232=m
-CONFIG_USB_SERIAL_PL2303=m
-CONFIG_USB_SERIAL_SAFE=m
-CONFIG_USB_SERIAL_SAFE_PADDED=y
-CONFIG_USB_SERIAL_CYBERJACK=m
-CONFIG_USB_SERIAL_XIRCOM=m
-CONFIG_USB_SERIAL_OMNINET=m
-CONFIG_USB_EZUSB=y
-
-#
-# USB Miscellaneous drivers
-#
-CONFIG_USB_EMI62=m
-# CONFIG_USB_EMI26 is not set
-CONFIG_USB_TIGL=m
-CONFIG_USB_AUERSWALD=m
-CONFIG_USB_RIO500=m
-CONFIG_USB_LEGOTOWER=m
-CONFIG_USB_LCD=m
-CONFIG_USB_LED=m
-# CONFIG_USB_CYTHERM is not set
-CONFIG_USB_PHIDGETSERVO=m
-CONFIG_USB_TEST=m
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-CONFIG_EXT2_FS_POSIX_ACL=y
-CONFIG_EXT2_FS_SECURITY=y
-CONFIG_EXT3_FS=m
-CONFIG_EXT3_FS_XATTR=y
-CONFIG_EXT3_FS_POSIX_ACL=y
-CONFIG_EXT3_FS_SECURITY=y
-CONFIG_JBD=m
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-CONFIG_REISERFS_PROC_INFO=y
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
-CONFIG_JFS_FS=m
-CONFIG_JFS_POSIX_ACL=y
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
-CONFIG_XFS_FS=m
-# CONFIG_XFS_RT is not set
-CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-CONFIG_MINIX_FS=m
-CONFIG_ROMFS_FS=m
-CONFIG_QUOTA=y
-# CONFIG_QFMT_V1 is not set
-CONFIG_QFMT_V2=y
-CONFIG_QUOTACTL=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-
-#
-# CD-ROM/DVD Filesystems
-#
-CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_ZISOFS_FS=y
-CONFIG_UDF_FS=m
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS_XATTR=y
-CONFIG_DEVPTS_FS_SECURITY=y
-CONFIG_TMPFS=y
-CONFIG_HUGETLBFS=y
-CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-# CONFIG_BEFS_DEBUG is not set
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-# CONFIG_JFFS_FS is not set
-CONFIG_JFFS2_FS=m
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_NAND=y
-CONFIG_CRAMFS=m
-CONFIG_VXFS_FS=m
-# CONFIG_HPFS_FS is not set
-CONFIG_QNX4FS_FS=m
-# CONFIG_QNX4FS_RW is not set
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-# CONFIG_UFS_FS_WRITE is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=m
-CONFIG_NFS_V3=y
-CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
-CONFIG_NFSD=m
-CONFIG_NFSD_V3=y
-CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_LOCKD=m
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
-CONFIG_SUNRPC=m
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT is not set
-CONFIG_CIFS=m
-# CONFIG_CIFS_STATS is not set
-CONFIG_NCP_FS=m
-CONFIG_NCPFS_PACKET_SIGNING=y
-CONFIG_NCPFS_IOCTL_LOCKING=y
-CONFIG_NCPFS_STRONG=y
-CONFIG_NCPFS_NFS_NS=y
-CONFIG_NCPFS_OS2_NS=y
-CONFIG_NCPFS_SMALLDOS=y
-CONFIG_NCPFS_NLS=y
-CONFIG_NCPFS_EXTRAS=y
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-CONFIG_OSF_PARTITION=y
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-CONFIG_MAC_PARTITION=y
-CONFIG_MSDOS_PARTITION=y
-CONFIG_BSD_DISKLABEL=y
-CONFIG_MINIX_SUBPARTITION=y
-CONFIG_SOLARIS_X86_PARTITION=y
-CONFIG_UNIXWARE_DISKLABEL=y
-# CONFIG_LDM_PARTITION is not set
-CONFIG_SGI_PARTITION=y
-# CONFIG_ULTRIX_PARTITION is not set
-CONFIG_SUN_PARTITION=y
-CONFIG_EFI_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="utf8"
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_CODEPAGE_737=m
-CONFIG_NLS_CODEPAGE_775=m
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-CONFIG_NLS_CODEPAGE_855=m
-CONFIG_NLS_CODEPAGE_857=m
-CONFIG_NLS_CODEPAGE_860=m
-CONFIG_NLS_CODEPAGE_861=m
-CONFIG_NLS_CODEPAGE_862=m
-CONFIG_NLS_CODEPAGE_863=m
-CONFIG_NLS_CODEPAGE_864=m
-CONFIG_NLS_CODEPAGE_865=m
-CONFIG_NLS_CODEPAGE_866=m
-CONFIG_NLS_CODEPAGE_869=m
-CONFIG_NLS_CODEPAGE_936=m
-CONFIG_NLS_CODEPAGE_950=m
-CONFIG_NLS_CODEPAGE_932=m
-CONFIG_NLS_CODEPAGE_949=m
-CONFIG_NLS_CODEPAGE_874=m
-CONFIG_NLS_ISO8859_8=m
-CONFIG_NLS_CODEPAGE_1250=m
-CONFIG_NLS_CODEPAGE_1251=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-CONFIG_NLS_ISO8859_5=m
-CONFIG_NLS_ISO8859_6=m
-CONFIG_NLS_ISO8859_7=m
-CONFIG_NLS_ISO8859_9=m
-CONFIG_NLS_ISO8859_13=m
-CONFIG_NLS_ISO8859_14=m
-CONFIG_NLS_ISO8859_15=m
-CONFIG_NLS_KOI8_R=m
-CONFIG_NLS_KOI8_U=m
-CONFIG_NLS_UTF8=m
-
-#
-# Profiling support
-#
-CONFIG_PROFILING=y
-CONFIG_OPROFILE=m
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_DEBUG_STACKOVERFLOW=y
-# CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_SLAB is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
-# CONFIG_DEBUG_HIGHMEM is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_SPINLOCK_SLEEP=y
-# CONFIG_FRAME_POINTER is not set
-CONFIG_X86_FIND_SMP_CONFIG=y
-CONFIG_X86_MPPARSE=y
-
-#
-# Security options
-#
-CONFIG_SECURITY=y
-CONFIG_SECURITY_NETWORK=y
-CONFIG_SECURITY_CAPABILITIES=y
-# CONFIG_SECURITY_ROOTPLUG is not set
-CONFIG_SECURITY_SELINUX=y
-CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
-CONFIG_SECURITY_SELINUX_DEVELOP=y
-# CONFIG_SECURITY_SELINUX_MLS is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_CAST5=m
-CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Library routines
-#
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_X86_SMP=y
-CONFIG_X86_HT=y
-CONFIG_X86_BIOS_REBOOT=y
-CONFIG_X86_TRAMPOLINE=y
-CONFIG_PC=y
diff --git a/configs/kernel-2.6.7-i686.config b/configs/kernel-2.6.7-i686.config
deleted file mode 100644 (file)
index 7445bef..0000000
+++ /dev/null
@@ -1,2417 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_X86=y
-CONFIG_MMU=y
-CONFIG_UID16=y
-CONFIG_GENERIC_ISA_DMA=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-# CONFIG_BSD_PROCESS_ACCT_V3 is not set
-CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
-CONFIG_LOG_BUF_SHIFT=17
-CONFIG_HOTPLUG=y
-# CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-CONFIG_KMOD=y
-
-#
-# Processor type and features
-#
-CONFIG_X86_PC=y
-# CONFIG_X86_ELAN is not set
-# CONFIG_X86_VOYAGER is not set
-# CONFIG_X86_NUMAQ is not set
-# CONFIG_X86_SUMMIT is not set
-# CONFIG_X86_BIGSMP is not set
-# CONFIG_X86_VISWS is not set
-# CONFIG_X86_GENERICARCH is not set
-# CONFIG_X86_ES7000 is not set
-# CONFIG_M386 is not set
-# CONFIG_M486 is not set
-# CONFIG_M586 is not set
-# CONFIG_M586TSC is not set
-# CONFIG_M586MMX is not set
-CONFIG_M686=y
-# CONFIG_MPENTIUMII is not set
-# CONFIG_MPENTIUMIII is not set
-# CONFIG_MPENTIUMM is not set
-# CONFIG_MPENTIUM4 is not set
-# CONFIG_MK6 is not set
-# CONFIG_MK7 is not set
-# CONFIG_MK8 is not set
-# CONFIG_MCRUSOE is not set
-# CONFIG_MWINCHIPC6 is not set
-# CONFIG_MWINCHIP2 is not set
-# CONFIG_MWINCHIP3D is not set
-# CONFIG_MCYRIXIII is not set
-# CONFIG_MVIAC3_2 is not set
-CONFIG_X86_GENERIC=y
-CONFIG_X86_CMPXCHG=y
-CONFIG_X86_XADD=y
-CONFIG_X86_L1_CACHE_SHIFT=7
-CONFIG_RWSEM_XCHGADD_ALGORITHM=y
-CONFIG_X86_PPRO_FENCE=y
-CONFIG_X86_WP_WORKS_OK=y
-CONFIG_X86_INVLPG=y
-CONFIG_X86_BSWAP=y
-CONFIG_X86_POPAD_OK=y
-CONFIG_X86_GOOD_APIC=y
-CONFIG_X86_INTEL_USERCOPY=y
-CONFIG_X86_USE_PPRO_CHECKSUM=y
-CONFIG_X86_4G=y
-CONFIG_X86_SWITCH_PAGETABLES=y
-CONFIG_X86_4G_VM_LAYOUT=y
-CONFIG_X86_UACCESS_INDIRECT=y
-CONFIG_X86_HIGH_ENTRY=y
-CONFIG_HPET_TIMER=y
-CONFIG_HPET_EMULATE_RTC=y
-# CONFIG_SMP is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_X86_UP_APIC is not set
-CONFIG_X86_TSC=y
-CONFIG_X86_MCE=y
-# CONFIG_X86_MCE_NONFATAL is not set
-CONFIG_TOSHIBA=m
-CONFIG_I8K=m
-CONFIG_MICROCODE=m
-CONFIG_X86_MSR=m
-CONFIG_X86_CPUID=m
-
-#
-# Firmware Drivers
-#
-CONFIG_EDD=m
-# CONFIG_NOHIGHMEM is not set
-CONFIG_HIGHMEM4G=y
-# CONFIG_HIGHMEM64G is not set
-CONFIG_HIGHMEM=y
-CONFIG_HIGHPTE=y
-# CONFIG_MATH_EMULATION is not set
-CONFIG_MTRR=y
-# CONFIG_EFI is not set
-CONFIG_REGPARM=y
-
-#
-# Power management options (ACPI, APM)
-#
-CONFIG_PM=y
-# CONFIG_SOFTWARE_SUSPEND is not set
-# CONFIG_PM_DISK is not set
-
-#
-# ACPI (Advanced Configuration and Power Interface) Support
-#
-CONFIG_ACPI=y
-CONFIG_ACPI_BOOT=y
-CONFIG_ACPI_INTERPRETER=y
-CONFIG_ACPI_SLEEP=y
-CONFIG_ACPI_SLEEP_PROC_FS=y
-CONFIG_ACPI_AC=m
-CONFIG_ACPI_BATTERY=m
-CONFIG_ACPI_BUTTON=m
-CONFIG_ACPI_FAN=y
-CONFIG_ACPI_PROCESSOR=y
-CONFIG_ACPI_THERMAL=y
-CONFIG_ACPI_ASUS=m
-CONFIG_ACPI_TOSHIBA=m
-# CONFIG_ACPI_DEBUG is not set
-CONFIG_ACPI_BUS=y
-CONFIG_ACPI_EC=y
-CONFIG_ACPI_POWER=y
-CONFIG_ACPI_PCI=y
-CONFIG_ACPI_SYSTEM=y
-CONFIG_X86_PM_TIMER=y
-
-#
-# APM (Advanced Power Management) BIOS Support
-#
-CONFIG_APM=y
-# CONFIG_APM_IGNORE_USER_SUSPEND is not set
-# CONFIG_APM_DO_ENABLE is not set
-CONFIG_APM_CPU_IDLE=y
-# CONFIG_APM_DISPLAY_BLANK is not set
-CONFIG_APM_RTC_IS_GMT=y
-# CONFIG_APM_ALLOW_INTS is not set
-# CONFIG_APM_REAL_MODE_POWER_OFF is not set
-
-#
-# CPU Frequency scaling
-#
-CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_PROC_INTF is not set
-# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
-CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
-CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-CONFIG_CPU_FREQ_GOV_POWERSAVE=m
-CONFIG_CPU_FREQ_GOV_USERSPACE=y
-# CONFIG_CPU_FREQ_24_API is not set
-CONFIG_CPU_FREQ_TABLE=y
-
-#
-# CPUFreq processor drivers
-#
-CONFIG_X86_ACPI_CPUFREQ=m
-# CONFIG_X86_ACPI_CPUFREQ_PROC_INTF is not set
-CONFIG_X86_POWERNOW_K6=m
-CONFIG_X86_POWERNOW_K7=y
-CONFIG_X86_POWERNOW_K8=m
-# CONFIG_X86_GX_SUSPMOD is not set
-CONFIG_X86_SPEEDSTEP_CENTRINO=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y
-CONFIG_X86_SPEEDSTEP_CENTRINO_ACPI=y
-CONFIG_X86_SPEEDSTEP_ICH=y
-CONFIG_X86_SPEEDSTEP_SMI=m
-CONFIG_X86_P4_CLOCKMOD=m
-CONFIG_X86_SPEEDSTEP_LIB=y
-# CONFIG_X86_SPEEDSTEP_RELAXED_CAP_CHECK is not set
-CONFIG_X86_LONGRUN=y
-# CONFIG_X86_LONGHAUL is not set
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-CONFIG_PCI=y
-# CONFIG_PCI_GOBIOS is not set
-# CONFIG_PCI_GOMMCONFIG is not set
-# CONFIG_PCI_GODIRECT is not set
-CONFIG_PCI_GOANY=y
-CONFIG_PCI_BIOS=y
-CONFIG_PCI_DIRECT=y
-CONFIG_PCI_MMCONFIG=y
-CONFIG_PCI_LEGACY_PROC=y
-# CONFIG_PCI_NAMES is not set
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SCx200 is not set
-
-#
-# PCMCIA/CardBus support
-#
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
-CONFIG_CARDBUS=y
-CONFIG_I82092=m
-CONFIG_I82365=m
-CONFIG_TCIC=m
-CONFIG_PCMCIA_PROBE=y
-
-#
-# PCI Hotplug Support
-#
-CONFIG_HOTPLUG_PCI=y
-# CONFIG_HOTPLUG_PCI_FAKE is not set
-CONFIG_HOTPLUG_PCI_COMPAQ=m
-# CONFIG_HOTPLUG_PCI_COMPAQ_NVRAM is not set
-# CONFIG_HOTPLUG_PCI_ACPI is not set
-# CONFIG_HOTPLUG_PCI_CPCI is not set
-CONFIG_HOTPLUG_PCI_PCIE=m
-CONFIG_HOTPLUG_PCI_PCIE_POLL_EVENT_MODE=y
-CONFIG_HOTPLUG_PCI_SHPC=m
-CONFIG_HOTPLUG_PCI_SHPC_POLL_EVENT_MODE=y
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_AOUT is not set
-CONFIG_BINFMT_MISC=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_FW_LOADER=y
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=m
-# CONFIG_MTD_DEBUG is not set
-CONFIG_MTD_PARTITIONS=m
-CONFIG_MTD_CONCAT=m
-CONFIG_MTD_REDBOOT_PARTS=m
-CONFIG_MTD_CMDLINE_PARTS=m
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=m
-CONFIG_MTD_BLOCK=m
-CONFIG_MTD_BLOCK_RO=m
-CONFIG_FTL=m
-CONFIG_NFTL=m
-CONFIG_NFTL_RW=y
-CONFIG_INFTL=m
-
-#
-# RAM/ROM/Flash chip drivers
-#
-CONFIG_MTD_CFI=m
-CONFIG_MTD_JEDECPROBE=m
-CONFIG_MTD_GEN_PROBE=m
-# CONFIG_MTD_CFI_ADV_OPTIONS is not set
-CONFIG_MTD_CFI_INTELEXT=m
-CONFIG_MTD_CFI_AMDSTD=m
-CONFIG_MTD_CFI_STAA=m
-CONFIG_MTD_RAM=m
-CONFIG_MTD_ROM=m
-CONFIG_MTD_ABSENT=m
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_PNC2000 is not set
-CONFIG_MTD_SC520CDP=m
-CONFIG_MTD_NETSC520=m
-CONFIG_MTD_SBC_GXX=m
-CONFIG_MTD_ELAN_104NC=m
-CONFIG_MTD_SCx200_DOCFLASH=m
-CONFIG_MTD_AMD76XROM=m
-CONFIG_MTD_ICH2ROM=m
-CONFIG_MTD_SCB2_FLASH=m
-# CONFIG_MTD_NETtel is not set
-# CONFIG_MTD_DILNETPC is not set
-CONFIG_MTD_L440GX=m
-CONFIG_MTD_PCI=m
-
-#
-# Self-contained MTD device drivers
-#
-CONFIG_MTD_PMC551=m
-# CONFIG_MTD_PMC551_BUGFIX is not set
-# CONFIG_MTD_PMC551_DEBUG is not set
-# CONFIG_MTD_SLRAM is not set
-CONFIG_MTD_MTDRAM=m
-CONFIG_MTDRAM_TOTAL_SIZE=4096
-CONFIG_MTDRAM_ERASE_SIZE=128
-# CONFIG_MTD_BLKMTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-CONFIG_MTD_DOC2000=m
-# CONFIG_MTD_DOC2001 is not set
-CONFIG_MTD_DOC2001PLUS=m
-CONFIG_MTD_DOCPROBE=m
-# CONFIG_MTD_DOCPROBE_ADVANCED is not set
-CONFIG_MTD_DOCPROBE_ADDRESS=0
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-CONFIG_MTD_NAND_IDS=m
-
-#
-# Parallel port support
-#
-CONFIG_PARPORT=m
-CONFIG_PARPORT_PC=m
-CONFIG_PARPORT_PC_CML1=m
-CONFIG_PARPORT_SERIAL=m
-# CONFIG_PARPORT_PC_FIFO is not set
-# CONFIG_PARPORT_PC_SUPERIO is not set
-CONFIG_PARPORT_PC_PCMCIA=m
-# CONFIG_PARPORT_OTHER is not set
-CONFIG_PARPORT_1284=y
-
-#
-# Plug and Play support
-#
-CONFIG_PNP=y
-# CONFIG_PNP_DEBUG is not set
-
-#
-# Protocols
-#
-CONFIG_ISAPNP=y
-# CONFIG_PNPBIOS is not set
-
-#
-# Block devices
-#
-CONFIG_BLK_DEV_FD=m
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-CONFIG_BLK_CPQ_DA=m
-CONFIG_BLK_CPQ_CISS_DA=m
-CONFIG_CISS_SCSI_TAPE=y
-CONFIG_BLK_DEV_DAC960=m
-CONFIG_BLK_DEV_UMEM=m
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_CRYPTOLOOP=m
-CONFIG_BLK_DEV_NBD=m
-CONFIG_BLK_DEV_CARMEL=m
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=16384
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_LBD=y
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_HD_IDE is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
-CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDETAPE=m
-CONFIG_BLK_DEV_IDEFLOPPY=y
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_CMD640 is not set
-CONFIG_BLK_DEV_IDEPNP=y
-CONFIG_BLK_DEV_IDEPCI=y
-CONFIG_IDEPCI_SHARE_IRQ=y
-# CONFIG_BLK_DEV_OFFBOARD is not set
-CONFIG_BLK_DEV_GENERIC=y
-# CONFIG_BLK_DEV_OPTI621 is not set
-CONFIG_BLK_DEV_RZ1000=y
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-CONFIG_IDEDMA_PCI_AUTO=y
-# CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
-CONFIG_BLK_DEV_AEC62XX=y
-CONFIG_BLK_DEV_ALI15X3=y
-# CONFIG_WDC_ALI15X3 is not set
-CONFIG_BLK_DEV_AMD74XX=y
-CONFIG_BLK_DEV_ATIIXP=y
-CONFIG_BLK_DEV_CMD64X=y
-CONFIG_BLK_DEV_TRIFLEX=y
-CONFIG_BLK_DEV_CY82C693=y
-CONFIG_BLK_DEV_CS5520=y
-CONFIG_BLK_DEV_CS5530=y
-CONFIG_BLK_DEV_HPT34X=y
-# CONFIG_HPT34X_AUTODMA is not set
-CONFIG_BLK_DEV_HPT366=y
-# CONFIG_BLK_DEV_SC1200 is not set
-CONFIG_BLK_DEV_PIIX=y
-# CONFIG_BLK_DEV_NS87415 is not set
-CONFIG_BLK_DEV_PDC202XX_OLD=y
-# CONFIG_PDC202XX_BURST is not set
-CONFIG_BLK_DEV_PDC202XX_NEW=y
-CONFIG_PDC202XX_FORCE=y
-CONFIG_BLK_DEV_SVWKS=y
-CONFIG_BLK_DEV_SIIMAGE=y
-CONFIG_BLK_DEV_SIS5513=y
-CONFIG_BLK_DEV_SLC90E66=y
-# CONFIG_BLK_DEV_TRM290 is not set
-CONFIG_BLK_DEV_VIA82CXXX=y
-# CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-CONFIG_SCSI=m
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=m
-CONFIG_CHR_DEV_ST=m
-CONFIG_CHR_DEV_OSST=m
-CONFIG_BLK_DEV_SR=m
-CONFIG_BLK_DEV_SR_VENDOR=y
-CONFIG_CHR_DEV_SG=m
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-CONFIG_SCSI_CONSTANTS=y
-CONFIG_SCSI_LOGGING=y
-
-#
-# SCSI Transport Attributes
-#
-CONFIG_SCSI_SPI_ATTRS=m
-CONFIG_SCSI_FC_ATTRS=m
-
-#
-# SCSI low-level drivers
-#
-CONFIG_BLK_DEV_3W_XXXX_RAID=m
-CONFIG_SCSI_3W_9XXX=m
-# CONFIG_SCSI_7000FASST is not set
-CONFIG_SCSI_ACARD=m
-CONFIG_SCSI_AHA152X=m
-CONFIG_SCSI_AHA1542=m
-CONFIG_SCSI_AACRAID=m
-CONFIG_SCSI_AIC7XXX=m
-CONFIG_AIC7XXX_CMDS_PER_DEVICE=4
-CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
-# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
-CONFIG_AIC7XXX_DEBUG_MASK=0
-# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
-CONFIG_SCSI_AIC7XXX_OLD=m
-CONFIG_SCSI_AIC79XX=m
-CONFIG_AIC79XX_CMDS_PER_DEVICE=4
-CONFIG_AIC79XX_RESET_DELAY_MS=15000
-# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
-# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
-# CONFIG_AIC79XX_DEBUG_ENABLE is not set
-CONFIG_AIC79XX_DEBUG_MASK=0
-# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
-# CONFIG_SCSI_DPT_I2O is not set
-CONFIG_SCSI_ADVANSYS=m
-CONFIG_SCSI_IN2000=m
-CONFIG_SCSI_MEGARAID=m
-CONFIG_SCSI_SATA=y
-CONFIG_SCSI_SATA_SVW=m
-CONFIG_SCSI_ATA_PIIX=m
-CONFIG_SCSI_SATA_PROMISE=m
-CONFIG_SCSI_SATA_SX4=m
-CONFIG_SCSI_SATA_SIL=m
-CONFIG_SCSI_SATA_SIS=m
-CONFIG_SCSI_SATA_VIA=m
-CONFIG_SCSI_SATA_VITESSE=m
-CONFIG_SCSI_BUSLOGIC=m
-# CONFIG_SCSI_OMIT_FLASHPOINT is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_PIO is not set
-CONFIG_SCSI_FUTURE_DOMAIN=m
-CONFIG_SCSI_GDTH=m
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
-CONFIG_SCSI_IPS=m
-CONFIG_SCSI_INIA100=m
-CONFIG_SCSI_PPA=m
-CONFIG_SCSI_IMM=m
-# CONFIG_SCSI_IZIP_EPP16 is not set
-# CONFIG_SCSI_IZIP_SLOW_CTR is not set
-# CONFIG_SCSI_NCR53C406A is not set
-CONFIG_SCSI_SYM53C8XX_2=m
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
-# CONFIG_SCSI_PSI240I is not set
-CONFIG_SCSI_QLOGIC_FAS=m
-CONFIG_SCSI_QLOGIC_ISP=m
-# CONFIG_SCSI_QLOGIC_FC is not set
-CONFIG_SCSI_QLOGIC_1280=m
-CONFIG_SCSI_QLA2XXX=m
-CONFIG_SCSI_QLA21XX=m
-CONFIG_SCSI_QLA22XX=m
-CONFIG_SCSI_QLA2300=m
-CONFIG_SCSI_QLA2322=m
-CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
-# CONFIG_SCSI_SYM53C416 is not set
-# CONFIG_SCSI_DC395x is not set
-CONFIG_SCSI_DC390T=m
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_U14_34F is not set
-# CONFIG_SCSI_ULTRASTOR is not set
-# CONFIG_SCSI_NSP32 is not set
-# CONFIG_SCSI_DEBUG is not set
-
-#
-# PCMCIA SCSI adapter support
-#
-CONFIG_PCMCIA_AHA152X=m
-CONFIG_PCMCIA_FDOMAIN=m
-CONFIG_PCMCIA_NINJA_SCSI=m
-CONFIG_PCMCIA_QLOGIC=m
-CONFIG_PCMCIA_SYM53C500=m
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=m
-CONFIG_MD_RAID0=m
-CONFIG_MD_RAID1=m
-CONFIG_MD_RAID5=m
-CONFIG_MD_RAID6=m
-CONFIG_MD_MULTIPATH=m
-CONFIG_BLK_DEV_DM=m
-CONFIG_DM_CRYPT=m
-CONFIG_DM_SNAPSHOT=m
-CONFIG_DM_MIRROR=m
-CONFIG_DM_ZERO=m
-
-#
-# Fusion MPT device support
-#
-CONFIG_FUSION=m
-CONFIG_FUSION_MAX_SGE=40
-# CONFIG_FUSION_ISENSE is not set
-CONFIG_FUSION_CTL=m
-CONFIG_FUSION_LAN=m
-
-#
-# IEEE 1394 (FireWire) support
-#
-CONFIG_IEEE1394=m
-
-#
-# Subsystem Options
-#
-# CONFIG_IEEE1394_VERBOSEDEBUG is not set
-CONFIG_IEEE1394_OUI_DB=y
-# CONFIG_IEEE1394_EXTRA_CONFIG_ROMS is not set
-
-#
-# Device Drivers
-#
-# CONFIG_IEEE1394_PCILYNX is not set
-CONFIG_IEEE1394_OHCI1394=m
-
-#
-# Protocol Drivers
-#
-CONFIG_IEEE1394_VIDEO1394=m
-CONFIG_IEEE1394_SBP2=m
-# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
-# CONFIG_IEEE1394_ETH1394 is not set
-CONFIG_IEEE1394_DV1394=m
-CONFIG_IEEE1394_RAWIO=m
-CONFIG_IEEE1394_CMP=m
-CONFIG_IEEE1394_AMDTP=m
-
-#
-# I2O device support
-#
-CONFIG_I2O=m
-CONFIG_I2O_CONFIG=m
-CONFIG_I2O_BLOCK=m
-CONFIG_I2O_SCSI=m
-CONFIG_I2O_PROC=m
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_FWMARK=y
-CONFIG_IP_ROUTE_NAT=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_TOS=y
-CONFIG_IP_ROUTE_VERBOSE=y
-# CONFIG_IP_PNP is not set
-CONFIG_NET_IPIP=m
-CONFIG_NET_IPGRE=m
-CONFIG_NET_IPGRE_BROADCAST=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-# CONFIG_ARPD is not set
-CONFIG_SYN_COOKIES=y
-CONFIG_INET_AH=m
-CONFIG_INET_ESP=m
-CONFIG_INET_IPCOMP=m
-
-#
-# IP: Virtual Server Configuration
-#
-CONFIG_IP_VS=m
-# CONFIG_IP_VS_DEBUG is not set
-CONFIG_IP_VS_TAB_BITS=12
-
-#
-# IPVS transport protocol load balancing support
-#
-CONFIG_IP_VS_PROTO_TCP=y
-CONFIG_IP_VS_PROTO_UDP=y
-CONFIG_IP_VS_PROTO_ESP=y
-CONFIG_IP_VS_PROTO_AH=y
-
-#
-# IPVS scheduler
-#
-CONFIG_IP_VS_RR=m
-CONFIG_IP_VS_WRR=m
-CONFIG_IP_VS_LC=m
-CONFIG_IP_VS_WLC=m
-CONFIG_IP_VS_LBLC=m
-CONFIG_IP_VS_LBLCR=m
-CONFIG_IP_VS_DH=m
-CONFIG_IP_VS_SH=m
-CONFIG_IP_VS_SED=m
-CONFIG_IP_VS_NQ=m
-
-#
-# IPVS application helper
-#
-CONFIG_IP_VS_FTP=m
-CONFIG_IPV6=m
-CONFIG_IPV6_PRIVACY=y
-CONFIG_INET6_AH=m
-CONFIG_INET6_ESP=m
-CONFIG_INET6_IPCOMP=m
-CONFIG_IPV6_TUNNEL=m
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-CONFIG_BRIDGE_NETFILTER=y
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_IP_NF_CONNTRACK=m
-CONFIG_IP_NF_FTP=m
-CONFIG_IP_NF_IRC=m
-CONFIG_IP_NF_TFTP=m
-CONFIG_IP_NF_AMANDA=m
-CONFIG_IP_NF_QUEUE=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_LIMIT=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_MAC=m
-CONFIG_IP_NF_MATCH_PKTTYPE=m
-CONFIG_IP_NF_MATCH_MARK=m
-CONFIG_IP_NF_MATCH_MULTIPORT=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
-CONFIG_IP_NF_MATCH_DSCP=m
-CONFIG_IP_NF_MATCH_AH_ESP=m
-CONFIG_IP_NF_MATCH_LENGTH=m
-CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_TCPMSS=m
-CONFIG_IP_NF_MATCH_HELPER=m
-CONFIG_IP_NF_MATCH_STATE=m
-CONFIG_IP_NF_MATCH_CONNTRACK=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_PHYSDEV=m
-CONFIG_IP_NF_FILTER=m
-CONFIG_IP_NF_TARGET_REJECT=m
-CONFIG_IP_NF_NAT=m
-CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
-CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
-CONFIG_IP_NF_NAT_LOCAL=y
-CONFIG_IP_NF_NAT_SNMP_BASIC=m
-CONFIG_IP_NF_NAT_IRC=m
-CONFIG_IP_NF_NAT_FTP=m
-CONFIG_IP_NF_NAT_TFTP=m
-CONFIG_IP_NF_NAT_AMANDA=m
-CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
-CONFIG_IP_NF_TARGET_ECN=m
-CONFIG_IP_NF_TARGET_DSCP=m
-CONFIG_IP_NF_TARGET_MARK=m
-CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
-CONFIG_IP_NF_ARPTABLES=m
-CONFIG_IP_NF_ARPFILTER=m
-CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
-
-#
-# IPv6: Netfilter Configuration
-#
-# CONFIG_IP6_NF_QUEUE is not set
-CONFIG_IP6_NF_IPTABLES=m
-CONFIG_IP6_NF_MATCH_LIMIT=m
-CONFIG_IP6_NF_MATCH_MAC=m
-CONFIG_IP6_NF_MATCH_RT=m
-CONFIG_IP6_NF_MATCH_OPTS=m
-CONFIG_IP6_NF_MATCH_FRAG=m
-CONFIG_IP6_NF_MATCH_HL=m
-CONFIG_IP6_NF_MATCH_MULTIPORT=m
-CONFIG_IP6_NF_MATCH_OWNER=m
-CONFIG_IP6_NF_MATCH_MARK=m
-CONFIG_IP6_NF_MATCH_IPV6HEADER=m
-CONFIG_IP6_NF_MATCH_AHESP=m
-CONFIG_IP6_NF_MATCH_LENGTH=m
-CONFIG_IP6_NF_MATCH_EUI64=m
-CONFIG_IP6_NF_FILTER=m
-CONFIG_IP6_NF_TARGET_LOG=m
-CONFIG_IP6_NF_MANGLE=m
-CONFIG_IP6_NF_TARGET_MARK=m
-CONFIG_IP6_NF_RAW=m
-
-#
-# Bridge: Netfilter Configuration
-#
-CONFIG_BRIDGE_NF_EBTABLES=m
-CONFIG_BRIDGE_EBT_BROUTE=m
-CONFIG_BRIDGE_EBT_T_FILTER=m
-CONFIG_BRIDGE_EBT_T_NAT=m
-CONFIG_BRIDGE_EBT_802_3=m
-CONFIG_BRIDGE_EBT_AMONG=m
-CONFIG_BRIDGE_EBT_ARP=m
-CONFIG_BRIDGE_EBT_IP=m
-CONFIG_BRIDGE_EBT_LIMIT=m
-CONFIG_BRIDGE_EBT_MARK=m
-CONFIG_BRIDGE_EBT_PKTTYPE=m
-CONFIG_BRIDGE_EBT_STP=m
-CONFIG_BRIDGE_EBT_VLAN=m
-CONFIG_BRIDGE_EBT_ARPREPLY=m
-CONFIG_BRIDGE_EBT_DNAT=m
-CONFIG_BRIDGE_EBT_MARK_T=m
-CONFIG_BRIDGE_EBT_REDIRECT=m
-CONFIG_BRIDGE_EBT_SNAT=m
-CONFIG_BRIDGE_EBT_LOG=m
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-CONFIG_IP_SCTP=m
-# CONFIG_SCTP_DBG_MSG is not set
-# CONFIG_SCTP_DBG_OBJCNT is not set
-# CONFIG_SCTP_HMAC_NONE is not set
-# CONFIG_SCTP_HMAC_SHA1 is not set
-CONFIG_SCTP_HMAC_MD5=y
-# CONFIG_ATM is not set
-CONFIG_BRIDGE=m
-CONFIG_VLAN_8021Q=m
-# CONFIG_DECNET is not set
-CONFIG_LLC=m
-# CONFIG_LLC2 is not set
-CONFIG_IPX=m
-# CONFIG_IPX_INTERN is not set
-CONFIG_ATALK=m
-CONFIG_DEV_APPLETALK=y
-CONFIG_LTPC=m
-CONFIG_COPS=m
-CONFIG_COPS_DAYNA=y
-CONFIG_COPS_TANGENT=y
-CONFIG_IPDDP=m
-CONFIG_IPDDP_ENCAP=y
-CONFIG_IPDDP_DECAP=y
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-CONFIG_NET_DIVERT=y
-# CONFIG_ECONET is not set
-CONFIG_WAN_ROUTER=m
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
-
-#
-# QoS and/or fair queueing
-#
-CONFIG_NET_SCHED=y
-CONFIG_NET_SCH_CBQ=m
-CONFIG_NET_SCH_HTB=m
-CONFIG_NET_SCH_HFSC=m
-CONFIG_NET_SCH_CSZ=m
-CONFIG_NET_SCH_PRIO=m
-CONFIG_NET_SCH_RED=m
-CONFIG_NET_SCH_SFQ=m
-CONFIG_NET_SCH_TEQL=m
-CONFIG_NET_SCH_TBF=m
-CONFIG_NET_SCH_GRED=m
-CONFIG_NET_SCH_DSMARK=m
-CONFIG_NET_SCH_DELAY=m
-CONFIG_NET_SCH_INGRESS=m
-CONFIG_NET_QOS=y
-CONFIG_NET_ESTIMATOR=y
-CONFIG_NET_CLS=y
-CONFIG_NET_CLS_TCINDEX=m
-CONFIG_NET_CLS_ROUTE4=m
-CONFIG_NET_CLS_ROUTE=y
-CONFIG_NET_CLS_FW=m
-CONFIG_NET_CLS_U32=m
-CONFIG_NET_CLS_RSVP=m
-CONFIG_NET_CLS_RSVP6=m
-CONFIG_NET_CLS_POLICE=y
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-CONFIG_NETPOLL=y
-# CONFIG_NETPOLL_RX is not set
-# CONFIG_NETPOLL_TRAP is not set
-CONFIG_NET_POLL_CONTROLLER=y
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=m
-CONFIG_IRNET=m
-CONFIG_IRCOMM=m
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=m
-
-#
-# Dongle support
-#
-CONFIG_DONGLE=y
-CONFIG_ESI_DONGLE=m
-CONFIG_ACTISYS_DONGLE=m
-CONFIG_TEKRAM_DONGLE=m
-CONFIG_LITELINK_DONGLE=m
-CONFIG_MA600_DONGLE=m
-CONFIG_GIRBIL_DONGLE=m
-CONFIG_MCP2120_DONGLE=m
-CONFIG_OLD_BELKIN_DONGLE=m
-CONFIG_ACT200L_DONGLE=m
-
-#
-# Old SIR device drivers
-#
-CONFIG_IRPORT_SIR=m
-
-#
-# Old Serial dongle support
-#
-# CONFIG_DONGLE_OLD is not set
-
-#
-# FIR device drivers
-#
-CONFIG_USB_IRDA=m
-CONFIG_SIGMATEL_FIR=m
-CONFIG_NSC_FIR=m
-# CONFIG_WINBOND_FIR is not set
-# CONFIG_TOSHIBA_FIR is not set
-# CONFIG_SMC_IRCC_FIR is not set
-# CONFIG_ALI_FIR is not set
-# CONFIG_VLSI_FIR is not set
-# CONFIG_VIA_FIR is not set
-CONFIG_BT=m
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_CMTP=m
-
-#
-# Bluetooth device drivers
-#
-CONFIG_BT_HCIUSB=m
-CONFIG_BT_HCIUSB_SCO=y
-CONFIG_BT_HCIUART=m
-CONFIG_BT_HCIUART_H4=y
-CONFIG_BT_HCIUART_BCSP=y
-CONFIG_BT_HCIUART_BCSP_TXCRC=y
-CONFIG_BT_HCIBCM203X=m
-CONFIG_BT_HCIBFUSB=m
-CONFIG_BT_HCIDTL1=m
-CONFIG_BT_HCIBT3C=m
-CONFIG_BT_HCIBLUECARD=m
-CONFIG_BT_HCIBTUART=m
-CONFIG_BT_HCIVHCI=m
-CONFIG_TUX=m
-
-#
-# TUX options
-#
-CONFIG_TUX_EXTCGI=y
-# CONFIG_TUX_EXTENDED_LOG is not set
-# CONFIG_TUX_DEBUG is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-CONFIG_EQUALIZER=m
-CONFIG_TUN=m
-CONFIG_ETHERTAP=m
-CONFIG_NET_SB1000=m
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
-CONFIG_HAPPYMEAL=m
-CONFIG_SUNGEM=m
-CONFIG_NET_VENDOR_3COM=y
-CONFIG_EL1=m
-CONFIG_EL2=m
-CONFIG_ELPLUS=m
-CONFIG_EL16=m
-CONFIG_EL3=m
-CONFIG_3C515=m
-CONFIG_VORTEX=m
-CONFIG_TYPHOON=m
-CONFIG_LANCE=m
-CONFIG_NET_VENDOR_SMC=y
-CONFIG_WD80x3=m
-CONFIG_ULTRA=m
-CONFIG_SMC9194=m
-CONFIG_NET_VENDOR_RACAL=y
-# CONFIG_NI5010 is not set
-CONFIG_NI52=m
-CONFIG_NI65=m
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-CONFIG_DE2104X=m
-CONFIG_TULIP=m
-# CONFIG_TULIP_MWI is not set
-CONFIG_TULIP_MMIO=y
-# CONFIG_TULIP_NAPI is not set
-CONFIG_DE4X5=m
-CONFIG_WINBOND_840=m
-CONFIG_DM9102=m
-CONFIG_PCMCIA_XIRCOM=m
-# CONFIG_PCMCIA_XIRTULIP is not set
-# CONFIG_AT1700 is not set
-CONFIG_DEPCA=m
-CONFIG_HP100=m
-# CONFIG_NET_ISA is not set
-CONFIG_NE2000=m
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-CONFIG_AMD8111_ETH=m
-CONFIG_AMD8111E_NAPI=y
-CONFIG_ADAPTEC_STARFIRE=m
-CONFIG_ADAPTEC_STARFIRE_NAPI=y
-CONFIG_AC3200=m
-CONFIG_APRICOT=m
-CONFIG_B44=m
-CONFIG_FORCEDETH=m
-CONFIG_CS89x0=m
-CONFIG_DGRS=m
-CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
-CONFIG_E100=m
-CONFIG_E100_NAPI=y
-CONFIG_FEALNX=m
-CONFIG_NATSEMI=m
-CONFIG_NE2K_PCI=m
-CONFIG_8139CP=m
-CONFIG_8139TOO=m
-CONFIG_8139TOO_PIO=y
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-CONFIG_8139TOO_8129=y
-# CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_SIS900=m
-CONFIG_EPIC100=m
-CONFIG_SUNDANCE=m
-# CONFIG_SUNDANCE_MMIO is not set
-CONFIG_TLAN=m
-CONFIG_VIA_RHINE=m
-CONFIG_VIA_RHINE_MMIO=y
-CONFIG_VIA_VELOCITY=m
-CONFIG_NET_POCKET=y
-CONFIG_ATP=m
-CONFIG_DE600=m
-CONFIG_DE620=m
-
-#
-# Ethernet (1000 Mbit)
-#
-CONFIG_ACENIC=m
-# CONFIG_ACENIC_OMIT_TIGON_I is not set
-CONFIG_DL2K=m
-CONFIG_E1000=m
-CONFIG_E1000_NAPI=y
-CONFIG_NS83820=m
-CONFIG_HAMACHI=m
-CONFIG_YELLOWFIN=m
-CONFIG_R8169=m
-CONFIG_SK98LIN=m
-CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-CONFIG_IXGB_NAPI=y
-CONFIG_S2IO=m
-CONFIG_S2IO_NAPI=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-CONFIG_NET_RADIO=y
-
-#
-# Obsolete Wireless cards support (pre-802.11)
-#
-# CONFIG_STRIP is not set
-# CONFIG_ARLAN is not set
-CONFIG_WAVELAN=m
-CONFIG_PCMCIA_WAVELAN=m
-CONFIG_PCMCIA_NETWAVE=m
-
-#
-# Wireless 802.11 Frequency Hopping cards support
-#
-# CONFIG_PCMCIA_RAYCS is not set
-
-#
-# Wireless 802.11b ISA/PCI cards support
-#
-CONFIG_AIRO=m
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_PCI_HERMES=m
-CONFIG_ATMEL=m
-CONFIG_PCI_ATMEL=m
-
-#
-# Wireless 802.11b Pcmcia/Cardbus cards support
-#
-CONFIG_PCMCIA_HERMES=m
-CONFIG_AIRO_CS=m
-CONFIG_PCMCIA_ATMEL=m
-CONFIG_PCMCIA_WL3501=m
-
-#
-# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
-#
-CONFIG_PRISM54=m
-CONFIG_NET_WIRELESS=y
-
-#
-# PCMCIA network device support
-#
-CONFIG_NET_PCMCIA=y
-CONFIG_PCMCIA_3C589=m
-CONFIG_PCMCIA_3C574=m
-CONFIG_PCMCIA_FMVJ18X=m
-CONFIG_PCMCIA_PCNET=m
-CONFIG_PCMCIA_NMCLAN=m
-CONFIG_PCMCIA_SMC91C92=m
-CONFIG_PCMCIA_XIRC2PS=m
-CONFIG_PCMCIA_AXNET=m
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-CONFIG_FDDI=y
-# CONFIG_DEFXX is not set
-CONFIG_SKFP=m
-# CONFIG_HIPPI is not set
-CONFIG_PLIP=m
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-# CONFIG_PPP_BSDCOMP is not set
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-CONFIG_NET_FC=y
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=m
-
-#
-# ISDN subsystem
-#
-CONFIG_ISDN=m
-
-#
-# Old ISDN4Linux
-#
-CONFIG_ISDN_I4L=m
-CONFIG_ISDN_PPP=y
-CONFIG_ISDN_PPP_VJ=y
-CONFIG_ISDN_MPP=y
-CONFIG_IPPP_FILTER=y
-# CONFIG_ISDN_PPP_BSDCOMP is not set
-CONFIG_ISDN_AUDIO=y
-CONFIG_ISDN_TTY_FAX=y
-
-#
-# ISDN feature submodules
-#
-CONFIG_ISDN_DRV_LOOP=m
-
-#
-# ISDN4Linux hardware drivers
-#
-
-#
-# Passive cards
-#
-CONFIG_ISDN_DRV_HISAX=m
-
-#
-# D-channel protocol features
-#
-CONFIG_HISAX_EURO=y
-CONFIG_DE_AOC=y
-CONFIG_HISAX_NO_SENDCOMPLETE=y
-CONFIG_HISAX_NO_LLC=y
-CONFIG_HISAX_NO_KEYPAD=y
-CONFIG_HISAX_1TR6=y
-CONFIG_HISAX_NI1=y
-CONFIG_HISAX_MAX_CARDS=8
-
-#
-# HiSax supported cards
-#
-CONFIG_HISAX_16_0=y
-CONFIG_HISAX_16_3=y
-CONFIG_HISAX_TELESPCI=y
-CONFIG_HISAX_S0BOX=y
-CONFIG_HISAX_AVM_A1=y
-CONFIG_HISAX_FRITZPCI=y
-CONFIG_HISAX_AVM_A1_PCMCIA=y
-CONFIG_HISAX_ELSA=y
-CONFIG_HISAX_IX1MICROR2=y
-CONFIG_HISAX_DIEHLDIVA=y
-CONFIG_HISAX_ASUSCOM=y
-CONFIG_HISAX_TELEINT=y
-CONFIG_HISAX_HFCS=y
-CONFIG_HISAX_SEDLBAUER=y
-CONFIG_HISAX_SPORTSTER=y
-CONFIG_HISAX_MIC=y
-CONFIG_HISAX_NETJET=y
-CONFIG_HISAX_NETJET_U=y
-CONFIG_HISAX_NICCY=y
-CONFIG_HISAX_ISURF=y
-CONFIG_HISAX_HSTSAPHIR=y
-CONFIG_HISAX_BKM_A4T=y
-CONFIG_HISAX_SCT_QUADRO=y
-CONFIG_HISAX_GAZEL=y
-CONFIG_HISAX_HFC_PCI=y
-CONFIG_HISAX_W6692=y
-CONFIG_HISAX_HFC_SX=y
-CONFIG_HISAX_ENTERNOW_PCI=y
-# CONFIG_HISAX_DEBUG is not set
-
-#
-# HiSax PCMCIA card service modules
-#
-CONFIG_HISAX_SEDLBAUER_CS=m
-CONFIG_HISAX_ELSA_CS=m
-CONFIG_HISAX_AVM_A1_CS=m
-CONFIG_HISAX_TELES_CS=m
-
-#
-# HiSax sub driver modules
-#
-CONFIG_HISAX_ST5481=m
-CONFIG_HISAX_HFCUSB=m
-CONFIG_HISAX_FRITZ_PCIPNP=m
-CONFIG_HISAX_HDLC=y
-
-#
-# Active cards
-#
-CONFIG_ISDN_DRV_ICN=m
-CONFIG_ISDN_DRV_PCBIT=m
-CONFIG_ISDN_DRV_SC=m
-CONFIG_ISDN_DRV_ACT2000=m
-CONFIG_ISDN_DRV_TPAM=m
-CONFIG_HYSDN=m
-CONFIG_HYSDN_CAPI=y
-
-#
-# CAPI subsystem
-#
-CONFIG_ISDN_CAPI=m
-CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON=y
-CONFIG_ISDN_CAPI_MIDDLEWARE=y
-CONFIG_ISDN_CAPI_CAPI20=m
-CONFIG_ISDN_CAPI_CAPIFS_BOOL=y
-CONFIG_ISDN_CAPI_CAPIFS=m
-CONFIG_ISDN_CAPI_CAPIDRV=m
-
-#
-# CAPI hardware drivers
-#
-
-#
-# Active AVM cards
-#
-CONFIG_CAPI_AVM=y
-CONFIG_ISDN_DRV_AVMB1_B1ISA=m
-CONFIG_ISDN_DRV_AVMB1_B1PCI=m
-CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y
-CONFIG_ISDN_DRV_AVMB1_T1ISA=m
-CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
-CONFIG_ISDN_DRV_AVMB1_AVM_CS=m
-CONFIG_ISDN_DRV_AVMB1_T1PCI=m
-CONFIG_ISDN_DRV_AVMB1_C4=m
-
-#
-# Active Eicon DIVA Server cards
-#
-CONFIG_CAPI_EICON=y
-CONFIG_ISDN_DIVAS=m
-CONFIG_ISDN_DIVAS_BRIPCI=y
-CONFIG_ISDN_DIVAS_PRIPCI=y
-CONFIG_ISDN_DIVAS_DIVACAPI=m
-CONFIG_ISDN_DIVAS_USERIDI=m
-CONFIG_ISDN_DIVAS_MAINT=m
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-CONFIG_INPUT_JOYDEV=m
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=y
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-CONFIG_GAMEPORT=m
-CONFIG_SOUND_GAMEPORT=m
-CONFIG_GAMEPORT_NS558=m
-CONFIG_GAMEPORT_L4=m
-CONFIG_GAMEPORT_EMU10K1=m
-CONFIG_GAMEPORT_VORTEX=m
-CONFIG_GAMEPORT_FM801=m
-CONFIG_GAMEPORT_CS461x=m
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-# CONFIG_SERIO_PCIPS2 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-CONFIG_MOUSE_SERIAL=m
-CONFIG_MOUSE_INPORT=m
-CONFIG_MOUSE_ATIXL=y
-CONFIG_MOUSE_LOGIBM=m
-CONFIG_MOUSE_PC110PAD=m
-CONFIG_MOUSE_VSXXXAA=m
-CONFIG_INPUT_JOYSTICK=y
-CONFIG_JOYSTICK_ANALOG=m
-CONFIG_JOYSTICK_A3D=m
-CONFIG_JOYSTICK_ADI=m
-CONFIG_JOYSTICK_COBRA=m
-CONFIG_JOYSTICK_GF2K=m
-CONFIG_JOYSTICK_GRIP=m
-CONFIG_JOYSTICK_GRIP_MP=m
-CONFIG_JOYSTICK_GUILLEMOT=m
-CONFIG_JOYSTICK_INTERACT=m
-CONFIG_JOYSTICK_SIDEWINDER=m
-CONFIG_JOYSTICK_TMDC=m
-CONFIG_JOYSTICK_IFORCE=m
-CONFIG_JOYSTICK_IFORCE_USB=y
-CONFIG_JOYSTICK_IFORCE_232=y
-CONFIG_JOYSTICK_WARRIOR=m
-CONFIG_JOYSTICK_MAGELLAN=m
-CONFIG_JOYSTICK_SPACEORB=m
-CONFIG_JOYSTICK_SPACEBALL=m
-CONFIG_JOYSTICK_STINGER=m
-CONFIG_JOYSTICK_TWIDDLER=m
-CONFIG_JOYSTICK_DB9=m
-CONFIG_JOYSTICK_GAMECON=m
-CONFIG_JOYSTICK_TURBOGRAFX=m
-# CONFIG_INPUT_JOYDUMP is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_GUNZE=m
-CONFIG_INPUT_MISC=y
-CONFIG_INPUT_PCSPKR=m
-# CONFIG_INPUT_UINPUT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_SERIAL_NONSTANDARD=y
-# CONFIG_COMPUTONE is not set
-CONFIG_ROCKETPORT=m
-# CONFIG_CYCLADES is not set
-# CONFIG_DIGIEPCA is not set
-# CONFIG_DIGI is not set
-# CONFIG_ESPSERIAL is not set
-# CONFIG_MOXA_INTELLIO is not set
-# CONFIG_MOXA_SMARTIO is not set
-# CONFIG_ISI is not set
-CONFIG_SYNCLINK=m
-CONFIG_SYNCLINKMP=m
-CONFIG_N_HDLC=m
-# CONFIG_RISCOM8 is not set
-# CONFIG_SPECIALIX is not set
-# CONFIG_SX is not set
-# CONFIG_RIO is not set
-CONFIG_STALDRV=y
-# CONFIG_STALLION is not set
-# CONFIG_ISTALLION is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_CS=m
-# CONFIG_SERIAL_8250_ACPI is not set
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_EXTENDED=y
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_MULTIPORT=y
-CONFIG_SERIAL_8250_RSA=y
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-CONFIG_CRASH=m
-CONFIG_PRINTER=m
-CONFIG_LP_CONSOLE=y
-CONFIG_PPDEV=m
-CONFIG_TIPAR=m
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-CONFIG_IPMI_HANDLER=m
-# CONFIG_IPMI_PANIC_EVENT is not set
-CONFIG_IPMI_DEVICE_INTERFACE=m
-CONFIG_IPMI_SI=m
-CONFIG_IPMI_WATCHDOG=m
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-CONFIG_SOFT_WATCHDOG=m
-CONFIG_ACQUIRE_WDT=m
-CONFIG_ADVANTECH_WDT=m
-CONFIG_ALIM1535_WDT=m
-CONFIG_ALIM7101_WDT=m
-CONFIG_SC520_WDT=m
-CONFIG_EUROTECH_WDT=m
-CONFIG_IB700_WDT=m
-CONFIG_WAFER_WDT=m
-CONFIG_I8XX_TCO=m
-CONFIG_SC1200_WDT=m
-# CONFIG_SCx200_WDT is not set
-# CONFIG_60XX_WDT is not set
-CONFIG_CPU5_WDT=m
-CONFIG_W83627HF_WDT=m
-CONFIG_W83877F_WDT=m
-CONFIG_MACHZ_WDT=m
-
-#
-# ISA-based Watchdog Cards
-#
-CONFIG_PCWATCHDOG=m
-# CONFIG_MIXCOMWD is not set
-CONFIG_WDT=m
-# CONFIG_WDT_501 is not set
-
-#
-# PCI-based Watchdog Cards
-#
-CONFIG_PCIPCWATCHDOG=m
-CONFIG_WDTPCI=m
-CONFIG_WDT_501_PCI=y
-
-#
-# USB-based Watchdog Cards
-#
-CONFIG_USBPCWATCHDOG=m
-CONFIG_HW_RANDOM=m
-CONFIG_NVRAM=m
-CONFIG_RTC=y
-CONFIG_DTLK=m
-CONFIG_R3964=m
-# CONFIG_APPLICOM is not set
-CONFIG_SONYPI=m
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_FTAPE is not set
-CONFIG_AGP=y
-CONFIG_AGP_ALI=y
-CONFIG_AGP_ATI=y
-CONFIG_AGP_AMD=y
-CONFIG_AGP_AMD64=y
-CONFIG_AGP_INTEL=y
-CONFIG_AGP_INTEL_MCH=y
-CONFIG_AGP_NVIDIA=y
-CONFIG_AGP_SIS=y
-CONFIG_AGP_SWORKS=y
-CONFIG_AGP_VIA=y
-CONFIG_AGP_EFFICEON=y
-CONFIG_DRM=y
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_GAMMA=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_I810=m
-CONFIG_DRM_I830=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-
-#
-# PCMCIA character devices
-#
-CONFIG_SYNCLINK_CS=m
-CONFIG_MWAVE=m
-# CONFIG_RAW_DRIVER is not set
-# CONFIG_HPET is not set
-CONFIG_HANGCHECK_TIMER=m
-
-#
-# I2C support
-#
-CONFIG_I2C=m
-CONFIG_I2C_CHARDEV=m
-
-#
-# I2C Algorithms
-#
-CONFIG_I2C_ALGOBIT=m
-CONFIG_I2C_ALGOPCF=m
-
-#
-# I2C Hardware Bus support
-#
-CONFIG_I2C_ALI1535=m
-CONFIG_I2C_ALI1563=m
-CONFIG_I2C_ALI15X3=m
-CONFIG_I2C_AMD756=m
-CONFIG_I2C_AMD8111=m
-# CONFIG_I2C_ELEKTOR is not set
-CONFIG_I2C_I801=m
-CONFIG_I2C_I810=m
-CONFIG_I2C_ISA=m
-CONFIG_I2C_NFORCE2=m
-# CONFIG_I2C_PARPORT is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
-CONFIG_I2C_PIIX4=m
-CONFIG_I2C_PROSAVAGE=m
-CONFIG_I2C_SAVAGE4=m
-# CONFIG_SCx200_ACB is not set
-CONFIG_I2C_SIS5595=m
-CONFIG_I2C_SIS630=m
-CONFIG_I2C_SIS96X=m
-CONFIG_I2C_VIA=m
-CONFIG_I2C_VIAPRO=m
-CONFIG_I2C_VOODOO3=m
-
-#
-# Hardware Sensors Chip support
-#
-CONFIG_I2C_SENSOR=m
-CONFIG_SENSORS_ADM1021=m
-CONFIG_SENSORS_ASB100=m
-CONFIG_SENSORS_DS1621=m
-CONFIG_SENSORS_FSCHER=m
-CONFIG_SENSORS_GL518SM=m
-CONFIG_SENSORS_IT87=m
-CONFIG_SENSORS_LM75=m
-CONFIG_SENSORS_LM78=m
-CONFIG_SENSORS_LM80=m
-CONFIG_SENSORS_LM83=m
-CONFIG_SENSORS_LM85=m
-CONFIG_SENSORS_LM90=m
-CONFIG_SENSORS_MAX1619=m
-CONFIG_SENSORS_VIA686A=m
-CONFIG_SENSORS_W83781D=m
-CONFIG_SENSORS_W83L785TS=m
-CONFIG_SENSORS_W83627HF=m
-
-#
-# Other I2C Chip support
-#
-CONFIG_SENSORS_EEPROM=m
-CONFIG_SENSORS_PCF8574=m
-CONFIG_SENSORS_PCF8591=m
-CONFIG_SENSORS_RTC8564=m
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-CONFIG_IBM_ASM=m
-
-#
-# Multimedia devices
-#
-CONFIG_VIDEO_DEV=m
-
-#
-# Video For Linux
-#
-
-#
-# Video Adapters
-#
-CONFIG_VIDEO_BT848=m
-CONFIG_VIDEO_PMS=m
-CONFIG_VIDEO_BWQCAM=m
-CONFIG_VIDEO_CQCAM=m
-CONFIG_VIDEO_W9966=m
-CONFIG_VIDEO_CPIA=m
-CONFIG_VIDEO_CPIA_PP=m
-CONFIG_VIDEO_CPIA_USB=m
-CONFIG_VIDEO_SAA5246A=m
-CONFIG_VIDEO_SAA5249=m
-CONFIG_TUNER_3036=m
-CONFIG_VIDEO_STRADIS=m
-CONFIG_VIDEO_ZORAN=m
-CONFIG_VIDEO_ZORAN_BUZ=m
-CONFIG_VIDEO_ZORAN_DC10=m
-CONFIG_VIDEO_ZORAN_DC30=m
-CONFIG_VIDEO_ZORAN_LML33=m
-CONFIG_VIDEO_ZORAN_LML33R10=m
-CONFIG_VIDEO_MEYE=m
-CONFIG_VIDEO_SAA7134=m
-CONFIG_VIDEO_MXB=m
-CONFIG_VIDEO_DPC=m
-CONFIG_VIDEO_HEXIUM_ORION=m
-CONFIG_VIDEO_HEXIUM_GEMINI=m
-CONFIG_VIDEO_CX88=m
-
-#
-# Radio Adapters
-#
-CONFIG_RADIO_CADET=m
-CONFIG_RADIO_RTRACK=m
-CONFIG_RADIO_RTRACK2=m
-CONFIG_RADIO_AZTECH=m
-CONFIG_RADIO_GEMTEK=m
-CONFIG_RADIO_GEMTEK_PCI=m
-CONFIG_RADIO_MAXIRADIO=m
-CONFIG_RADIO_MAESTRO=m
-CONFIG_RADIO_SF16FMI=m
-CONFIG_RADIO_SF16FMR2=m
-CONFIG_RADIO_TERRATEC=m
-CONFIG_RADIO_TRUST=m
-CONFIG_RADIO_TYPHOON=m
-CONFIG_RADIO_TYPHOON_PROC_FS=y
-CONFIG_RADIO_ZOLTRIX=m
-
-#
-# Digital Video Broadcasting Devices
-#
-CONFIG_DVB=y
-CONFIG_DVB_CORE=m
-
-#
-# Supported Frontend Modules
-#
-CONFIG_DVB_TWINHAN_DST=m
-CONFIG_DVB_STV0299=m
-# CONFIG_DVB_SP887X is not set
-# CONFIG_DVB_ALPS_TDLB7 is not set
-CONFIG_DVB_ALPS_TDMB7=m
-CONFIG_DVB_ATMEL_AT76C651=m
-CONFIG_DVB_CX24110=m
-CONFIG_DVB_GRUNDIG_29504_491=m
-CONFIG_DVB_GRUNDIG_29504_401=m
-CONFIG_DVB_MT312=m
-CONFIG_DVB_VES1820=m
-CONFIG_DVB_VES1X93=m
-# CONFIG_DVB_TDA1004X is not set
-CONFIG_DVB_NXT6000=m
-
-#
-# Supported SAA7146 based PCI Adapters
-#
-CONFIG_DVB_AV7110=m
-CONFIG_DVB_AV7110_OSD=y
-CONFIG_DVB_BUDGET=m
-CONFIG_DVB_BUDGET_CI=m
-CONFIG_DVB_BUDGET_AV=m
-CONFIG_DVB_BUDGET_PATCH=m
-
-#
-# Supported USB Adapters
-#
-CONFIG_DVB_TTUSB_BUDGET=m
-CONFIG_DVB_TTUSB_DEC=m
-
-#
-# Supported FlexCopII (B2C2) Adapters
-#
-CONFIG_DVB_B2C2_SKYSTAR=m
-
-#
-# Supported BT878 Adapters
-#
-CONFIG_DVB_BT8XX=m
-CONFIG_VIDEO_SAA7146=m
-CONFIG_VIDEO_SAA7146_VV=m
-CONFIG_VIDEO_VIDEOBUF=m
-CONFIG_VIDEO_TUNER=m
-CONFIG_VIDEO_BUF=m
-CONFIG_VIDEO_BTCX=m
-CONFIG_VIDEO_IR=m
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-CONFIG_FB_VGA16=m
-CONFIG_FB_VESA=y
-CONFIG_VIDEO_SELECT=y
-CONFIG_FB_HGA=m
-CONFIG_FB_HGA_ACCEL=y
-CONFIG_FB_RIVA=m
-# CONFIG_FB_RIVA_I2C is not set
-CONFIG_FB_I810=m
-CONFIG_FB_I810_GTF=y
-CONFIG_FB_MATROX=m
-CONFIG_FB_MATROX_MILLENIUM=y
-CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
-CONFIG_FB_MATROX_I2C=m
-CONFIG_FB_MATROX_MAVEN=m
-CONFIG_FB_MATROX_MULTIHEAD=y
-# CONFIG_FB_RADEON_OLD is not set
-CONFIG_FB_RADEON=m
-CONFIG_FB_RADEON_I2C=y
-# CONFIG_FB_RADEON_DEBUG is not set
-CONFIG_FB_ATY128=m
-CONFIG_FB_ATY=m
-CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
-# CONFIG_FB_ATY_XL_INIT is not set
-# CONFIG_FB_SIS is not set
-CONFIG_FB_NEOMAGIC=m
-CONFIG_FB_KYRO=m
-CONFIG_FB_3DFX=m
-CONFIG_FB_3DFX_ACCEL=y
-CONFIG_FB_VOODOO1=m
-CONFIG_FB_TRIDENT=m
-CONFIG_FB_TRIDENT_ACCEL=y
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-CONFIG_VGA_CONSOLE=y
-CONFIG_MDA_CONSOLE=m
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-CONFIG_LOGO_LINUX_CLUT224=y
-
-#
-# Sound
-#
-CONFIG_SOUND=m
-
-#
-# Advanced Linux Sound Architecture
-#
-CONFIG_SND=m
-CONFIG_SND_TIMER=m
-CONFIG_SND_PCM=m
-CONFIG_SND_HWDEP=m
-CONFIG_SND_RAWMIDI=m
-CONFIG_SND_SEQUENCER=m
-CONFIG_SND_SEQ_DUMMY=m
-CONFIG_SND_OSSEMUL=y
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-CONFIG_SND_SEQUENCER_OSS=y
-CONFIG_SND_RTCTIMER=m
-# CONFIG_SND_VERBOSE_PRINTK is not set
-# CONFIG_SND_DEBUG is not set
-
-#
-# Generic devices
-#
-CONFIG_SND_MPU401_UART=m
-CONFIG_SND_OPL3_LIB=m
-CONFIG_SND_OPL4_LIB=m
-CONFIG_SND_VX_LIB=m
-CONFIG_SND_DUMMY=m
-CONFIG_SND_VIRMIDI=m
-CONFIG_SND_MTPAV=m
-# CONFIG_SND_SERIAL_U16550 is not set
-CONFIG_SND_MPU401=m
-
-#
-# ISA devices
-#
-CONFIG_SND_AD1816A=m
-CONFIG_SND_AD1848=m
-CONFIG_SND_CS4231=m
-CONFIG_SND_CS4232=m
-CONFIG_SND_CS4236=m
-CONFIG_SND_ES968=m
-CONFIG_SND_ES1688=m
-CONFIG_SND_ES18XX=m
-CONFIG_SND_GUSCLASSIC=m
-CONFIG_SND_GUSEXTREME=m
-CONFIG_SND_GUSMAX=m
-CONFIG_SND_INTERWAVE=m
-CONFIG_SND_INTERWAVE_STB=m
-CONFIG_SND_OPTI92X_AD1848=m
-CONFIG_SND_OPTI92X_CS4231=m
-CONFIG_SND_OPTI93X=m
-CONFIG_SND_SB8=m
-CONFIG_SND_SB16=m
-CONFIG_SND_SBAWE=m
-CONFIG_SND_SB16_CSP=y
-# CONFIG_SND_WAVEFRONT is not set
-CONFIG_SND_ALS100=m
-CONFIG_SND_AZT2320=m
-CONFIG_SND_CMI8330=m
-CONFIG_SND_DT019X=m
-CONFIG_SND_OPL3SA2=m
-CONFIG_SND_SGALAXY=m
-CONFIG_SND_SSCAPE=m
-
-#
-# PCI devices
-#
-CONFIG_SND_AC97_CODEC=m
-CONFIG_SND_ALI5451=m
-CONFIG_SND_ATIIXP=m
-CONFIG_SND_AU8810=m
-CONFIG_SND_AU8820=m
-CONFIG_SND_AU8830=m
-CONFIG_SND_AZT3328=m
-CONFIG_SND_BT87X=m
-CONFIG_SND_CS46XX=m
-CONFIG_SND_CS46XX_NEW_DSP=y
-CONFIG_SND_CS4281=m
-CONFIG_SND_EMU10K1=m
-CONFIG_SND_KORG1212=m
-CONFIG_SND_MIXART=m
-CONFIG_SND_NM256=m
-CONFIG_SND_RME32=m
-CONFIG_SND_RME96=m
-CONFIG_SND_RME9652=m
-CONFIG_SND_HDSP=m
-CONFIG_SND_TRIDENT=m
-CONFIG_SND_YMFPCI=m
-CONFIG_SND_ALS4000=m
-CONFIG_SND_CMIPCI=m
-CONFIG_SND_ENS1370=m
-CONFIG_SND_ENS1371=m
-CONFIG_SND_ES1938=m
-CONFIG_SND_ES1968=m
-CONFIG_SND_MAESTRO3=m
-CONFIG_SND_FM801=m
-CONFIG_SND_FM801_TEA575X=m
-CONFIG_SND_ICE1712=m
-CONFIG_SND_ICE1724=m
-CONFIG_SND_INTEL8X0=m
-CONFIG_SND_INTEL8X0M=m
-CONFIG_SND_SONICVIBES=m
-CONFIG_SND_VIA82XX=m
-CONFIG_SND_VX222=m
-
-#
-# ALSA USB devices
-#
-CONFIG_SND_USB_AUDIO=m
-
-#
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
-CONFIG_SND_PDAUDIOCF=m
-
-#
-# Open Sound System
-#
-# CONFIG_SOUND_PRIME is not set
-
-#
-# USB support
-#
-CONFIG_USB=y
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_BANDWIDTH is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-
-#
-# USB Host Controller Drivers
-#
-CONFIG_USB_EHCI_HCD=m
-CONFIG_USB_EHCI_SPLIT_ISO=y
-CONFIG_USB_EHCI_ROOT_HUB_TT=y
-CONFIG_USB_OHCI_HCD=m
-CONFIG_USB_UHCI_HCD=m
-
-#
-# USB Device Class drivers
-#
-CONFIG_USB_AUDIO=m
-
-#
-# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
-#
-CONFIG_USB_MIDI=m
-CONFIG_USB_ACM=m
-CONFIG_USB_PRINTER=m
-CONFIG_USB_STORAGE=m
-# CONFIG_USB_STORAGE_DEBUG is not set
-CONFIG_USB_STORAGE_RW_DETECT=y
-CONFIG_USB_STORAGE_DATAFAB=y
-CONFIG_USB_STORAGE_FREECOM=y
-CONFIG_USB_STORAGE_ISD200=y
-CONFIG_USB_STORAGE_DPCM=y
-CONFIG_USB_STORAGE_HP8200e=y
-CONFIG_USB_STORAGE_SDDR09=y
-CONFIG_USB_STORAGE_SDDR55=y
-CONFIG_USB_STORAGE_JUMPSHOT=y
-
-#
-# USB Human Interface Devices (HID)
-#
-CONFIG_USB_HID=y
-CONFIG_USB_HIDINPUT=y
-CONFIG_HID_FF=y
-CONFIG_HID_PID=y
-CONFIG_LOGITECH_FF=y
-CONFIG_THRUSTMASTER_FF=y
-CONFIG_USB_HIDDEV=y
-CONFIG_USB_AIPTEK=m
-CONFIG_USB_WACOM=m
-CONFIG_USB_KBTAB=m
-CONFIG_USB_POWERMATE=m
-CONFIG_USB_MTOUCH=m
-CONFIG_USB_EGALAX=m
-CONFIG_USB_XPAD=m
-CONFIG_USB_ATI_REMOTE=m
-
-#
-# USB Imaging devices
-#
-CONFIG_USB_MDC800=m
-CONFIG_USB_MICROTEK=m
-CONFIG_USB_HPUSBSCSI=m
-
-#
-# USB Multimedia devices
-#
-CONFIG_USB_DABUSB=m
-CONFIG_USB_VICAM=m
-CONFIG_USB_DSBR=m
-CONFIG_USB_IBMCAM=m
-CONFIG_USB_KONICAWC=m
-CONFIG_USB_OV511=m
-CONFIG_USB_SE401=m
-CONFIG_USB_STV680=m
-CONFIG_USB_W9968CF=m
-
-#
-# USB Network adaptors
-#
-CONFIG_USB_CATC=m
-CONFIG_USB_KAWETH=m
-CONFIG_USB_PEGASUS=m
-CONFIG_USB_RTL8150=m
-CONFIG_USB_USBNET=m
-
-#
-# USB Host-to-Host Cables
-#
-CONFIG_USB_ALI_M5632=y
-CONFIG_USB_AN2720=y
-CONFIG_USB_BELKIN=y
-CONFIG_USB_GENESYS=y
-CONFIG_USB_NET1080=y
-CONFIG_USB_PL2301=y
-
-#
-# Intelligent USB Devices/Gadgets
-#
-CONFIG_USB_ARMLINUX=y
-CONFIG_USB_EPSON2888=y
-CONFIG_USB_ZAURUS=y
-CONFIG_USB_CDCETHER=y
-
-#
-# USB Network Adapters
-#
-CONFIG_USB_AX8817X=y
-
-#
-# USB port drivers
-#
-CONFIG_USB_USS720=m
-
-#
-# USB Serial Converter support
-#
-CONFIG_USB_SERIAL=m
-CONFIG_USB_SERIAL_GENERIC=y
-CONFIG_USB_SERIAL_BELKIN=m
-CONFIG_USB_SERIAL_WHITEHEAT=m
-CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
-CONFIG_USB_SERIAL_EMPEG=m
-CONFIG_USB_SERIAL_FTDI_SIO=m
-CONFIG_USB_SERIAL_VISOR=m
-CONFIG_USB_SERIAL_IPAQ=m
-CONFIG_USB_SERIAL_IR=m
-CONFIG_USB_SERIAL_EDGEPORT=m
-CONFIG_USB_SERIAL_EDGEPORT_TI=m
-CONFIG_USB_SERIAL_KEYSPAN_PDA=m
-CONFIG_USB_SERIAL_KEYSPAN=m
-CONFIG_USB_SERIAL_KEYSPAN_MPR=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
-CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19=y
-CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
-CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
-CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
-CONFIG_USB_SERIAL_KLSI=m
-CONFIG_USB_SERIAL_KOBIL_SCT=m
-CONFIG_USB_SERIAL_MCT_U232=m
-CONFIG_USB_SERIAL_PL2303=m
-CONFIG_USB_SERIAL_SAFE=m
-CONFIG_USB_SERIAL_SAFE_PADDED=y
-CONFIG_USB_SERIAL_CYBERJACK=m
-CONFIG_USB_SERIAL_XIRCOM=m
-CONFIG_USB_SERIAL_OMNINET=m
-CONFIG_USB_EZUSB=y
-
-#
-# USB Miscellaneous drivers
-#
-CONFIG_USB_EMI62=m
-# CONFIG_USB_EMI26 is not set
-CONFIG_USB_TIGL=m
-CONFIG_USB_AUERSWALD=m
-CONFIG_USB_RIO500=m
-CONFIG_USB_LEGOTOWER=m
-CONFIG_USB_LCD=m
-CONFIG_USB_LED=m
-# CONFIG_USB_CYTHERM is not set
-CONFIG_USB_PHIDGETSERVO=m
-CONFIG_USB_TEST=m
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-CONFIG_EXT2_FS_XATTR=y
-CONFIG_EXT2_FS_POSIX_ACL=y
-CONFIG_EXT2_FS_SECURITY=y
-CONFIG_EXT3_FS=m
-CONFIG_EXT3_FS_XATTR=y
-CONFIG_EXT3_FS_POSIX_ACL=y
-CONFIG_EXT3_FS_SECURITY=y
-CONFIG_JBD=m
-# CONFIG_JBD_DEBUG is not set
-CONFIG_FS_MBCACHE=y
-CONFIG_REISERFS_FS=m
-# CONFIG_REISERFS_CHECK is not set
-CONFIG_REISERFS_PROC_INFO=y
-CONFIG_REISERFS_FS_XATTR=y
-CONFIG_REISERFS_FS_POSIX_ACL=y
-CONFIG_REISERFS_FS_SECURITY=y
-CONFIG_JFS_FS=m
-CONFIG_JFS_POSIX_ACL=y
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
-CONFIG_XFS_FS=m
-# CONFIG_XFS_RT is not set
-CONFIG_XFS_QUOTA=y
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-CONFIG_MINIX_FS=m
-CONFIG_ROMFS_FS=m
-CONFIG_QUOTA=y
-# CONFIG_QFMT_V1 is not set
-CONFIG_QFMT_V2=y
-CONFIG_QUOTACTL=y
-CONFIG_AUTOFS_FS=m
-CONFIG_AUTOFS4_FS=m
-
-#
-# CD-ROM/DVD Filesystems
-#
-CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_ZISOFS_FS=y
-CONFIG_UDF_FS=m
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS_XATTR=y
-CONFIG_DEVPTS_FS_SECURITY=y
-CONFIG_TMPFS=y
-CONFIG_HUGETLBFS=y
-CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-# CONFIG_BEFS_DEBUG is not set
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-# CONFIG_JFFS_FS is not set
-CONFIG_JFFS2_FS=m
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_NAND=y
-CONFIG_CRAMFS=m
-CONFIG_VXFS_FS=m
-# CONFIG_HPFS_FS is not set
-CONFIG_QNX4FS_FS=m
-# CONFIG_QNX4FS_RW is not set
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-# CONFIG_UFS_FS_WRITE is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=m
-CONFIG_NFS_V3=y
-CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
-CONFIG_NFSD=m
-CONFIG_NFSD_V3=y
-CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_LOCKD=m
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
-CONFIG_SUNRPC=m
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
-CONFIG_SMB_FS=m
-# CONFIG_SMB_NLS_DEFAULT is not set
-CONFIG_CIFS=m
-# CONFIG_CIFS_STATS is not set
-CONFIG_NCP_FS=m
-CONFIG_NCPFS_PACKET_SIGNING=y
-CONFIG_NCPFS_IOCTL_LOCKING=y
-CONFIG_NCPFS_STRONG=y
-CONFIG_NCPFS_NFS_NS=y
-CONFIG_NCPFS_OS2_NS=y
-CONFIG_NCPFS_SMALLDOS=y
-CONFIG_NCPFS_NLS=y
-CONFIG_NCPFS_EXTRAS=y
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-# CONFIG_ACORN_PARTITION is not set
-CONFIG_OSF_PARTITION=y
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-CONFIG_MAC_PARTITION=y
-CONFIG_MSDOS_PARTITION=y
-CONFIG_BSD_DISKLABEL=y
-CONFIG_MINIX_SUBPARTITION=y
-CONFIG_SOLARIS_X86_PARTITION=y
-CONFIG_UNIXWARE_DISKLABEL=y
-# CONFIG_LDM_PARTITION is not set
-CONFIG_SGI_PARTITION=y
-# CONFIG_ULTRIX_PARTITION is not set
-CONFIG_SUN_PARTITION=y
-CONFIG_EFI_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="utf8"
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_CODEPAGE_737=m
-CONFIG_NLS_CODEPAGE_775=m
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-CONFIG_NLS_CODEPAGE_855=m
-CONFIG_NLS_CODEPAGE_857=m
-CONFIG_NLS_CODEPAGE_860=m
-CONFIG_NLS_CODEPAGE_861=m
-CONFIG_NLS_CODEPAGE_862=m
-CONFIG_NLS_CODEPAGE_863=m
-CONFIG_NLS_CODEPAGE_864=m
-CONFIG_NLS_CODEPAGE_865=m
-CONFIG_NLS_CODEPAGE_866=m
-CONFIG_NLS_CODEPAGE_869=m
-CONFIG_NLS_CODEPAGE_936=m
-CONFIG_NLS_CODEPAGE_950=m
-CONFIG_NLS_CODEPAGE_932=m
-CONFIG_NLS_CODEPAGE_949=m
-CONFIG_NLS_CODEPAGE_874=m
-CONFIG_NLS_ISO8859_8=m
-CONFIG_NLS_CODEPAGE_1250=m
-CONFIG_NLS_CODEPAGE_1251=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-CONFIG_NLS_ISO8859_5=m
-CONFIG_NLS_ISO8859_6=m
-CONFIG_NLS_ISO8859_7=m
-CONFIG_NLS_ISO8859_9=m
-CONFIG_NLS_ISO8859_13=m
-CONFIG_NLS_ISO8859_14=m
-CONFIG_NLS_ISO8859_15=m
-CONFIG_NLS_KOI8_R=m
-CONFIG_NLS_KOI8_U=m
-CONFIG_NLS_UTF8=m
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_DEBUG_STACKOVERFLOW=y
-# CONFIG_DEBUG_STACK_USAGE is not set
-# CONFIG_DEBUG_SLAB is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_PAGEALLOC is not set
-# CONFIG_DEBUG_HIGHMEM is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_SPINLOCK_SLEEP=y
-# CONFIG_FRAME_POINTER is not set
-
-#
-# Security options
-#
-CONFIG_SECURITY=y
-CONFIG_SECURITY_NETWORK=y
-CONFIG_SECURITY_CAPABILITIES=y
-# CONFIG_SECURITY_ROOTPLUG is not set
-CONFIG_SECURITY_SELINUX=y
-CONFIG_SECURITY_SELINUX_BOOTPARAM=y
-CONFIG_SECURITY_SELINUX_DISABLE=y
-CONFIG_SECURITY_SELINUX_DEVELOP=y
-# CONFIG_SECURITY_SELINUX_MLS is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_CAST5=m
-CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_ARC4=m
-CONFIG_CRYPTO_DEFLATE=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_CRC32C=m
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Library routines
-#
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=m
-CONFIG_X86_BIOS_REBOOT=y
-CONFIG_PC=y
index 991d41d..2e2c339 100644 (file)
@@ -120,7 +120,7 @@ config CRYPTO_SERPENT
 
 config CRYPTO_AES
        tristate "AES cipher algorithms"
-       depends on CRYPTO
+       depends on CRYPTO && !(X86 && !X86_64)
        help
          AES cipher algorithms (FIPS-197). AES uses the Rijndael 
          algorithm.
@@ -138,6 +138,26 @@ config CRYPTO_AES
 
          See http://csrc.nist.gov/CryptoToolkit/aes/ for more information.
 
+config CRYPTO_AES_586
+       tristate "AES cipher algorithms (i586)"
+       depends on CRYPTO && (X86 && !X86_64)
+       help
+         AES cipher algorithms (FIPS-197). AES uses the Rijndael 
+         algorithm.
+
+         Rijndael appears to be consistently a very good performer in
+         both hardware and software across a wide range of computing 
+         environments regardless of its use in feedback or non-feedback 
+         modes. Its key setup time is excellent, and its key agility is 
+         good. Rijndael's very low memory requirements make it very well 
+         suited for restricted-space environments, in which it also 
+         demonstrates excellent performance. Rijndael's operations are 
+         among the easiest to defend against power and timing attacks. 
+
+         The AES specifies three key sizes: 128, 192 and 256 bits        
+
+         See http://csrc.nist.gov/encryption/aes/ for more information.
+
 config CRYPTO_CAST5
        tristate "CAST5 (CAST-128) cipher algorithm"
        depends on CRYPTO
@@ -177,6 +197,19 @@ config CRYPTO_ARC4
          WEP, but it should not be for other purposes because of the
          weakness of the algorithm.
 
+config CRYPTO_KHAZAD
+       tristate "Khazad cipher algorithm"
+       depends on CRYPTO
+       help
+         Khazad cipher algorithm.
+
+         Khazad was a finalist in the initial NESSIE competition.  It is
+         an algorithm optimized for 64-bit processors with good performance
+         on 32-bit processors.  Khazad uses an 128 bit key size.
+
+         See also:
+         http://planeta.terra.com.br/informatica/paulobarreto/KhazadPage.html
+
 config CRYPTO_DEFLATE
        tristate "Deflate compression algorithm"
        depends on CRYPTO
index e65b7c3..bf7ca60 100644 (file)
@@ -23,6 +23,7 @@ obj-$(CONFIG_CRYPTO_CAST5) += cast5.o
 obj-$(CONFIG_CRYPTO_CAST6) += cast6.o
 obj-$(CONFIG_CRYPTO_ARC4) += arc4.o
 obj-$(CONFIG_CRYPTO_TEA) += tea.o
+obj-$(CONFIG_CRYPTO_KHAZAD) += khazad.o
 obj-$(CONFIG_CRYPTO_DEFLATE) += deflate.o
 obj-$(CONFIG_CRYPTO_MICHAEL_MIC) += michael_mic.o
 obj-$(CONFIG_CRYPTO_CRC32C) += crc32c.o
index cdcf347..6ab56eb 100644 (file)
@@ -52,8 +52,8 @@ static int crypt(struct crypto_tfm *tfm,
 {
        struct scatter_walk walk_in, walk_out;
        const unsigned int bsize = crypto_tfm_alg_blocksize(tfm);
-       u8 tmp_src[nbytes > src->length ? bsize : 0];
-       u8 tmp_dst[nbytes > dst->length ? bsize : 0];
+       u8 tmp_src[bsize];
+       u8 tmp_dst[bsize];
 
        if (!nbytes)
                return 0;
index 2124e23..f1e631b 100644 (file)
@@ -674,6 +674,10 @@ do_test(void)
                test_cipher ("xtea", MODE_ECB, ENCRYPT, xtea_enc_tv_template, XTEA_ENC_TEST_VECTORS);
                test_cipher ("xtea", MODE_ECB, DECRYPT, xtea_dec_tv_template, XTEA_DEC_TEST_VECTORS);
 
+               //KHAZAD
+               test_cipher ("khazad", MODE_ECB, ENCRYPT, khazad_enc_tv_template, KHAZAD_ENC_TEST_VECTORS);
+               test_cipher ("khazad", MODE_ECB, DECRYPT, khazad_dec_tv_template, KHAZAD_DEC_TEST_VECTORS);
+
                test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS);
                test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS);
                test_deflate();
@@ -782,6 +786,11 @@ do_test(void)
                test_cipher ("xtea", MODE_ECB, DECRYPT, xtea_dec_tv_template, XTEA_DEC_TEST_VECTORS);
                break;
 
+       case 21:
+               test_cipher ("khazad", MODE_ECB, ENCRYPT, khazad_enc_tv_template, KHAZAD_ENC_TEST_VECTORS);
+               test_cipher ("khazad", MODE_ECB, DECRYPT, khazad_dec_tv_template, KHAZAD_DEC_TEST_VECTORS);
+               break;
+
 #ifdef CONFIG_CRYPTO_HMAC
        case 100:
                test_hmac("md5", hmac_md5_tv_template, HMAC_MD5_TEST_VECTORS);
index 4f51429..56a825d 100644 (file)
@@ -1818,7 +1818,103 @@ struct cipher_testvec xtea_dec_tv_template[] =
        }
 };
 
+/*
+ * KHAZAD test vectors.
+ */
+#define KHAZAD_ENC_TEST_VECTORS 5
+#define KHAZAD_DEC_TEST_VECTORS 5
 
+struct cipher_testvec khazad_enc_tv_template[] = { 
+       { 
+               .key    = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+               .klen   = 16,
+               .input  = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+               .ilen   = 8,
+               .result = { 0x49, 0xa4, 0xce, 0x32, 0xac, 0x19, 0x0e, 0x3f },
+               .rlen   = 8,
+       }, {
+               .key    = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+                           0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
+               .klen   = 16,
+               .input  = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
+               .ilen   = 8,
+               .result = { 0x7e, 0x82, 0x12, 0xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
+               .rlen   = 8,
+       }, {
+               .key    = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
+                           0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
+               .klen   = 16,
+               .input  = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
+               .ilen   = 8,
+               .result = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
+               .rlen   = 8,
+       }, {
+               .key    = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .klen   = 16,
+               .input  = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .ilen   = 8,
+               .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
+               .rlen   = 8,
+       }, {
+               .key    = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .klen   = 16,
+               .input  = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .ilen   = 16,
+               .result = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
+                           0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
+               .rlen   = 16,
+       },
+};
+
+struct cipher_testvec khazad_dec_tv_template[] = { 
+       {
+               .key    = { 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+                           0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+               .klen   = 16,
+               .input  = { 0X49, 0Xa4, 0Xce, 0X32, 0Xac, 0X19, 0X0e, 0X3f },
+               .ilen   = 8,
+               .result = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+               .rlen   = 8,
+       }, {
+               .key    = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
+                           0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
+               .klen   = 16,
+               .input  = { 0X7e, 0X82, 0X12, 0Xa1, 0Xd9, 0X5b, 0Xe4, 0Xf9 },
+               .ilen   = 8,
+               .result = { 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38 },
+               .rlen   = 8,
+       }, {
+               .key    = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2,
+                           0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
+               .klen   = 16,
+               .input  = { 0Xaa, 0Xbe, 0Xc1, 0X95, 0Xc5, 0X94, 0X1a, 0X9c },
+               .ilen   = 8,
+               .result = { 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2, 0Xa2 },
+               .rlen   = 8,
+       }, {
+               .key    = { 0x2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .klen   = 16,
+               .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
+               .ilen   = 8,
+               .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .rlen   = 8,
+       }, {
+               .key    = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .klen   = 16,
+               .input = { 0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 ,
+                           0X04, 0X74, 0Xf5, 0X70, 0X50, 0X16, 0Xd3, 0Xb8 },
+               .ilen   = 16,
+               .result = { 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f ,
+                           0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f, 0X2f },
+               .rlen   = 16,
+       },
+};
 
 /*
  * Compression stuff.
index f686992..9919e76 100644 (file)
@@ -92,8 +92,7 @@ acpi_system_read_dsdt (
 {
        acpi_status             status = AE_OK;
        struct acpi_buffer      dsdt = {ACPI_ALLOCATE_BUFFER, NULL};
-       void                    *data = NULL;
-       size_t                  size = 0;
+       ssize_t                 res;
 
        ACPI_FUNCTION_TRACE("acpi_system_read_dsdt");
 
@@ -101,22 +100,11 @@ acpi_system_read_dsdt (
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       if (*ppos < dsdt.length) {
-               data = dsdt.pointer + file->f_pos;
-               size = dsdt.length - file->f_pos;
-               if (size > count)
-                       size = count;
-               if (copy_to_user(buffer, data, size)) {
-                       acpi_os_free(dsdt.pointer);
-                       return_VALUE(-EFAULT);
-               }
-       }
-
+       res = simple_read_from_buffer(buffer, count, ppos,
+                                     dsdt.pointer, dsdt.length);
        acpi_os_free(dsdt.pointer);
 
-       *ppos += size;
-
-       return_VALUE(size);
+       return_VALUE(res);
 }
 
 
@@ -135,8 +123,7 @@ acpi_system_read_fadt (
 {
        acpi_status             status = AE_OK;
        struct acpi_buffer      fadt = {ACPI_ALLOCATE_BUFFER, NULL};
-       void                    *data = NULL;
-       size_t                  size = 0;
+       ssize_t                 res;
 
        ACPI_FUNCTION_TRACE("acpi_system_read_fadt");
 
@@ -144,22 +131,11 @@ acpi_system_read_fadt (
        if (ACPI_FAILURE(status))
                return_VALUE(-ENODEV);
 
-       if (*ppos < fadt.length) {
-               data = fadt.pointer + file->f_pos;
-               size = fadt.length - file->f_pos;
-               if (size > count)
-                       size = count;
-               if (copy_to_user(buffer, data, size)) {
-                       acpi_os_free(fadt.pointer);
-                       return_VALUE(-EFAULT);
-               }
-       }
-
+       res = simple_read_from_buffer(buffer, count, ppos,
+                                     fadt.pointer, fadt.length);
        acpi_os_free(fadt.pointer);
 
-       *ppos += size;
-
-       return_VALUE(size);
+       return_VALUE(res);
 }
 
 
index 08fe300..91b85a9 100644 (file)
@@ -1380,7 +1380,7 @@ static void __devinit *aligned_kmalloc (int size, int flags, int alignment)
 
        if (alignment <= 0x10) {
                t = kmalloc (size, flags);
-               if ((unsigned int)t & (alignment-1)) {
+               if ((unsigned long)t & (alignment-1)) {
                        printk ("Kmalloc doesn't align things correctly! %p\n", t);
                        kfree (t);
                        return aligned_kmalloc (size, flags, alignment * 4);
index e33b535..b2f1375 100644 (file)
 #endif
 
 
-extern const struct atmdev_ops   fore200e_ops;
-extern const struct fore200e_bus fore200e_bus[];
+static const struct atmdev_ops   fore200e_ops;
+static const struct fore200e_bus fore200e_bus[];
 
 static struct fore200e* fore200e_boards = NULL;
 
index c3ae0c5..0a160b2 100644 (file)
@@ -1,5 +1,14 @@
 menu "Generic Driver Options"
 
+config STANDALONE
+       bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
+       default y
+       help
+         Select this option if you don't have magic firmware for drivers that
+         need it.
+
+         If unsure, say Y.
+
 config PREVENT_FIRMWARE_BUILD
        bool "Prevent firmware from being built"
        default y
index afb9d43..c44f27f 100644 (file)
@@ -33,6 +33,13 @@ config BLK_DEV_SWIM_IOP
          Say Y here to support the SWIM (Super Woz Integrated Machine) IOP
          floppy controller on the Macintosh IIfx and Quadra 900/950.
 
+config MAC_FLOPPY
+       tristate "Support for PowerMac floppy"
+       depends on PPC_PMAC && !PPC_PMAC64
+       help
+         If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple)
+         floppy controller, say Y here. Most commonly found in PowerMacs.
+
 config BLK_DEV_PS2
        tristate "PS/2 ESDI hard disk support"
        depends on MCA && MCA_LEGACY
index 992956a..c9fd23a 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/init.h> 
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
+#include <linux/compat.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -555,12 +556,12 @@ static void unregister_cciss_ioctl32(void)
 int cciss_ioctl32_passthru(unsigned int fd, unsigned cmd, unsigned long arg,
        struct file *file)
 {
-       IOCTL32_Command_struct *arg32 =
-               (IOCTL32_Command_struct *) arg;
+       IOCTL32_Command_struct __user *arg32 =
+               (IOCTL32_Command_struct __user *) arg;
        IOCTL_Command_struct arg64;
-       mm_segment_t old_fs;
+       IOCTL_Command_struct __user *p = compat_alloc_user_space(sizeof(arg64));
        int err;
-       unsigned long cp;
+       u32 cp;
 
        err = 0;
        err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, sizeof(arg64.LUN_info));
@@ -568,31 +569,30 @@ int cciss_ioctl32_passthru(unsigned int fd, unsigned cmd, unsigned long arg,
        err |= copy_from_user(&arg64.error_info, &arg32->error_info, sizeof(arg64.error_info));
        err |= get_user(arg64.buf_size, &arg32->buf_size);
        err |= get_user(cp, &arg32->buf);
-       arg64.buf = (BYTE *)cp;
+       arg64.buf = compat_ptr(cp);
+       err |= copy_to_user(p, &arg64, sizeof(arg64));
 
        if (err)
                return -EFAULT;
 
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_ioctl(fd, CCISS_PASSTHRU, (unsigned long) &arg64);
-       set_fs(old_fs);
+       err = sys_ioctl(fd, CCISS_PASSTHRU, (unsigned long) p);
        if (err)
                return err;
-       err |= copy_to_user(&arg32->error_info, &arg64.error_info, sizeof(&arg32->error_info));
+       err |= copy_in_user(&arg32->error_info, &p->error_info, sizeof(&arg32->error_info));
        if (err)
                return -EFAULT;
        return err;
 }
+
 int cciss_ioctl32_big_passthru(unsigned int fd, unsigned cmd, unsigned long arg,
        struct file *file)
 {
-       BIG_IOCTL32_Command_struct *arg32 =
-               (BIG_IOCTL32_Command_struct *) arg;
+       BIG_IOCTL32_Command_struct __user *arg32 =
+               (BIG_IOCTL32_Command_struct __user *) arg;
        BIG_IOCTL_Command_struct arg64;
-       mm_segment_t old_fs;
+       BIG_IOCTL_Command_struct __user *p = compat_alloc_user_space(sizeof(arg64));
        int err;
-       unsigned long cp;
+       u32 cp;
 
        err = 0;
        err |= copy_from_user(&arg64.LUN_info, &arg32->LUN_info, sizeof(arg64.LUN_info));
@@ -601,18 +601,16 @@ int cciss_ioctl32_big_passthru(unsigned int fd, unsigned cmd, unsigned long arg,
        err |= get_user(arg64.buf_size, &arg32->buf_size);
        err |= get_user(arg64.malloc_size, &arg32->malloc_size);
        err |= get_user(cp, &arg32->buf);
-       arg64.buf = (BYTE *)cp;
+       arg64.buf = compat_ptr(cp);
+       err |= copy_to_user(p, &arg64, sizeof(arg64));
 
        if (err)
                 return -EFAULT;
 
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_ioctl(fd, CCISS_BIG_PASSTHRU, (unsigned long) &arg64);
-       set_fs(old_fs);
+       err = sys_ioctl(fd, CCISS_BIG_PASSTHRU, (unsigned long) p);
        if (err)
                return err;
-       err |= copy_to_user(&arg32->error_info, &arg64.error_info, sizeof(&arg32->error_info));
+       err |= copy_in_user(&arg32->error_info, &p->error_info, sizeof(&arg32->error_info));
        if (err)
                return -EFAULT;
        return err;
index 7e37bdb..5bf390d 100644 (file)
@@ -4190,7 +4190,7 @@ static int __init floppy_setup(char *str)
                printk("\n");
        } else
                DPRINT("botched floppy option\n");
-       DPRINT("Read linux/Documentation/floppy.txt\n");
+       DPRINT("Read Documentation/floppy.txt\n");
        return 0;
 }
 
index 9134d60..5a570ba 100644 (file)
@@ -632,6 +632,8 @@ int blk_queue_resize_tags(request_queue_t *q, int new_depth)
        return 0;
 }
 
+EXPORT_SYMBOL(blk_queue_resize_tags);
+
 /**
  * blk_queue_end_tag - end tag operations for a request
  * @q:  the request queue for the device
@@ -1465,9 +1467,6 @@ request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
                printk("Using %s io scheduler\n", chosen_elevator->elevator_name);
        }
 
-       if (elevator_init(q, chosen_elevator))
-               goto out_elv;
-
        q->request_fn           = rfn;
        q->back_merge_fn        = ll_back_merge_fn;
        q->front_merge_fn       = ll_front_merge_fn;
@@ -1485,8 +1484,12 @@ request_queue_t *blk_init_queue(request_fn_proc *rfn, spinlock_t *lock)
        blk_queue_max_hw_segments(q, MAX_HW_SEGMENTS);
        blk_queue_max_phys_segments(q, MAX_PHYS_SEGMENTS);
 
-       return q;
-out_elv:
+       /*
+        * all done
+        */
+       if (!elevator_init(q, chosen_elevator))
+               return q;
+
        blk_cleanup_queue(q);
 out_init:
        kmem_cache_free(requestq_cachep, q);
@@ -1813,54 +1816,53 @@ EXPORT_SYMBOL(blk_insert_request);
  *
  *    A matching blk_rq_unmap_user() must be issued at the end of io, while
  *    still in process context.
+ *
+ *    Note: The mapped bio may need to be bounced through blk_queue_bounce()
+ *    before being submitted to the device, as pages mapped may be out of
+ *    reach. It's the callers responsibility to make sure this happens. The
+ *    original bio must be passed back in to blk_rq_unmap_user() for proper
+ *    unmapping.
  */
 struct request *blk_rq_map_user(request_queue_t *q, int rw, void __user *ubuf,
                                unsigned int len)
 {
-       struct request *rq = NULL;
-       char *buf = NULL;
+       unsigned long uaddr;
+       struct request *rq;
        struct bio *bio;
-       int ret;
+
+       if (len > (q->max_sectors << 9))
+               return ERR_PTR(-EINVAL);
+       if ((!len && ubuf) || (len && !ubuf))
+               return ERR_PTR(-EINVAL);
 
        rq = blk_get_request(q, rw, __GFP_WAIT);
        if (!rq)
                return ERR_PTR(-ENOMEM);
 
-       bio = bio_map_user(q, NULL, (unsigned long) ubuf, len, rw == READ);
-       if (!bio) {
-               int bytes = (len + 511) & ~511;
-
-               buf = kmalloc(bytes, q->bounce_gfp | GFP_USER);
-               if (!buf) {
-                       ret = -ENOMEM;
-                       goto fault;
-               }
-
-               if (rw == WRITE) {
-                       if (copy_from_user(buf, ubuf, len)) {
-                               ret = -EFAULT;
-                               goto fault;
-                       }
-               } else
-                       memset(buf, 0, len);
-       }
+       /*
+        * if alignment requirement is satisfied, map in user pages for
+        * direct dma. else, set up kernel bounce buffers
+        */
+       uaddr = (unsigned long) ubuf;
+       if (!(uaddr & queue_dma_alignment(q)) && !(len & queue_dma_alignment(q)))
+               bio = bio_map_user(q, NULL, uaddr, len, rw == READ);
+       else
+               bio = bio_copy_user(q, uaddr, len, rw == READ);
 
-       rq->bio = rq->biotail = bio;
-       if (rq->bio)
+       if (!IS_ERR(bio)) {
+               rq->bio = rq->biotail = bio;
                blk_rq_bio_prep(q, rq, bio);
 
-       rq->buffer = rq->data = buf;
-       rq->data_len = len;
-       return rq;
-fault:
-       if (buf)
-               kfree(buf);
-       if (bio)
-               bio_unmap_user(bio, 1);
-       if (rq)
-               blk_put_request(rq);
+               rq->buffer = rq->data = NULL;
+               rq->data_len = len;
+               return rq;
+       }
 
-       return ERR_PTR(ret);
+       /*
+        * bio is the err-ptr
+        */
+       blk_put_request(rq);
+       return (struct request *) bio;
 }
 
 EXPORT_SYMBOL(blk_rq_map_user);
@@ -1874,18 +1876,15 @@ EXPORT_SYMBOL(blk_rq_map_user);
  * Description:
  *    Unmap a request previously mapped by blk_rq_map_user().
  */
-int blk_rq_unmap_user(struct request *rq, void __user *ubuf, struct bio *bio,
-                     unsigned int ulen)
+int blk_rq_unmap_user(struct request *rq, struct bio *bio, unsigned int ulen)
 {
-       const int read = rq_data_dir(rq) == READ;
        int ret = 0;
 
-       if (bio)
-               bio_unmap_user(bio, read);
-       if (rq->buffer) {
-               if (read && copy_to_user(ubuf, rq->buffer, ulen))
-                       ret = -EFAULT;
-               kfree(rq->buffer);
+       if (bio) {
+               if (bio_flagged(bio, BIO_USER_MAPPED))
+                       bio_unmap_user(bio);
+               else
+                       ret = bio_uncopy_user(bio);
        }
 
        blk_put_request(rq);
@@ -2870,6 +2869,8 @@ int kblockd_schedule_work(struct work_struct *work)
        return queue_work(kblockd_workqueue, work);
 }
 
+EXPORT_SYMBOL(kblockd_schedule_work);
+
 void kblockd_flush(void)
 {
        flush_workqueue(kblockd_workqueue);
index 2f1901b..876a236 100644 (file)
@@ -259,7 +259,7 @@ static int pcd_block_ioctl(struct inode *inode, struct file *file,
                                unsigned cmd, unsigned long arg)
 {
        struct pcd_unit *cd = inode->i_bdev->bd_disk->private_data;
-       return cdrom_ioctl(&cd->info, inode, cmd, arg);
+       return cdrom_ioctl(file, &cd->info, inode, cmd, arg);
 }
 
 static int pcd_block_media_changed(struct gendisk *disk)
index cd3bc2d..f94fd8a 100644 (file)
@@ -90,7 +90,7 @@ static int sg_set_reserved_size(request_queue_t *q, int __user *p)
        if (size < 0)
                return -EINVAL;
        if (size > (q->max_sectors << 9))
-               return -EINVAL;
+               size = q->max_sectors << 9;
 
        q->sg_reserved_size = size;
        return 0;
@@ -105,8 +105,79 @@ static int sg_emulated_host(request_queue_t *q, int __user *p)
        return put_user(1, p);
 }
 
-static int sg_io(request_queue_t *q, struct gendisk *bd_disk,
-                struct sg_io_hdr *hdr)
+#define CMD_READ_SAFE  0x01
+#define CMD_WRITE_SAFE 0x02
+#define safe_for_read(cmd)     [cmd] = CMD_READ_SAFE
+#define safe_for_write(cmd)    [cmd] = CMD_WRITE_SAFE
+
+static int verify_command(struct file *file, unsigned char *cmd)
+{
+       static const unsigned char cmd_type[256] = {
+
+               /* Basic read-only commands */
+               safe_for_read(TEST_UNIT_READY),
+               safe_for_read(REQUEST_SENSE),
+               safe_for_read(READ_6),
+               safe_for_read(READ_10),
+               safe_for_read(READ_12),
+               safe_for_read(READ_16),
+               safe_for_read(READ_BUFFER),
+               safe_for_read(READ_LONG),
+               safe_for_read(INQUIRY),
+               safe_for_read(MODE_SENSE),
+               safe_for_read(MODE_SENSE_10),
+               safe_for_read(START_STOP),
+
+               /* Audio CD commands */
+               safe_for_read(GPCMD_PLAY_CD),
+               safe_for_read(GPCMD_PLAY_AUDIO_10),
+               safe_for_read(GPCMD_PLAY_AUDIO_MSF),
+               safe_for_read(GPCMD_PLAY_AUDIO_TI),
+
+               /* CD/DVD data reading */
+               safe_for_read(GPCMD_READ_CD),
+               safe_for_read(GPCMD_READ_CD_MSF),
+               safe_for_read(GPCMD_READ_DISC_INFO),
+               safe_for_read(GPCMD_READ_CDVD_CAPACITY),
+               safe_for_read(GPCMD_READ_DVD_STRUCTURE),
+               safe_for_read(GPCMD_READ_HEADER),
+               safe_for_read(GPCMD_READ_TRACK_RZONE_INFO),
+               safe_for_read(GPCMD_READ_SUBCHANNEL),
+               safe_for_read(GPCMD_READ_TOC_PMA_ATIP),
+               safe_for_read(GPCMD_REPORT_KEY),
+               safe_for_read(GPCMD_SCAN),
+
+               /* Basic writing commands */
+               safe_for_write(WRITE_6),
+               safe_for_write(WRITE_10),
+               safe_for_write(WRITE_VERIFY),
+               safe_for_write(WRITE_12),
+               safe_for_write(WRITE_VERIFY_12),
+               safe_for_write(WRITE_16),
+               safe_for_write(WRITE_LONG),
+       };
+       unsigned char type = cmd_type[cmd[0]];
+
+       /* Anybody who can open the device can do a read-safe command */
+       if (type & CMD_READ_SAFE)
+               return 0;
+
+       /* Write-safe commands just require a writable open.. */
+       if (type & CMD_WRITE_SAFE) {
+               if (file->f_mode & FMODE_WRITE)
+                       return 0;
+       }
+
+       /* And root can do any command.. */
+       if (capable(CAP_SYS_RAWIO))
+               return 0;
+
+       /* Otherwise fail it with an "Operation not permitted" */
+       return -EPERM;
+}
+
+static int sg_io(struct file *file, request_queue_t *q,
+               struct gendisk *bd_disk, struct sg_io_hdr *hdr)
 {
        unsigned long start_time;
        int reading, writing;
@@ -121,6 +192,8 @@ static int sg_io(request_queue_t *q, struct gendisk *bd_disk,
                return -EINVAL;
        if (copy_from_user(cmd, hdr->cmdp, hdr->cmd_len))
                return -EFAULT;
+       if (verify_command(file, cmd))
+               return -EPERM;
 
        /*
         * we'll do that later
@@ -170,6 +243,13 @@ static int sg_io(request_queue_t *q, struct gendisk *bd_disk,
        rq->flags |= REQ_BLOCK_PC;
        bio = rq->bio;
 
+       /*
+        * bounce this after holding a reference to the original bio, it's
+        * needed for proper unmapping
+        */
+       if (rq->bio)
+               blk_queue_bounce(q, &rq->bio);
+
        rq->timeout = (hdr->timeout * HZ) / 1000;
        if (!rq->timeout)
                rq->timeout = q->sg_timeout;
@@ -204,7 +284,7 @@ static int sg_io(request_queue_t *q, struct gendisk *bd_disk,
                        hdr->sb_len_wr = len;
        }
 
-       if (blk_rq_unmap_user(rq, hdr->dxferp, bio, hdr->dxfer_len))
+       if (blk_rq_unmap_user(rq, bio, hdr->dxfer_len))
                return -EFAULT;
 
        /* may not have succeeded, but output values written to control
@@ -219,8 +299,8 @@ static int sg_io(request_queue_t *q, struct gendisk *bd_disk,
 #define READ_DEFECT_DATA_TIMEOUT       (60 * HZ )
 #define OMAX_SB_LEN 16          /* For backward compatibility */
 
-static int sg_scsi_ioctl(request_queue_t *q, struct gendisk *bd_disk,
-                        Scsi_Ioctl_Command __user *sic)
+static int sg_scsi_ioctl(struct file *file, request_queue_t *q,
+                        struct gendisk *bd_disk, Scsi_Ioctl_Command __user *sic)
 {
        struct request *rq;
        int err, in_len, out_len, bytes, opcode, cmdlen;
@@ -262,6 +342,10 @@ static int sg_scsi_ioctl(request_queue_t *q, struct gendisk *bd_disk,
        if (copy_from_user(buffer, sic->data + cmdlen, in_len))
                goto error;
 
+       err = verify_command(file, rq->cmd);
+       if (err)
+               goto error;
+
        switch (opcode) {
                case SEND_DIAGNOSTIC:
                case FORMAT_UNIT:
@@ -312,7 +396,7 @@ error:
        return err;
 }
 
-int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
+int scsi_cmd_ioctl(struct file *file, struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
 {
        request_queue_t *q;
        struct request *rq;
@@ -359,7 +443,7 @@ int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
                        err = -EFAULT;
                        if (copy_from_user(&hdr, arg, sizeof(hdr)))
                                break;
-                       err = sg_io(q, bd_disk, &hdr);
+                       err = sg_io(file, q, bd_disk, &hdr);
                        if (err == -EFAULT)
                                break;
 
@@ -407,7 +491,7 @@ int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
                        hdr.cmdp = ((struct cdrom_generic_command __user*) arg)->cmd;
                        hdr.cmd_len = sizeof(cgc.cmd);
 
-                       err = sg_io(q, bd_disk, &hdr);
+                       err = sg_io(file, q, bd_disk, &hdr);
                        if (err == -EFAULT)
                                break;
 
@@ -430,7 +514,7 @@ int scsi_cmd_ioctl(struct gendisk *bd_disk, unsigned int cmd, void __user *arg)
                        if (!arg)
                                break;
 
-                       err = sg_scsi_ioctl(q, bd_disk, arg);
+                       err = sg_scsi_ioctl(file, q, bd_disk, arg);
                        break;
                case CDROMCLOSETRAY:
                        close = 1;
index 73554d3..ca17d83 100644 (file)
@@ -1058,6 +1058,7 @@ int swim3_init(void)
                disk->fops = &floppy_fops;
                disk->private_data = &floppy_states[i];
                disk->queue = swim3_queue;
+               disk->flags |= GENHD_FL_REMOVABLE;
                sprintf(disk->disk_name, "fd%d", i);
                sprintf(disk->devfs_name, "floppy/%d", i);
                set_capacity(disk, 2880);
index c7fccd3..d67d038 100644 (file)
 #include <linux/module.h>
 
 #include <linux/kernel.h>
-#include <linux/kmod.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/ptrace.h>
 #include <linux/ioport.h>
@@ -639,8 +638,7 @@ int bt3c_open(bt3c_info_t *info)
        }
 
        /* Timeout before it is safe to send the first HCI packet */
-       set_current_state(TASK_INTERRUPTIBLE);
-       schedule_timeout(HZ);
+       msleep(1000);
 
        /* Register HCI device */
        err = hci_register_dev(hdev);
index ab3c28d..4d1f7ea 100644 (file)
@@ -633,7 +633,8 @@ static void bcsp_timed_event(unsigned long arg)
        struct sk_buff *skb;
        unsigned long flags;
 
-       BT_ERR("Timeout, retransmitting %u pkts", bcsp->unack.qlen);
+       BT_DBG("hu %p retransmitting %u pkts", hu, bcsp->unack.qlen);
+
        spin_lock_irqsave(&bcsp->unack.lock, flags);
 
        while ((skb = __skb_dequeue_tail(&bcsp->unack)) != NULL) {
index 1874deb..9babb21 100644 (file)
@@ -65,7 +65,7 @@
 #define URB_ZERO_PACKET 0
 #endif
 
-#define VERSION "2.6"
+#define VERSION "2.7"
 
 static struct usb_driver hci_usb_driver; 
 
@@ -76,14 +76,15 @@ static struct usb_device_id bluetooth_ids[] = {
        /* AVM BlueFRITZ! USB v2.0 */
        { USB_DEVICE(0x057c, 0x3800) },
 
-       /* Ericsson with non-standard id */
-       { USB_DEVICE(0x0bdb, 0x1002) },
+       /* Bluetooth Ultraport Module from IBM */
+       { USB_DEVICE(0x04bf, 0x030a) },
 
-       /* ALPS Module with non-standard id */
+       /* ALPS Modules with non-standard id */
+       { USB_DEVICE(0x044e, 0x3001) },
        { USB_DEVICE(0x044e, 0x3002) },
 
-       /* Bluetooth Ultraport Module from IBM */
-       { USB_DEVICE(0x04bf, 0x030a) },
+       /* Ericsson with non-standard id */
+       { USB_DEVICE(0x0bdb, 0x1002) },
 
        { }     /* Terminating entry */
 };
@@ -97,6 +98,9 @@ static struct usb_device_id blacklist_ids[] = {
        /* Broadcom BCM2035 */
        { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET },
 
+       /* ISSC Bluetooth Adapter v3.1 */
+       { USB_DEVICE(0x1131, 0x1001), .driver_info = HCI_RESET },
+
        /* Digianswer device */
        { USB_DEVICE(0x08fd, 0x0001), .driver_info = HCI_DIGIANSWER },
 
@@ -338,26 +342,18 @@ static int hci_usb_flush(struct hci_dev *hdev)
 
        BT_DBG("%s", hdev->name);
 
-       for (i=0; i < 4; i++)
+       for (i = 0; i < 4; i++)
                skb_queue_purge(&husb->transmit_q[i]);
        return 0;
 }
 
-static inline void hci_usb_wait_for_urb(struct urb *urb)
-{
-       while (atomic_read(&urb->kref.refcount) > 1) {
-               current->state = TASK_UNINTERRUPTIBLE;
-               schedule_timeout((5 * HZ + 999) / 1000);
-       }
-}
-
 static void hci_usb_unlink_urbs(struct hci_usb *husb)
 {
        int i;
 
        BT_DBG("%s", husb->hdev->name);
 
-       for (i=0; i < 4; i++) {
+       for (i = 0; i < 4; i++) {
                struct _urb *_urb;
                struct urb *urb;
 
@@ -366,8 +362,7 @@ static void hci_usb_unlink_urbs(struct hci_usb *husb)
                        urb = &_urb->urb;
                        BT_DBG("%s unlinking _urb %p type %d urb %p", 
                                        husb->hdev->name, _urb, _urb->type, urb);
-                       usb_unlink_urb(urb);
-                       hci_usb_wait_for_urb(urb);
+                       usb_kill_urb(urb);
                        _urb_queue_tail(__completed_q(husb, _urb->type), _urb);
                }
 
index 97ab1b3..b6a14c8 100644 (file)
                 Werner Zimmermann, August 8, 1995
         V1.70   Multisession support now is completed, but there is still not 
                 enough testing done. If you can test it, please contact me. For
-                details please read /usr/src/linux/Documentation/cdrom/aztcd
+                details please read Documentation/cdrom/aztcd
                 Werner Zimmermann, August 19, 1995
         V1.80   Modification to suit the new kernel boot procedure introduced
                 with kernel 1.3.33. Will definitely not work with older kernels.
index cd67fcd..2e1ee63 100644 (file)
@@ -833,8 +833,11 @@ static int cdrom_open_write(struct cdrom_device_info *cdi)
        if (!cdrom_is_mrw(cdi, &mrw_write))
                mrw = 1;
 
-       (void) cdrom_is_random_writable(cdi, &ram_write);
-
+       if (CDROM_CAN(CDC_MO_DRIVE))
+               ram_write = 1;
+       else
+               (void) cdrom_is_random_writable(cdi, &ram_write);
+       
        if (mrw)
                cdi->mask &= ~CDC_MRW;
        else
@@ -855,7 +858,7 @@ static int cdrom_open_write(struct cdrom_device_info *cdi)
        else if (CDROM_CAN(CDC_DVD_RAM))
                ret = cdrom_dvdram_open_write(cdi);
        else if (CDROM_CAN(CDC_RAM) &&
-                !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW))
+                !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE))
                ret = cdrom_ram_open_write(cdi);
        else if (CDROM_CAN(CDC_MO_DRIVE))
                ret = mo_open_write(cdi);
@@ -897,10 +900,10 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
                        goto err;
                if (fp->f_mode & FMODE_WRITE) {
                        ret = -EROFS;
-                       if (!CDROM_CAN(CDC_RAM))
-                               goto err;
                        if (cdrom_open_write(cdi))
                                goto err;
+                       if (!CDROM_CAN(CDC_RAM))
+                               goto err;
                        ret = 0;
                }
        }
@@ -1921,6 +1924,8 @@ static int cdrom_read_cdda_old(struct cdrom_device_info *cdi, __u8 __user *ubuf,
        struct packet_command cgc;
        int nr, ret;
 
+       cdi->last_sense = 0;
+
        memset(&cgc, 0, sizeof(cgc));
 
        /*
@@ -1972,6 +1977,8 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
        if (!q)
                return -ENXIO;
 
+       cdi->last_sense = 0;
+
        while (nframes) {
                nr = nframes;
                if (cdi->cdda_method == CDDA_BPC_SINGLE)
@@ -2002,13 +2009,16 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
                rq->timeout = 60 * HZ;
                bio = rq->bio;
 
+               if (rq->bio)
+                       blk_queue_bounce(q, &rq->bio);
+
                if (blk_execute_rq(q, cdi->disk, rq)) {
                        struct request_sense *s = rq->sense;
                        ret = -EIO;
                        cdi->last_sense = s->sense_key;
                }
 
-               if (blk_rq_unmap_user(rq, ubuf, bio, len))
+               if (blk_rq_unmap_user(rq, bio, len))
                        ret = -EFAULT;
 
                if (ret)
@@ -2016,6 +2026,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf,
 
                nframes -= nr;
                lba += nr;
+               ubuf += len;
        }
 
        return ret;
@@ -2064,14 +2075,14 @@ retry:
  * these days. ATAPI / SCSI specific code now mainly resides in
  * mmc_ioct().
  */
-int cdrom_ioctl(struct cdrom_device_info *cdi, struct inode *ip,
-               unsigned int cmd, unsigned long arg)
+int cdrom_ioctl(struct file * file, struct cdrom_device_info *cdi,
+               struct inode *ip, unsigned int cmd, unsigned long arg)
 {
        struct cdrom_device_ops *cdo = cdi->ops;
        int ret;
 
        /* Try the generic SCSI command ioctl's first.. */
-       ret = scsi_cmd_ioctl(ip->i_bdev->bd_disk, cmd, (void __user *)arg);
+       ret = scsi_cmd_ioctl(file, ip->i_bdev->bd_disk, cmd, (void __user *)arg);
        if (ret != -ENOTTY)
                return ret;
 
@@ -2925,13 +2936,13 @@ struct cdrom_sysctl_settings {
 } cdrom_sysctl_settings;
 
 int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
-                           void __user *buffer, size_t *lenp)
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
 {
         int pos;
        struct cdrom_device_info *cdi;
        char *info = cdrom_sysctl_settings.info;
        
-       if (!*lenp || (filp->f_pos && !write)) {
+       if (!*lenp || (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -3020,7 +3031,7 @@ int cdrom_sysctl_info(ctl_table *ctl, int write, struct file * filp,
 
        strcpy(info+pos,"\n\n");
                
-        return proc_dostring(ctl, write, filp, buffer, lenp);
+        return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 /* Unfortunately, per device settings are not implemented through
@@ -3052,13 +3063,13 @@ void cdrom_update_settings(void)
 }
 
 static int cdrom_sysctl_handler(ctl_table *ctl, int write, struct file * filp,
-                               void __user *buffer, size_t *lenp)
+                               void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int *valp = ctl->data;
        int val = *valp;
        int ret;
        
-       ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+       ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && *valp != val) {
        
index 3ada792..01b4e9a 100644 (file)
@@ -233,7 +233,7 @@ static int mcdx_block_ioctl(struct inode *inode, struct file *file,
                                unsigned cmd, unsigned long arg)
 {
        struct s_drive_stuff *p = inode->i_bdev->bd_disk->private_data;
-       return cdrom_ioctl(&p->info, inode, cmd, arg);
+       return cdrom_ioctl(file, &p->info, inode, cmd, arg);
 }
 
 static int mcdx_block_media_changed(struct gendisk *disk)
index 85f0aca..3a2acc0 100644 (file)
@@ -199,7 +199,7 @@ static int viocd_blk_ioctl(struct inode *inode, struct file *file,
                unsigned cmd, unsigned long arg)
 {
        struct disk_info *di = inode->i_bdev->bd_disk->private_data;
-       return cdrom_ioctl(&di->viocd_info, inode, cmd, arg);
+       return cdrom_ioctl(file, &di->viocd_info, inode, cmd, arg);
 }
 
 static int viocd_blk_media_changed(struct gendisk *disk)
index f9e31a5..d86e52e 100644 (file)
@@ -203,7 +203,7 @@ config MOXA_SMARTIO
 
 config ISI
        tristate "Multi-Tech multiport card support (EXPERIMENTAL)"
-       depends on SERIAL_NONSTANDARD && EXPERIMENTAL && BROKEN_ON_SMP && m
+       depends on SERIAL_NONSTANDARD && PCI && EXPERIMENTAL && BROKEN_ON_SMP && m
        help
          This is a driver for the Multi-Tech cards which provide several
          serial ports.  The driver is experimental and can currently only be
@@ -212,7 +212,7 @@ config ISI
 
 config SYNCLINK
        tristate "Microgate SyncLink card support"
-       depends on SERIAL_NONSTANDARD
+       depends on SERIAL_NONSTANDARD && PCI
        help
          Provides support for the SyncLink ISA and PCI multiprotocol serial
          adapters. These adapters support asynchronous and HDLC bit
@@ -371,22 +371,6 @@ config AU1000_UART
          If you have an Alchemy AU1000 processor (MIPS based) and you want
          to use serial ports, say Y.  Otherwise, say N.
 
-config SGI_L1_SERIAL
-       bool "SGI Altix L1 serial support"
-       depends on SERIAL_NONSTANDARD && IA64 && DISCONTIGMEM
-       help
-         If you have an SGI Altix and you want to use the serial port
-         connected to the system controller (you want this!), say Y.
-         Otherwise, say N.
-
-config SGI_L1_SERIAL_CONSOLE
-       bool "SGI Altix L1 serial console support"
-       depends on SGI_L1_SERIAL
-       help
-         If you have an SGI Altix and you would like to use the system
-         controller serial port as your console (you want this!),
-         say Y.  Otherwise, say N.
-
 config AU1000_SERIAL_CONSOLE
        bool "Enable Au1000 serial console"
        depends on AU1000_UART
@@ -588,6 +572,23 @@ config HVC_CONSOLE
          console. This driver allows each pSeries partition to have a console
          which is accessed via the HMC.
 
+config HVCS
+       tristate "IBM Hypervisor Virtual Console Server support"
+       depends on PPC_PSERIES
+       help
+         Partitionable IBM Power5 ppc64 machines allow hosting of
+         firmware virtual consoles from one Linux partition by
+         another Linux partition.  This driver allows console data
+         from Linux partitions to be accessed through TTY device
+         interfaces in the device tree of a Linux partition running
+         this driver.
+
+         To compile this driver as a module, choose M here: the
+         module will be called hvcs.ko.  Additionally, this module
+         will depend on arch specific APIs exported from hvcserver.ko
+         which will also be compiled when this driver is built as a
+         module.
+
 config QIC02_TAPE
        tristate "QIC-02 tape support"
        help
@@ -837,6 +838,7 @@ config R3964
 
 config APPLICOM
        tristate "Applicom intelligent fieldbus card support"
+       depends on PCI
        ---help---
          This driver provides the kernel-side support for the intelligent
          fieldbus cards made by Applicom International. More information
@@ -867,7 +869,7 @@ menu "Ftape, the floppy tape device driver"
 
 config FTAPE
        tristate "Ftape (QIC-80/Travan) support"
-       depends on BROKEN_ON_SMP
+       depends on BROKEN_ON_SMP && (ALPHA || X86)
        ---help---
          If you have a tape drive that is connected to your floppy
          controller, say Y here.
@@ -976,14 +978,18 @@ config HPET_RTC_IRQ
          is assumed the platform called hpet_alloc with the RTC IRQ values for
          the HPET timers.
 
-config HPET_NOMMAP
-       bool "HPET - Control mmap capability."
-       default n
+config HPET_MMAP
+       bool "Allow mmap of HPET"
+       default y
        depends on HPET
        help
-         If you say Y here, then the mmap interface for the HPET driver returns ENOSYS.
-         Some hardware implementations might not want all the memory in the page the
-         HPET control registers reside to be exposed.
+         If you say Y here, user applications will be able to mmap
+         the HPET registers.
+
+         In some hardware implementations, the page containing HPET
+         registers may also contain other things that shouldn't be
+         exposed to the user.  If this applies to your hardware,
+         say N here.
 
 config MAX_RAW_DEVS
        int "Maximum number of RAW devices to support (1-8192)"
index da0b4f0..14e233e 100644 (file)
@@ -41,9 +41,9 @@ obj-$(CONFIG_SX)              += sx.o generic_serial.o
 obj-$(CONFIG_RIO)              += rio/ generic_serial.o
 obj-$(CONFIG_HVC_CONSOLE)      += hvc_console.o
 obj-$(CONFIG_RAW_DRIVER)       += raw.o
-obj-$(CONFIG_SGI_L1_SERIAL)    += sn_serial.o
 obj-$(CONFIG_VIOCONS) += viocons.o
 obj-$(CONFIG_VIOTAPE)          += viotape.o
+obj-$(CONFIG_HVCS)             += hvcs.o
 
 obj-$(CONFIG_PRINTER) += lp.o
 obj-$(CONFIG_TIPAR) += tipar.o
index 58b117b..773279d 100644 (file)
@@ -82,7 +82,7 @@ config AGP_INTEL
          This option gives you AGP support for the GLX component of XFree86 4.x
          on Intel 440LX/BX/GX, 815, 820, 830, 840, 845, 850, 860, 875,
          E7205 and E7505 chipsets and full support for the 810, 815, 830M, 845G,
-         852GM, 855GM and 865G integrated graphics chipsets.
+         852GM, 855GM, 865G and I915 integrated graphics chipsets.
 
          You should say Y here if you use XFree86 3.3.6 or 4.x and want to
          use GLX or DRI, or if you have any Intel integrated graphics
index 18c3842..924ffc3 100644 (file)
@@ -563,14 +563,25 @@ static struct pci_device_id agp_amd64_pci_table[] = {
        .subvendor      = PCI_ANY_ID,
        .subdevice      = PCI_ANY_ID,
        },
+       /* VIA K8T890 */
        {
        .class          = (PCI_CLASS_BRIDGE_HOST << 8),
        .class_mask     = ~0,
        .vendor         = PCI_VENDOR_ID_VIA,
-       .device         = PCI_DEVICE_ID_VIA_8380_0,
+       .device         = PCI_DEVICE_ID_VIA_3238_0,
        .subvendor      = PCI_ANY_ID,
        .subdevice      = PCI_ANY_ID,
        },
+       /* VIA K8T800/K8M800/K8N800 */
+       {
+       .class          = (PCI_CLASS_BRIDGE_HOST << 8),
+       .class_mask     = ~0,
+       .vendor         = PCI_VENDOR_ID_VIA,
+       .device         = PCI_DEVICE_ID_VIA_838X_1,
+       .subvendor      = PCI_ANY_ID,
+       .subdevice      = PCI_ANY_ID,
+       },
+
        /* NForce3 */
        {
        .class          = (PCI_CLASS_BRIDGE_HOST << 8),
index 5aa162a..f045275 100644 (file)
@@ -5,11 +5,15 @@
 /*
  * Intel(R) 855GM/852GM and 865G support added by David Dawes
  * <dawes@tungstengraphics.com>.
+ *
+ * Intel(R) 915G support added by Alan Hourihane
+ * <alanh@tungstengraphics.com>.
  */
 
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/pagemap.h>
 #include <linux/agp_backend.h>
 #include "agp.h"
 
 #define INTEL_I850_MCHCFG      0x50
 #define INTEL_I850_ERRSTS      0xc8
 
+/* intel 915G registers */
+#define I915_GMADDR    0x18
+#define I915_MMADDR    0x10
+#define I915_PTEADDR   0x1C
+#define I915_GMCH_GMS_STOLEN_48M       (0x6 << 4)
+#define I915_GMCH_GMS_STOLEN_64M       (0x7 << 4)
+
+
 /* Intel 7505 registers */
 #define INTEL_I7505_APSIZE     0x74
 #define INTEL_I7505_NCAPID     0x60
@@ -143,6 +155,40 @@ static void intel_i810_agp_enable(u32 mode)
        return;
 }
 
+/* Exists to support ARGB cursors */
+static void *i8xx_alloc_pages(void)
+{
+       struct page * page;
+
+       page = alloc_pages(GFP_KERNEL, 2);
+       if (page == NULL) {
+               return 0;
+       }
+       if (change_page_attr(page, 4, PAGE_KERNEL_NOCACHE) < 0) {
+               __free_page(page); 
+               return 0;
+       }
+       get_page(page);
+       SetPageLocked(page);
+       atomic_inc(&agp_bridge->current_memory_agp);
+       return page_address(page);
+}
+
+static void i8xx_destroy_pages(void *addr)
+{
+       struct page *page;
+
+       if (addr == NULL)
+               return;
+       
+       page = virt_to_page(addr);
+       change_page_attr(page, 4, PAGE_KERNEL);
+       put_page(page);
+       unlock_page(page);
+       free_pages((unsigned long)addr, 2);
+       atomic_dec(&agp_bridge->current_memory_agp);
+}
+
 static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
                                int type)
 {
@@ -218,20 +264,36 @@ static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
        struct agp_memory *new;
        void *addr;
 
-       if (pg_count != 1)
+       if (pg_count != 1 && pg_count != 4)
                return NULL;
 
-       addr = agp_bridge->driver->agp_alloc_page();
+       switch (pg_count) {
+       case 1: addr = agp_bridge->driver->agp_alloc_page();
+               break;
+       case 4:
+               /* kludge to get 4 physical pages for ARGB cursor */
+               addr = i8xx_alloc_pages();
+               break;
+       default:
+               return NULL;
+       }
+
        if (addr == NULL)
                return NULL;
 
-       new = agp_create_memory(1);
+       new = agp_create_memory(pg_count);
        if (new == NULL)
                return NULL;
 
-       new->memory[0] = agp_bridge->driver->mask_memory(virt_to_phys(addr), type);
-       new->page_count = 1;
-       new->num_scratch_pages = 1;
+       new->memory[0] = virt_to_phys(addr);
+       if (pg_count == 4) {
+               /* kludge to get 4 physical pages for ARGB cursor */
+               new->memory[1] = new->memory[0] + PAGE_SIZE;
+               new->memory[2] = new->memory[1] + PAGE_SIZE;
+               new->memory[3] = new->memory[2] + PAGE_SIZE;
+       }
+       new->page_count = pg_count;
+       new->num_scratch_pages = pg_count;
        new->type = AGP_PHYS_MEMORY;
        new->physical = new->memory[0];
        return new;
@@ -265,7 +327,11 @@ static void intel_i810_free_by_type(struct agp_memory *curr)
 {
        agp_free_key(curr->key);
        if(curr->type == AGP_PHYS_MEMORY) {
-               agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
+               if (curr->page_count == 4)
+                       i8xx_destroy_pages(phys_to_virt(curr->memory[0]));
+               else
+                       agp_bridge->driver->agp_destroy_page(
+                                phys_to_virt(curr->memory[0]));
                vfree(curr->memory);
        }
        kfree(curr);
@@ -281,12 +347,14 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
 {
        {128, 32768, 5},
        /* The 64M mode still requires a 128k gatt */
-       {64, 16384, 5}
+       {64, 16384, 5},
+       {256, 65536, 6},
 };
 
 static struct _intel_i830_private {
        struct pci_dev *i830_dev;               /* device one */
        volatile u8 *registers;
+       volatile u32 *gtt;              /* I915G */
        int gtt_entries;
 } intel_i830_private;
 
@@ -297,20 +365,26 @@ static void intel_i830_init_gtt_entries(void)
        u8 rdct;
        int local = 0;
        static const int ddt[4] = { 0, 16, 32, 64 };
+       int size;
 
        pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
 
+       /* We obtain the size of the GTT, which is also stored (for some
+        * reason) at the top of stolen memory. Then we add 4KB to that
+        * for the video BIOS popup, which is also stored in there. */
+       size = agp_bridge->driver->fetch_size() + 4;
+
        if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB ||
            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) {
                switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
                case I830_GMCH_GMS_STOLEN_512:
-                       gtt_entries = KB(512) - KB(132);
+                       gtt_entries = KB(512) - KB(size);
                        break;
                case I830_GMCH_GMS_STOLEN_1024:
-                       gtt_entries = MB(1) - KB(132);
+                       gtt_entries = MB(1) - KB(size);
                        break;
                case I830_GMCH_GMS_STOLEN_8192:
-                       gtt_entries = MB(8) - KB(132);
+                       gtt_entries = MB(8) - KB(size);
                        break;
                case I830_GMCH_GMS_LOCAL:
                        rdct = INREG8(intel_i830_private.registers,
@@ -326,20 +400,33 @@ static void intel_i830_init_gtt_entries(void)
        } else {
                switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
                case I855_GMCH_GMS_STOLEN_1M:
-                       gtt_entries = MB(1) - KB(132);
+                       gtt_entries = MB(1) - KB(size);
                        break;
                case I855_GMCH_GMS_STOLEN_4M:
-                       gtt_entries = MB(4) - KB(132);
+                       gtt_entries = MB(4) - KB(size);
                        break;
                case I855_GMCH_GMS_STOLEN_8M:
-                       gtt_entries = MB(8) - KB(132);
+                       gtt_entries = MB(8) - KB(size);
                        break;
                case I855_GMCH_GMS_STOLEN_16M:
-                       gtt_entries = MB(16) - KB(132);
+                       gtt_entries = MB(16) - KB(size);
                        break;
                case I855_GMCH_GMS_STOLEN_32M:
-                       gtt_entries = MB(32) - KB(132);
+                       gtt_entries = MB(32) - KB(size);
+                       break;
+               case I915_GMCH_GMS_STOLEN_48M:
+                       /* Check it's really I915G */
+                       if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB)
+                               gtt_entries = MB(48) - KB(size);
+                       else
+                               gtt_entries = 0;
                        break;
+               case I915_GMCH_GMS_STOLEN_64M:
+                       /* Check it's really I915G */
+                       if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB)
+                               gtt_entries = MB(64) - KB(size);
+                       else
+                               gtt_entries = 0;
                default:
                        gtt_entries = 0;
                        break;
@@ -421,7 +508,7 @@ static int intel_i830_fetch_size(void)
                agp_bridge->aperture_size_idx = 0;
                return(values[0].size);
        } else {
-               agp_bridge->previous_size = agp_bridge->current_size = (void *) values;
+               agp_bridge->previous_size = agp_bridge->current_size = (void *) (values + 1);
                agp_bridge->aperture_size_idx = 1;
                return(values[1].size);
        }
@@ -532,6 +619,161 @@ static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type)
        return(NULL);
 }
 
+static int intel_i915_configure(void)
+{
+       struct aper_size_info_fixed *current_size;
+       u32 temp;
+       u16 gmch_ctrl;
+       int i;
+
+       current_size = A_SIZE_FIX(agp_bridge->current_size);
+
+       pci_read_config_dword(intel_i830_private.i830_dev, I915_GMADDR, &temp);
+
+       agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
+
+       pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
+       gmch_ctrl |= I830_GMCH_ENABLED;
+       pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl);
+
+       OUTREG32(intel_i830_private.registers,I810_PGETBL_CTL,agp_bridge->gatt_bus_addr | I810_PGETBL_ENABLED);
+       global_cache_flush();
+
+       if (agp_bridge->driver->needs_scratch_page) {
+               for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++)
+                       OUTREG32(intel_i830_private.gtt, i, agp_bridge->scratch_page);
+       }
+
+       return (0);
+}
+
+static void intel_i915_cleanup(void)
+{
+       iounmap((void *) intel_i830_private.gtt);
+       iounmap((void *) intel_i830_private.registers);
+}
+
+static int intel_i915_insert_entries(struct agp_memory *mem,off_t pg_start,
+                               int type)
+{
+       int i,j,num_entries;
+       void *temp;
+
+       temp = agp_bridge->current_size;
+       num_entries = A_SIZE_FIX(temp)->num_entries;
+
+       if (pg_start < intel_i830_private.gtt_entries) {
+               printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n",
+                               pg_start,intel_i830_private.gtt_entries);
+
+               printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n");
+               return (-EINVAL);
+       }
+
+       if ((pg_start + mem->page_count) > num_entries)
+               return (-EINVAL);
+
+       /* The i830 can't check the GTT for entries since its read only,
+        * depend on the caller to make the correct offset decisions.
+        */
+
+       if ((type != 0 && type != AGP_PHYS_MEMORY) ||
+               (mem->type != 0 && mem->type != AGP_PHYS_MEMORY))
+               return (-EINVAL);
+
+       global_cache_flush();
+
+       for (i = 0, j = pg_start; i < mem->page_count; i++, j++)
+               OUTREG32(intel_i830_private.gtt, j, agp_bridge->driver->mask_memory(mem->memory[i], mem->type));
+
+       global_cache_flush();
+
+       agp_bridge->driver->tlb_flush(mem);
+
+       return(0);
+}
+
+static int intel_i915_remove_entries(struct agp_memory *mem,off_t pg_start,
+                               int type)
+{
+       int i;
+
+       global_cache_flush();
+
+       if (pg_start < intel_i830_private.gtt_entries) {
+               printk (KERN_INFO PFX "Trying to disable local/stolen memory\n");
+               return (-EINVAL);
+       }
+
+       for (i = pg_start; i < (mem->page_count + pg_start); i++)
+               OUTREG32(intel_i830_private.gtt, i, agp_bridge->scratch_page);
+
+       global_cache_flush();
+
+       agp_bridge->driver->tlb_flush(mem);
+
+       return (0);
+}
+
+static int intel_i915_fetch_size(void)
+{
+       struct aper_size_info_fixed *values;
+       u32 temp, offset = 0;
+
+#define I915_256MB_ADDRESS_MASK (1<<27)
+
+       values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
+
+       pci_read_config_dword(intel_i830_private.i830_dev, I915_GMADDR, &temp);
+       if (temp & I915_256MB_ADDRESS_MASK)
+               offset = 0;     /* 128MB aperture */
+       else
+               offset = 2;     /* 256MB aperture */
+       agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset);
+       return(values[offset].size);
+}
+
+/* The intel i915 automatically initializes the agp aperture during POST.
+ * Use the memory already set aside for in the GTT.
+ */
+static int intel_i915_create_gatt_table(void)
+{
+       int page_order;
+       struct aper_size_info_fixed *size;
+       int num_entries;
+       u32 temp, temp2;
+
+       size = agp_bridge->current_size;
+       page_order = size->page_order;
+       num_entries = size->num_entries;
+       agp_bridge->gatt_table_real = 0;
+
+       pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp);
+       pci_read_config_dword(intel_i830_private.i830_dev, I915_PTEADDR,&temp2);
+
+       intel_i830_private.gtt = (volatile u32 *) ioremap(temp2, 256 * 1024);
+       if (!intel_i830_private.gtt) 
+               return (-ENOMEM);
+
+       temp &= 0xfff80000;
+
+       intel_i830_private.registers = (volatile u8 *) ioremap(temp,128 * 4096);
+       if (!intel_i830_private.registers)
+               return (-ENOMEM);
+
+       temp = INREG32(intel_i830_private.registers,I810_PGETBL_CTL) & 0xfffff000;
+       global_cache_flush();
+
+       /* we have to call this as early as possible after the MMIO base address is known */
+       intel_i830_init_gtt_entries();
+
+       agp_bridge->gatt_table = NULL;
+
+       agp_bridge->gatt_bus_addr = temp;
+
+       return(0);
+}
+
 static int intel_fetch_size(void)
 {
        int i;
@@ -1041,7 +1283,7 @@ static struct agp_bridge_driver intel_830_driver = {
        .owner                  = THIS_MODULE,
        .aperture_sizes         = intel_i830_sizes,
        .size_type              = FIXED_APER_SIZE,
-       .num_aperture_sizes     = 2,
+       .num_aperture_sizes     = 3,
        .needs_scratch_page     = TRUE,
        .configure              = intel_i830_configure,
        .fetch_size             = intel_i830_fetch_size,
@@ -1199,6 +1441,31 @@ static struct agp_bridge_driver intel_860_driver = {
        .agp_destroy_page       = agp_generic_destroy_page,
 };
 
+static struct agp_bridge_driver intel_915_driver = {
+       .owner                  = THIS_MODULE,
+       .aperture_sizes         = intel_i830_sizes,
+       .size_type              = FIXED_APER_SIZE,
+       .num_aperture_sizes     = 3,
+       .needs_scratch_page     = TRUE,
+       .configure              = intel_i915_configure,
+       .fetch_size             = intel_i915_fetch_size,
+       .cleanup                = intel_i915_cleanup,
+       .tlb_flush              = intel_i810_tlbflush,
+       .mask_memory            = intel_i810_mask_memory,
+       .masks                  = intel_i810_masks,
+       .agp_enable             = intel_i810_agp_enable,
+       .cache_flush            = global_cache_flush,
+       .create_gatt_table      = intel_i915_create_gatt_table,
+       .free_gatt_table        = intel_i830_free_gatt_table,
+       .insert_memory          = intel_i915_insert_entries,
+       .remove_memory          = intel_i915_remove_entries,
+       .alloc_by_type          = intel_i830_alloc_by_type,
+       .free_by_type           = intel_i810_free_by_type,
+       .agp_alloc_page         = agp_generic_alloc_page,
+       .agp_destroy_page       = agp_generic_destroy_page,
+};
+
+
 static struct agp_bridge_driver intel_7505_driver = {
        .owner                  = THIS_MODULE,
        .aperture_sizes         = intel_8xx_sizes,
@@ -1373,9 +1640,17 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev,
                bridge->driver = &intel_845_driver;
                name = "i875";
                break;
+       case PCI_DEVICE_ID_INTEL_82915G_HB:
+               if (find_i830(PCI_DEVICE_ID_INTEL_82915G_IG)) {
+                       bridge->driver = &intel_915_driver;
+               } else {
+                       bridge->driver = &intel_845_driver;
+               }
+               name = "915G";
+               break;
        case PCI_DEVICE_ID_INTEL_7505_0:
                bridge->driver = &intel_7505_driver;
-               name =  "E7505";
+               name = "E7505";
                break;
        case PCI_DEVICE_ID_INTEL_7205_0:
                bridge->driver = &intel_7505_driver;
@@ -1458,6 +1733,8 @@ static int agp_intel_resume(struct pci_dev *pdev)
                intel_845_configure();
        else if (bridge->driver == &intel_830mp_driver)
                intel_830mp_configure();
+       else if (bridge->driver == &intel_915_driver)
+               intel_i915_configure();
 
        return 0;
 }
index 549149f..2a99c73 100644 (file)
@@ -144,6 +144,10 @@ struct agp_bridge_driver sis_driver = {
 
 static struct agp_device_ids sis_agp_device_ids[] __devinitdata =
 {
+       {
+               .device_id      = PCI_DEVICE_ID_SI_5591_AGP,
+               .chipset_name   = "5591",
+       },
        {
                .device_id      = PCI_DEVICE_ID_SI_530,
                .chipset_name   = "530",
index a36c497..c619722 100644 (file)
@@ -348,6 +348,21 @@ static struct agp_device_ids via_agp_device_ids[] __devinitdata =
                .device_id      = PCI_DEVICE_ID_VIA_PX8X0_0,
                .chipset_name   = "PM800/PN800/PM880/PN880",
        },
+       /* KT880 */
+       {
+               .device_id      = PCI_DEVICE_ID_VIA_3269_0,
+               .chipset_name   = "KT880",
+       },
+       /* KTxxx/Px8xx */
+       {
+               .device_id      = PCI_DEVICE_ID_VIA_83_87XX_1,
+               .chipset_name   = "VT83xx/VT87xx/KTxxx/Px8xx",
+       },
+       /* P4M800 */
+       {
+               .device_id      = PCI_DEVICE_ID_VIA_3296_0,
+               .chipset_name   = "P4M800",
+       },
 
        { }, /* dummy final entry, always present */
 };
@@ -457,7 +472,10 @@ static struct pci_device_id agp_via_pci_table[] = {
        ID(PCI_DEVICE_ID_VIA_8378_0),
        ID(PCI_DEVICE_ID_VIA_PT880),
        ID(PCI_DEVICE_ID_VIA_8783_0),
-       ID(PCI_DEVICE_ID_VIA_PX8X0_0),  
+       ID(PCI_DEVICE_ID_VIA_PX8X0_0),
+       ID(PCI_DEVICE_ID_VIA_3269_0),
+       ID(PCI_DEVICE_ID_VIA_83_87XX_1),
+       ID(PCI_DEVICE_ID_VIA_3296_0),
        { }
 };
 
index ea37452..5873052 100644 (file)
@@ -153,11 +153,11 @@ typedef struct drm_version {
        int    version_minor;     /**< Minor version */
        int    version_patchlevel;/**< Patch level */
        size_t name_len;          /**< Length of name buffer */
-       char   *name;             /**< Name of driver */
+       char   __user *name;      /**< Name of driver */
        size_t date_len;          /**< Length of date buffer */
-       char   *date;             /**< User-space buffer to hold date */
+       char   __user *date;      /**< User-space buffer to hold date */
        size_t desc_len;          /**< Length of desc buffer */
-       char   *desc;             /**< User-space buffer to hold desc */
+       char   __user *desc;      /**< User-space buffer to hold desc */
 } drm_version_t;
 
 
@@ -168,13 +168,13 @@ typedef struct drm_version {
  */
 typedef struct drm_unique {
        size_t unique_len;        /**< Length of unique */
-       char   *unique;           /**< Unique name for driver instantiation */
+       char   __user *unique;    /**< Unique name for driver instantiation */
 } drm_unique_t;
 
 
 typedef struct drm_list {
        int              count;   /**< Length of user-space structures */
-       drm_version_t    *version;
+       drm_version_t    __user *version;
 } drm_list_t;
 
 
@@ -380,7 +380,7 @@ typedef struct drm_buf_desc {
  */
 typedef struct drm_buf_info {
        int            count;   /**< Entries in list */
-       drm_buf_desc_t *list;
+       drm_buf_desc_t __user *list;
 } drm_buf_info_t;
 
 
@@ -389,7 +389,7 @@ typedef struct drm_buf_info {
  */
 typedef struct drm_buf_free {
        int            count;
-       int            *list;
+       int            __user *list;
 } drm_buf_free_t;
 
 
@@ -402,7 +402,7 @@ typedef struct drm_buf_pub {
        int               idx;         /**< Index into the master buffer list */
        int               total;       /**< Buffer size */
        int               used;        /**< Amount of buffer in use (for DMA) */
-       void              *address;    /**< Address of buffer */
+       void      __user *address;     /**< Address of buffer */
 } drm_buf_pub_t;
 
 
@@ -411,8 +411,8 @@ typedef struct drm_buf_pub {
  */
 typedef struct drm_buf_map {
        int           count;    /**< Length of the buffer list */
-       void          *virtual; /**< Mmap'd area in user-virtual */
-       drm_buf_pub_t *list;    /**< Buffer information */
+       void          __user *virtual;  /**< Mmap'd area in user-virtual */
+       drm_buf_pub_t __user *list;     /**< Buffer information */
 } drm_buf_map_t;
 
 
@@ -426,13 +426,13 @@ typedef struct drm_buf_map {
 typedef struct drm_dma {
        int             context;          /**< Context handle */
        int             send_count;       /**< Number of buffers to send */
-       int             *send_indices;    /**< List of handles to buffers */
-       int             *send_sizes;      /**< Lengths of data to send */
+       int     __user *send_indices;     /**< List of handles to buffers */
+       int     __user *send_sizes;       /**< Lengths of data to send */
        drm_dma_flags_t flags;            /**< Flags */
        int             request_count;    /**< Number of buffers requested */
        int             request_size;     /**< Desired size for buffers */
-       int             *request_indices; /**< Buffer information */
-       int             *request_sizes;
+       int     __user *request_indices;  /**< Buffer information */
+       int     __user *request_sizes;
        int             granted_count;    /**< Number of buffers granted */
 } drm_dma_t;
 
@@ -459,7 +459,7 @@ typedef struct drm_ctx {
  */
 typedef struct drm_ctx_res {
        int             count;
-       drm_ctx_t       *contexts;
+       drm_ctx_t       __user *contexts;
 } drm_ctx_res_t;
 
 
index 8bd8423..88886cb 100644 (file)
@@ -599,7 +599,7 @@ typedef struct drm_ctx_list {
        drm_file_t              *tag;   /**< associated fd private data */
 } drm_ctx_list_t;
 
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
 
 typedef struct drm_vbl_sig {
        struct list_head        head;
@@ -698,7 +698,7 @@ typedef struct drm_device {
        struct work_struct      work;
        /** \name VBLANK IRQ support */
        /*@{*/
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
        wait_queue_head_t vbl_queue;    /**< VBLANK wait queue */
        atomic_t          vbl_received;
        spinlock_t        vbl_lock;
@@ -776,7 +776,7 @@ extern int       DRM(mmap_dma)(struct file *filp,
                                   struct vm_area_struct *vma);
 extern int          DRM(mmap)(struct file *filp, struct vm_area_struct *vma);
 extern unsigned int  DRM(poll)(struct file *filp, struct poll_table_struct *wait);
-extern ssize_t       DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off);
+extern ssize_t       DRM(read)(struct file *filp, char __user *buf, size_t count, loff_t *off);
 
                                /* Memory management support (drm_memory.h) */
 extern void         DRM(mem_init)(void);
@@ -915,13 +915,13 @@ extern irqreturn_t   DRM(irq_handler)( DRM_IRQ_ARGS );
 extern void          DRM(driver_irq_preinstall)( drm_device_t *dev );
 extern void          DRM(driver_irq_postinstall)( drm_device_t *dev );
 extern void          DRM(driver_irq_uninstall)( drm_device_t *dev );
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
 extern int           DRM(wait_vblank)(struct inode *inode, struct file *filp,
                                      unsigned int cmd, unsigned long arg);
 extern int           DRM(vblank_wait)(drm_device_t *dev, unsigned int *vbl_seq);
 extern void          DRM(vbl_send_signals)( drm_device_t *dev );
 #endif
-#if __HAVE_IRQ_BH
+#ifdef __HAVE_IRQ_BH
 extern void          DRM(irq_immediate_bh)( void *dev );
 #endif
 #endif
@@ -969,7 +969,7 @@ extern int            DRM(proc_cleanup)(int minor,
                                        struct proc_dir_entry *root,
                                        struct proc_dir_entry *dev_root);
 
-#if __HAVE_SG
+#ifdef __HAVE_SG
                                /* Scatter Gather Support (drm_scatter.h) */
 extern void           DRM(sg_cleanup)(drm_sg_mem_t *entry);
 extern int            DRM(sg_alloc)(struct inode *inode, struct file *filp,
index aa7fd54..491c305 100644 (file)
@@ -79,7 +79,7 @@ int DRM(agp_info)(struct inode *inode, struct file *filp,
        info.id_vendor         = kern->device->vendor;
        info.id_device         = kern->device->device;
 
-       if (copy_to_user((drm_agp_info_t *)arg, &info, sizeof(info)))
+       if (copy_to_user((drm_agp_info_t __user *)arg, &info, sizeof(info)))
                return -EFAULT;
        return 0;
 }
@@ -173,7 +173,7 @@ int DRM(agp_enable)(struct inode *inode, struct file *filp,
        if (!dev->agp || !dev->agp->acquired || !drm_agp->enable)
                return -EINVAL;
 
-       if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
+       if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode)))
                return -EFAULT;
 
        dev->agp->mode    = mode.mode;
@@ -205,10 +205,11 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp,
        DRM_AGP_MEM      *memory;
        unsigned long    pages;
        u32              type;
+       drm_agp_buffer_t __user *argp = (void __user *)arg;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
        if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS)))
                return -ENOMEM;
@@ -236,7 +237,7 @@ int DRM(agp_alloc)(struct inode *inode, struct file *filp,
        request.handle   = entry->handle;
        request.physical = memory->physical;
 
-       if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) {
+       if (copy_to_user(argp, &request, sizeof(request))) {
                dev->agp->memory       = entry->next;
                dev->agp->memory->prev = NULL;
                DRM(free_agp)(memory, pages);
@@ -290,7 +291,7 @@ int DRM(agp_unbind)(struct inode *inode, struct file *filp,
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
+       if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request)))
                return -EFAULT;
        if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
                return -EINVAL;
@@ -327,7 +328,7 @@ int DRM(agp_bind)(struct inode *inode, struct file *filp,
 
        if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
+       if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request)))
                return -EFAULT;
        if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
                return -EINVAL;
@@ -366,7 +367,7 @@ int DRM(agp_free)(struct inode *inode, struct file *filp,
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request)))
+       if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request)))
                return -EFAULT;
        if (!(entry = DRM(agp_lookup_entry)(dev, request.handle)))
                return -EINVAL;
index b9be554..6fa8623 100644 (file)
@@ -70,9 +70,10 @@ int DRM(order)( unsigned long size )
        int order;
        unsigned long tmp;
 
-       for ( order = 0, tmp = size ; tmp >>= 1 ; ++order );
+       for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++)
+               ;
 
-       if ( size & ~(1 << order) )
+       if (size & (size - 1))
                ++order;
 
        return order;
@@ -97,6 +98,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
        drm_map_t *map;
+       drm_map_t __user *argp = (void __user *)arg;
        drm_map_list_t *list;
 
        if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */
@@ -105,7 +107,7 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
        if ( !map )
                return -ENOMEM;
 
-       if ( copy_from_user( map, (drm_map_t *)arg, sizeof(*map) ) ) {
+       if ( copy_from_user( map, argp, sizeof(*map) ) ) {
                DRM(free)( map, sizeof(*map), DRM_MEM_MAPS );
                return -EFAULT;
        }
@@ -206,10 +208,10 @@ int DRM(addmap)( struct inode *inode, struct file *filp,
        list_add(&list->head, &dev->maplist->head);
        up(&dev->struct_sem);
 
-       if ( copy_to_user( (drm_map_t *)arg, map, sizeof(*map) ) )
+       if ( copy_to_user( argp, map, sizeof(*map) ) )
                return -EFAULT;
        if ( map->type != _DRM_SHM ) {
-               if ( copy_to_user( &((drm_map_t *)arg)->handle,
+               if ( copy_to_user( &argp->handle,
                                   &map->offset,
                                   sizeof(map->offset) ) )
                        return -EFAULT;
@@ -246,7 +248,7 @@ int DRM(rmmap)(struct inode *inode, struct file *filp,
        drm_map_t request;
        int found_maps = 0;
 
-       if (copy_from_user(&request, (drm_map_t *)arg,
+       if (copy_from_user(&request, (drm_map_t __user *)arg,
                           sizeof(request))) {
                return -EFAULT;
        }
@@ -388,10 +390,11 @@ 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, (drm_buf_desc_t *)arg,
+       if ( copy_from_user( &request, argp,
                             sizeof(request) ) )
                return -EFAULT;
 
@@ -528,7 +531,7 @@ int DRM(addbufs_agp)( struct inode *inode, struct file *filp,
        request.count = entry->buf_count;
        request.size = size;
 
-       if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) )
+       if ( copy_to_user( argp, &request, sizeof(request) ) )
                return -EFAULT;
 
        dma->flags = _DRM_DMA_USE_AGP;
@@ -561,11 +564,11 @@ 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 ( !dma ) return -EINVAL;
 
-       if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
-                            sizeof(request) ) )
+       if ( copy_from_user( &request, argp, sizeof(request) ) )
                return -EFAULT;
 
        count = request.count;
@@ -766,7 +769,7 @@ int DRM(addbufs_pci)( struct inode *inode, struct file *filp,
        request.count = entry->buf_count;
        request.size = size;
 
-       if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) )
+       if ( copy_to_user( argp, &request, sizeof(request) ) )
                return -EFAULT;
 
        atomic_dec( &dev->buf_alloc );
@@ -782,6 +785,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->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;
@@ -799,8 +803,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
 
        if ( !dma ) return -EINVAL;
 
-       if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
-                             sizeof(request) ) )
+       if ( copy_from_user( &request, argp, sizeof(request) ) )
                return -EFAULT;
 
        count = request.count;
@@ -876,7 +879,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
                buf->waiting = 0;
                buf->pending = 0;
                init_waitqueue_head( &buf->dma_wait );
-               buf->filp    = 0;
+               buf->filp    = NULL;
 
                buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T);
                buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T),
@@ -937,7 +940,7 @@ int DRM(addbufs_sg)( struct inode *inode, struct file *filp,
        request.count = entry->buf_count;
        request.size = size;
 
-       if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) )
+       if ( copy_to_user( argp, &request, sizeof(request) ) )
                return -EFAULT;
 
        dma->flags = _DRM_DMA_USE_SG;
@@ -966,7 +969,7 @@ int DRM(addbufs)( struct inode *inode, struct file *filp,
 {
        drm_buf_desc_t request;
 
-       if ( copy_from_user( &request, (drm_buf_desc_t *)arg,
+       if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg,
                             sizeof(request) ) )
                return -EFAULT;
 
@@ -1012,6 +1015,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_device_dma_t *dma = dev->dma;
        drm_buf_info_t request;
+       drm_buf_info_t __user *argp = (void __user *)arg;
        int i;
        int count;
 
@@ -1025,9 +1029,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
        ++dev->buf_use;         /* Can't allocate more after this call */
        spin_unlock( &dev->count_lock );
 
-       if ( copy_from_user( &request,
-                            (drm_buf_info_t *)arg,
-                            sizeof(request) ) )
+       if ( copy_from_user( &request, argp, sizeof(request) ) )
                return -EFAULT;
 
        for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
@@ -1039,7 +1041,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
        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 *to = &request.list[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,
@@ -1068,9 +1070,7 @@ int DRM(infobufs)( struct inode *inode, struct file *filp,
        }
        request.count = count;
 
-       if ( copy_to_user( (drm_buf_info_t *)arg,
-                          &request,
-                          sizeof(request) ) )
+       if ( copy_to_user( argp, &request, sizeof(request) ) )
                return -EFAULT;
 
        return 0;
@@ -1103,7 +1103,7 @@ int DRM(markbufs)( struct inode *inode, struct file *filp,
        if ( !dma ) return -EINVAL;
 
        if ( copy_from_user( &request,
-                            (drm_buf_desc_t *)arg,
+                            (drm_buf_desc_t __user *)arg,
                             sizeof(request) ) )
                return -EFAULT;
 
@@ -1150,7 +1150,7 @@ int DRM(freebufs)( struct inode *inode, struct file *filp,
        if ( !dma ) return -EINVAL;
 
        if ( copy_from_user( &request,
-                            (drm_buf_free_t *)arg,
+                            (drm_buf_free_t __user *)arg,
                             sizeof(request) ) )
                return -EFAULT;
 
@@ -1196,6 +1196,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
        drm_device_dma_t *dma = dev->dma;
+       drm_buf_map_t __user *argp = (void __user *)arg;
        int retcode = 0;
        const int zero = 0;
        unsigned long virtual;
@@ -1213,8 +1214,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
        dev->buf_use++;         /* Can't allocate more after this call */
        spin_unlock( &dev->count_lock );
 
-       if ( copy_from_user( &request, (drm_buf_map_t *)arg,
-                            sizeof(request) ) )
+       if ( copy_from_user( &request, argp, sizeof(request) ) )
                return -EFAULT;
 
        if ( request.count >= dma->buf_count ) {
@@ -1261,7 +1261,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
                        retcode = (signed long)virtual;
                        goto done;
                }
-               request.virtual = (void *)virtual;
+               request.virtual = (void __user *)virtual;
 
                for ( i = 0 ; i < dma->buf_count ; i++ ) {
                        if ( copy_to_user( &request.list[i].idx,
@@ -1295,7 +1295,7 @@ int DRM(mapbufs)( struct inode *inode, struct file *filp,
        request.count = dma->buf_count;
        DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode );
 
-       if ( copy_to_user( (drm_buf_map_t *)arg, &request, sizeof(request) ) )
+       if ( copy_to_user( argp, &request, sizeof(request) ) )
                return -EFAULT;
 
        return retcode;
index 79b200e..d8000cf 100644 (file)
@@ -214,12 +214,11 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp,
 {
        drm_file_t      *priv   = filp->private_data;
        drm_device_t    *dev    = priv->dev;
+       drm_ctx_priv_map_t __user *argp = (void __user *)arg;
        drm_ctx_priv_map_t request;
        drm_map_t *map;
 
-       if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
-                          sizeof(request)))
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
 
        down(&dev->struct_sem);
@@ -232,7 +231,7 @@ int DRM(getsareactx)(struct inode *inode, struct file *filp,
        up(&dev->struct_sem);
 
        request.handle = map->handle;
-       if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request)))
+       if (copy_to_user(argp, &request, sizeof(request)))
                return -EFAULT;
        return 0;
 }
@@ -260,7 +259,7 @@ int DRM(setsareactx)(struct inode *inode, struct file *filp,
        struct list_head *list;
 
        if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
+                          (drm_ctx_priv_map_t __user *)arg,
                           sizeof(request)))
                return -EFAULT;
 
@@ -363,10 +362,11 @@ int DRM(resctx)( struct inode *inode, struct file *filp,
                 unsigned int cmd, unsigned long arg )
 {
        drm_ctx_res_t res;
+       drm_ctx_t __user *argp = (void __user *)arg;
        drm_ctx_t ctx;
        int i;
 
-       if ( copy_from_user( &res, (drm_ctx_res_t *)arg, sizeof(res) ) )
+       if ( copy_from_user( &res, argp, sizeof(res) ) )
                return -EFAULT;
 
        if ( res.count >= DRM_RESERVED_CONTEXTS ) {
@@ -380,7 +380,7 @@ int DRM(resctx)( struct inode *inode, struct file *filp,
        }
        res.count = DRM_RESERVED_CONTEXTS;
 
-       if ( copy_to_user( (drm_ctx_res_t *)arg, &res, sizeof(res) ) )
+       if ( copy_to_user( argp, &res, sizeof(res) ) )
                return -EFAULT;
        return 0;
 }
@@ -402,9 +402,10 @@ int DRM(addctx)( struct inode *inode, struct file *filp,
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
        drm_ctx_list_t * ctx_entry;
+       drm_ctx_t __user *argp = (void __user *)arg;
        drm_ctx_t ctx;
 
-       if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+       if ( copy_from_user( &ctx, argp, sizeof(ctx) ) )
                return -EFAULT;
 
        ctx.handle = DRM(ctxbitmap_next)( dev );
@@ -437,7 +438,7 @@ int DRM(addctx)( struct inode *inode, struct file *filp,
        ++dev->ctx_count;
        up( &dev->ctxlist_sem );
 
-       if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) )
+       if ( copy_to_user( argp, &ctx, sizeof(ctx) ) )
                return -EFAULT;
        return 0;
 }
@@ -461,15 +462,16 @@ int DRM(modctx)( struct inode *inode, struct file *filp,
 int DRM(getctx)( struct inode *inode, struct file *filp,
                 unsigned int cmd, unsigned long arg )
 {
+       drm_ctx_t __user *argp = (void __user *)arg;
        drm_ctx_t ctx;
 
-       if ( copy_from_user( &ctx, (drm_ctx_t*)arg, sizeof(ctx) ) )
+       if ( copy_from_user( &ctx, argp, sizeof(ctx) ) )
                return -EFAULT;
 
        /* This is 0, because we don't handle any context flags */
        ctx.flags = 0;
 
-       if ( copy_to_user( (drm_ctx_t*)arg, &ctx, sizeof(ctx) ) )
+       if ( copy_to_user( argp, &ctx, sizeof(ctx) ) )
                return -EFAULT;
        return 0;
 }
@@ -492,7 +494,7 @@ int DRM(switchctx)( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_ctx_t ctx;
 
-       if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+       if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
                return -EFAULT;
 
        DRM_DEBUG( "%d\n", ctx.handle );
@@ -517,7 +519,7 @@ int DRM(newctx)( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_ctx_t ctx;
 
-       if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+       if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
                return -EFAULT;
 
        DRM_DEBUG( "%d\n", ctx.handle );
@@ -544,7 +546,7 @@ int DRM(rmctx)( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_ctx_t ctx;
 
-       if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) )
+       if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
                return -EFAULT;
 
        DRM_DEBUG( "%d\n", ctx.handle );
index 453da82..7212275 100644 (file)
@@ -214,7 +214,7 @@ int DRM(control)( struct inode *inode, struct file *filp,
 {
        drm_control_t ctl;
 
-       if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) )
+       if ( copy_from_user( &ctl, (drm_control_t __user *)arg, sizeof(ctl) ) )
                return -EFAULT;
 
        switch ( ctl.func ) {
index cf4f37c..389fc7e 100644 (file)
@@ -243,7 +243,7 @@ static drm_ioctl_desc_t               DRM(ioctls)[] = {
        [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)]       = { DRM(sg_free),     1, 1 },
 #endif
 
-#if __HAVE_VBL_IRQ
+#ifdef __HAVE_VBL_IRQ
        [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)]   = { DRM(wait_vblank), 0, 0 },
 #endif
 
@@ -741,12 +741,11 @@ module_exit( drm_cleanup );
 int DRM(version)( struct inode *inode, struct file *filp,
                  unsigned int cmd, unsigned long arg )
 {
+       drm_version_t __user *argp = (void __user *)arg;
        drm_version_t version;
        int len;
 
-       if ( copy_from_user( &version,
-                            (drm_version_t *)arg,
-                            sizeof(version) ) )
+       if ( copy_from_user( &version, argp, sizeof(version) ) )
                return -EFAULT;
 
 #define DRM_COPY( name, value )                                                \
@@ -766,9 +765,7 @@ int DRM(version)( struct inode *inode, struct file *filp,
        DRM_COPY( version.date, DRIVER_DATE );
        DRM_COPY( version.desc, DRIVER_DESC );
 
-       if ( copy_to_user( (drm_version_t *)arg,
-                          &version,
-                          sizeof(version) ) )
+       if ( copy_to_user( argp, &version, sizeof(version) ) )
                return -EFAULT;
        return 0;
 }
@@ -1048,7 +1045,7 @@ int DRM(lock)( struct inode *inode, struct file *filp,
 
        ++priv->lock_count;
 
-        if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
+        if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) )
                return -EFAULT;
 
         if ( lock.context == DRM_KERNEL_CONTEXT ) {
@@ -1161,7 +1158,7 @@ int DRM(unlock)( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_lock_t lock;
 
-       if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) )
+       if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) )
                return -EFAULT;
 
        if ( lock.context == DRM_KERNEL_CONTEXT ) {
@@ -1181,7 +1178,7 @@ int DRM(unlock)( struct inode *inode, struct file *filp,
         * agent to request it then we should just be able to
         * take it immediately and not eat the ioctl.
         */
-       dev->lock.filp = 0;
+       dev->lock.filp = NULL;
        {
                __volatile__ unsigned int *plock = &dev->lock.hw_lock->lock;
                unsigned int old, new, prev, ctx;
index 48ceabd..0aa0244 100644 (file)
@@ -141,7 +141,7 @@ unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait)
 
 #if !__HAVE_DRIVER_FOPS_READ
 /** No-op. */
-ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off)
+ssize_t DRM(read)(struct file *filp, char __user *buf, size_t count, loff_t *off)
 {
        return 0;
 }
index cbf2dbf..ef6532a 100644 (file)
@@ -53,16 +53,17 @@ int DRM(getunique)(struct inode *inode, struct file *filp,
 {
        drm_file_t       *priv   = filp->private_data;
        drm_device_t     *dev    = priv->dev;
+       drm_unique_t     __user *argp = (void __user *)arg;
        drm_unique_t     u;
 
-       if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u)))
+       if (copy_from_user(&u, argp, sizeof(u)))
                return -EFAULT;
        if (u.unique_len >= dev->unique_len) {
                if (copy_to_user(u.unique, dev->unique, dev->unique_len))
                        return -EFAULT;
        }
        u.unique_len = dev->unique_len;
-       if (copy_to_user((drm_unique_t *)arg, &u, sizeof(u)))
+       if (copy_to_user(argp, &u, sizeof(u)))
                return -EFAULT;
        return 0;
 }
@@ -91,7 +92,8 @@ int DRM(setunique)(struct inode *inode, struct file *filp,
 
        if (dev->unique_len || dev->unique) return -EBUSY;
 
-       if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) return -EFAULT;
+       if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u)))
+               return -EFAULT;
 
        if (!u.unique_len || u.unique_len > 1024) return -EINVAL;
 
@@ -171,13 +173,14 @@ int DRM(getmap)( struct inode *inode, struct file *filp,
 {
        drm_file_t   *priv = filp->private_data;
        drm_device_t *dev  = priv->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;
 
-       if (copy_from_user(&map, (drm_map_t *)arg, sizeof(map)))
+       if (copy_from_user(&map, argp, sizeof(map)))
                return -EFAULT;
        idx = map.offset;
 
@@ -208,7 +211,7 @@ int DRM(getmap)( struct inode *inode, struct file *filp,
        map.mtrr   = r_list->map->mtrr;
        up(&dev->struct_sem);
 
-       if (copy_to_user((drm_map_t *)arg, &map, sizeof(map))) return -EFAULT;
+       if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT;
        return 0;
 }
 
@@ -230,12 +233,13 @@ int DRM(getclient)( struct inode *inode, struct file *filp,
 {
        drm_file_t   *priv = filp->private_data;
        drm_device_t *dev  = priv->dev;
+       drm_client_t __user *argp = (void __user *)arg;
        drm_client_t client;
        drm_file_t   *pt;
        int          idx;
        int          i;
 
-       if (copy_from_user(&client, (drm_client_t *)arg, sizeof(client)))
+       if (copy_from_user(&client, argp, sizeof(client)))
                return -EFAULT;
        idx = client.idx;
        down(&dev->struct_sem);
@@ -253,7 +257,7 @@ int DRM(getclient)( struct inode *inode, struct file *filp,
        client.iocs  = pt->ioctl_count;
        up(&dev->struct_sem);
 
-       if (copy_to_user((drm_client_t *)arg, &client, sizeof(client)))
+       if (copy_to_user((drm_client_t __user *)arg, &client, sizeof(client)))
                return -EFAULT;
        return 0;
 }
@@ -294,7 +298,7 @@ int DRM(getstats)( struct inode *inode, struct file *filp,
 
        up(&dev->struct_sem);
 
-       if (copy_to_user((drm_stats_t *)arg, &stats, sizeof(stats)))
+       if (copy_to_user((drm_stats_t __user *)arg, &stats, sizeof(stats)))
                return -EFAULT;
        return 0;
 }
@@ -308,15 +312,16 @@ int DRM(setversion)(DRM_IOCTL_ARGS)
        drm_set_version_t sv;
        drm_set_version_t retv;
        int if_version;
+       drm_set_version_t __user *argp = (void __user *)data;
 
-       DRM_COPY_FROM_USER_IOCTL(sv, (drm_set_version_t *)data, sizeof(sv));
+       DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv));
 
        retv.drm_di_major = DRM_IF_MAJOR;
        retv.drm_di_minor = DRM_IF_MINOR;
        retv.drm_dd_major = DRIVER_MAJOR;
        retv.drm_dd_minor = DRIVER_MINOR;
 
-       DRM_COPY_TO_USER_IOCTL((drm_set_version_t *)data, retv, sizeof(sv));
+       DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv));
 
        if (sv.drm_di_major != -1) {
                if (sv.drm_di_major != DRM_IF_MAJOR ||
index 844ab32..d7dce3a 100644 (file)
@@ -75,7 +75,7 @@ static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
                struct drm_agp_mem *agpmem;
                struct page *page;
 
-#if __alpha__
+#ifdef __alpha__
                /*
                  * Adjust to a bus-relative address
                  */
index d4bc68b..7653559 100644 (file)
@@ -285,19 +285,19 @@ static unsigned long ffb_get_unmapped_area(struct file *filp,
        unsigned long addr = -ENOMEM;
 
        if (!map)
-               return get_unmapped_area(NULL, hint, len, pgoff, flags, 0);
+               return get_unmapped_area(NULL, hint, len, pgoff, flags);
 
        if (map->type == _DRM_FRAME_BUFFER ||
            map->type == _DRM_REGISTERS) {
 #ifdef HAVE_ARCH_FB_UNMAPPED_AREA
                addr = get_fb_unmapped_area(filp, hint, len, pgoff, flags);
 #else
-               addr = get_unmapped_area(NULL, hint, len, pgoff, flags, 0);
+               addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
 #endif
        } else if (map->type == _DRM_SHM && SHMLBA > PAGE_SIZE) {
                unsigned long slack = SHMLBA - PAGE_SIZE;
 
-               addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags, 0);
+               addr = get_unmapped_area(NULL, hint, len + slack, pgoff, flags);
                if (!(addr & ~PAGE_MASK)) {
                        unsigned long kvirt = (unsigned long) map->handle;
 
@@ -313,7 +313,7 @@ static unsigned long ffb_get_unmapped_area(struct file *filp,
                        }
                }
        } else {
-               addr = get_unmapped_area(NULL, hint, len, pgoff, flags, 0);
+               addr = get_unmapped_area(NULL, hint, len, pgoff, flags);
        }
 
        return addr;
index ed6a835..7802f51 100644 (file)
@@ -565,9 +565,10 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
        drm_device_t      *dev      = priv->dev;
        drm_device_dma_t  *dma      = dev->dma;
        int               retcode   = 0;
+       drm_dma_t         __user *argp = (void __user *)arg;
        drm_dma_t         d;
 
-       if (copy_from_user(&d, (drm_dma_t *)arg, sizeof(d)))
+       if (copy_from_user(&d, argp, sizeof(d)))
                return -EFAULT;
 
        if (d.send_count < 0 || d.send_count > dma->buf_count) {
@@ -597,7 +598,7 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd,
 
        DRM_DEBUG("%d returning, granted = %d\n",
                  current->pid, d.granted_count);
-       if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d)))
+       if (copy_to_user(argp, &d, sizeof(d)))
                return -EFAULT;
 
        return retcode;
@@ -720,7 +721,7 @@ int gamma_dma_init( struct inode *inode, struct file *filp,
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       if ( copy_from_user( &init, (drm_gamma_init_t *)arg, sizeof(init) ) )
+       if ( copy_from_user( &init, (drm_gamma_init_t __user *)arg, sizeof(init) ) )
                return -EFAULT;
 
        switch ( init.func ) {
@@ -789,7 +790,7 @@ int gamma_dma_copy( struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_gamma_copy_t copy;
 
-       if ( copy_from_user( &copy, (drm_gamma_copy_t *)arg, sizeof(copy) ) )
+       if ( copy_from_user( &copy, (drm_gamma_copy_t __user *)arg, sizeof(copy) ) )
                return -EFAULT;
 
        return gamma_do_copy_dma( dev, &copy );
@@ -804,12 +805,11 @@ int gamma_getsareactx(struct inode *inode, struct file *filp,
 {
        drm_file_t      *priv   = filp->private_data;
        drm_device_t    *dev    = priv->dev;
+       drm_ctx_priv_map_t __user *argp = (void __user *)arg;
        drm_ctx_priv_map_t request;
        drm_map_t *map;
 
-       if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
-                          sizeof(request)))
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
 
        down(&dev->struct_sem);
@@ -822,7 +822,7 @@ int gamma_getsareactx(struct inode *inode, struct file *filp,
        up(&dev->struct_sem);
 
        request.handle = map->handle;
-       if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request)))
+       if (copy_to_user(argp, &request, sizeof(request)))
                return -EFAULT;
        return 0;
 }
@@ -838,7 +838,7 @@ int gamma_setsareactx(struct inode *inode, struct file *filp,
        struct list_head *list;
 
        if (copy_from_user(&request,
-                          (drm_ctx_priv_map_t *)arg,
+                          (drm_ctx_priv_map_t __user *)arg,
                           sizeof(request)))
                return -EFAULT;
 
index fff7f06..800a69f 100644 (file)
@@ -171,7 +171,7 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
                /* Real error */
                DRM_ERROR("mmap error\n");
                retcode = (signed int)buf_priv->virtual;
-               buf_priv->virtual = 0;
+               buf_priv->virtual = NULL;
        }
        up_write( &current->mm->mmap_sem );
 
@@ -193,7 +193,7 @@ static int i810_unmap_buffer(drm_buf_t *buf)
        up_write(&current->mm->mmap_sem);
 
        buf_priv->currently_mapped = I810_BUF_UNMAPPED;
-       buf_priv->virtual = 0;
+       buf_priv->virtual = NULL;
 
        return retcode;
 }
@@ -459,7 +459,7 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg)
 {
 
        /* Get v1.1 init data */
-       if (copy_from_user(init, (drm_i810_pre12_init_t *)arg,
+       if (copy_from_user(init, (drm_i810_pre12_init_t __user *)arg,
                          sizeof(drm_i810_pre12_init_t))) {
                return -EFAULT;
        }
@@ -468,7 +468,7 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg)
 
                /* This is a v1.2 client, just get the v1.2 init data */
                DRM_INFO("Using POST v1.2 init.\n");
-               if (copy_from_user(init, (drm_i810_init_t *)arg,
+               if (copy_from_user(init, (drm_i810_init_t __user *)arg,
                                   sizeof(drm_i810_init_t))) {
                        return -EFAULT;
                }
@@ -497,7 +497,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
        int retcode = 0;
 
        /* Get only the init func */
-       if (copy_from_user(&init, (void *)arg, sizeof(drm_i810_init_func_t))) 
+       if (copy_from_user(&init, (void __user *)arg, sizeof(drm_i810_init_func_t))) 
                return -EFAULT;
 
        switch(init.func) {
@@ -521,7 +521,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
                default:
                case I810_INIT_DMA_1_4:
                        DRM_INFO("Using v1.4 init.\n");
-                       if (copy_from_user(&init, (drm_i810_init_t *)arg,
+                       if (copy_from_user(&init, (drm_i810_init_t __user *)arg,
                                          sizeof(drm_i810_init_t))) {
                                return -EFAULT;
                        }
@@ -1053,7 +1053,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
                                        dev_priv->sarea_priv;
        drm_i810_vertex_t vertex;
 
-       if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex)))
+       if (copy_from_user(&vertex, (drm_i810_vertex_t __user *)arg, sizeof(vertex)))
                return -EFAULT;
 
        if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1088,7 +1088,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
        drm_device_t *dev = priv->dev;
        drm_i810_clear_t clear;
 
-       if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear)))
+       if (copy_from_user(&clear, (drm_i810_clear_t __user *)arg, sizeof(clear)))
                return -EFAULT;
 
        if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1150,7 +1150,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
        drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
                                        dev_priv->sarea_priv;
 
-       if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d)))
+       if (copy_from_user(&d, (drm_i810_dma_t __user *)arg, sizeof(d)))
                return -EFAULT;
 
        if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1165,7 +1165,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
        DRM_DEBUG("i810_dma: %d returning %d, granted = %d\n",
                  current->pid, retcode, d.granted);
 
-       if (copy_to_user((drm_dma_t *)arg, &d, sizeof(d)))
+       if (copy_to_user((drm_dma_t __user *)arg, &d, sizeof(d)))
                return -EFAULT;
        sarea_priv->last_dispatch = (int) hw_status[5];
 
@@ -1263,7 +1263,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
                dev_priv->sarea_priv;
        drm_i810_mc_t mc;
 
-       if (copy_from_user(&mc, (drm_i810_mc_t *)arg, sizeof(mc)))
+       if (copy_from_user(&mc, (drm_i810_mc_t __user *)arg, sizeof(mc)))
                return -EFAULT;
 
 
@@ -1306,7 +1306,7 @@ int i810_ov0_info(struct inode *inode, struct file *filp,
 
        data.offset = dev_priv->overlay_offset;
        data.physical = dev_priv->overlay_physical;
-       if (copy_to_user((drm_i810_overlay_t *)arg,&data,sizeof(data)))
+       if (copy_to_user((drm_i810_overlay_t __user *)arg,&data,sizeof(data)))
                return -EFAULT;
        return 0;
 }
index 880b3be..5f8b8fd 100644 (file)
@@ -153,6 +153,7 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
        drm_i830_buf_priv_t *buf_priv = buf->dev_private;
        drm_i830_private_t *dev_priv = dev->dev_private;
        struct file_operations *old_fops;
+       unsigned long virtual;
        int retcode = 0;
 
        if(buf_priv->currently_mapped == I830_BUF_MAPPED) return -EINVAL;
@@ -161,17 +162,17 @@ static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
        old_fops = filp->f_op;
        filp->f_op = &i830_buffer_fops;
        dev_priv->mmap_buffer = buf;
-       buf_priv->virtual = (void __user *)do_mmap(filp, 0, buf->total,
-                                           PROT_READ|PROT_WRITE,
-                                           MAP_SHARED, 
-                                           buf->bus_address);
+       virtual = do_mmap(filp, 0, buf->total, PROT_READ|PROT_WRITE,
+                           MAP_SHARED, buf->bus_address);
        dev_priv->mmap_buffer = NULL;
        filp->f_op = old_fops;
-       if (IS_ERR(buf_priv->virtual)) {
+       if (IS_ERR((void *)virtual)) {          /* ugh */
                /* Real error */
                DRM_ERROR("mmap error\n");
-               retcode = PTR_ERR(buf_priv->virtual);
+               retcode = virtual;
                buf_priv->virtual = NULL;
+       } else {
+               buf_priv->virtual = (void __user *)virtual;
        }
        up_write( &current->mm->mmap_sem );
 
@@ -463,7 +464,7 @@ static int i830_dma_initialize(drm_device_t *dev,
 }
 
 int i830_dma_init(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long __user arg)
+                 unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
@@ -1315,7 +1316,7 @@ void i830_reclaim_buffers( struct file *filp )
 }
 
 int i830_flush_ioctl(struct inode *inode, struct file *filp, 
-                    unsigned int cmd, unsigned long __user arg)
+                    unsigned int cmd, unsigned long arg)
 {
        drm_file_t        *priv   = filp->private_data;
        drm_device_t      *dev    = priv->dev;
@@ -1330,7 +1331,7 @@ int i830_flush_ioctl(struct inode *inode, struct file *filp,
 }
 
 int i830_dma_vertex(struct inode *inode, struct file *filp,
-              unsigned int cmd, unsigned long __user arg)
+              unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
@@ -1365,7 +1366,7 @@ int i830_dma_vertex(struct inode *inode, struct file *filp,
 }
 
 int i830_clear_bufs(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long __user arg)
+                  unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
@@ -1392,7 +1393,7 @@ int i830_clear_bufs(struct inode *inode, struct file *filp,
 }
 
 int i830_swap_bufs(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long __user arg)
+                 unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
@@ -1435,7 +1436,7 @@ int i830_do_cleanup_pageflip( drm_device_t *dev )
 }
 
 int i830_flip_bufs(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long __user arg)
+                  unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->dev;
@@ -1456,7 +1457,7 @@ int i830_flip_bufs(struct inode *inode, struct file *filp,
 }
 
 int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
-               unsigned long __user arg)
+               unsigned long arg)
 {
        drm_file_t        *priv     = filp->private_data;
        drm_device_t      *dev      = priv->dev;
@@ -1470,7 +1471,7 @@ int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
 }
 
 int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
-               unsigned long __user arg)
+               unsigned long arg)
 {
        drm_file_t        *priv     = filp->private_data;
        drm_device_t      *dev      = priv->dev;
@@ -1507,7 +1508,7 @@ int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
 int i830_copybuf(struct inode *inode,
                 struct file *filp, 
                 unsigned int cmd,
-                unsigned long __user arg)
+                unsigned long arg)
 {
        /* Never copy - 2.4.x doesn't need it */
        return 0;
@@ -1522,7 +1523,7 @@ int i830_docopy(struct inode *inode, struct file *filp, unsigned int cmd,
 
 
 int i830_getparam( struct inode *inode, struct file *filp, unsigned int cmd,
-                     unsigned long __user arg )
+                     unsigned long arg )
 {
        drm_file_t        *priv     = filp->private_data;
        drm_device_t      *dev      = priv->dev;
@@ -1556,7 +1557,7 @@ int i830_getparam( struct inode *inode, struct file *filp, unsigned int cmd,
 
 
 int i830_setparam( struct inode *inode, struct file *filp, unsigned int cmd,
-                  unsigned long __user arg )
+                  unsigned long arg )
 {
        drm_file_t        *priv     = filp->private_data;
        drm_device_t      *dev      = priv->dev;
index b906708..362d66e 100644 (file)
@@ -121,7 +121,7 @@ int i830_wait_irq(drm_device_t *dev, int irq_nr)
 /* Needs the lock as it touches the ring.
  */
 int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd,
-                  unsigned long __user arg )
+                  unsigned long arg )
 {
        drm_file_t        *priv     = filp->private_data;
        drm_device_t      *dev      = priv->dev;
@@ -139,7 +139,7 @@ int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd,
                return -EINVAL;
        }
 
-       if (copy_from_user( &emit, (drm_i830_irq_emit_t *)arg, sizeof(emit) ))
+       if (copy_from_user( &emit, (drm_i830_irq_emit_t __user *)arg, sizeof(emit) ))
                return -EFAULT;
 
        result = i830_emit_irq( dev );
@@ -168,7 +168,7 @@ int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd,
                return -EINVAL;
        }
 
-       if (copy_from_user( &irqwait, (drm_i830_irq_wait_t *)arg, 
+       if (copy_from_user( &irqwait, (drm_i830_irq_wait_t __user *)arg, 
                            sizeof(irqwait) ))
                return -EFAULT;
 
index 5e5c407..76fbf71 100644 (file)
@@ -668,7 +668,7 @@ int mga_dma_init( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( init, (drm_mga_init_t *)data, sizeof(init) );
+       DRM_COPY_FROM_USER_IOCTL( init, (drm_mga_init_t __user *)data, sizeof(init) );
 
        switch ( init.func ) {
        case MGA_INIT_DMA:
@@ -693,7 +693,7 @@ int mga_dma_flush( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t *)data, sizeof(lock) );
+       DRM_COPY_FROM_USER_IOCTL( lock, (drm_lock_t __user *)data, sizeof(lock) );
 
        DRM_DEBUG( "%s%s%s\n",
                   (lock.flags & _DRM_LOCK_FLUSH) ?     "flush, " : "",
@@ -764,12 +764,13 @@ int mga_dma_buffers( DRM_IOCTL_ARGS )
        DRM_DEVICE;
        drm_device_dma_t *dma = dev->dma;
        drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private;
+       drm_dma_t __user *argp = (void __user *)data;
        drm_dma_t d;
        int ret = 0;
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *)data, sizeof(d) );
+       DRM_COPY_FROM_USER_IOCTL( d, argp, sizeof(d) );
 
        /* Please don't send us buffers.
         */
@@ -795,7 +796,7 @@ int mga_dma_buffers( DRM_IOCTL_ARGS )
                ret = mga_dma_get_buffers( filp, dev, &d );
        }
 
-       DRM_COPY_TO_USER_IOCTL( (drm_dma_t *)data, d, sizeof(d) );
+       DRM_COPY_TO_USER_IOCTL( argp, d, sizeof(d) );
 
        return ret;
 }
index 9898890..521d445 100644 (file)
@@ -343,7 +343,7 @@ typedef struct _drm_mga_blit {
 
 typedef struct drm_mga_getparam {
        int param;
-       void *value;
+       void __user *value;
 } drm_mga_getparam_t;
 
 #endif
index bf4b4d9..22d38b7 100644 (file)
@@ -632,7 +632,7 @@ int r128_cce_init( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( init, (drm_r128_init_t *)data, sizeof(init) );
+       DRM_COPY_FROM_USER_IOCTL( init, (drm_r128_init_t __user *)data, sizeof(init) );
 
        switch ( init.func ) {
        case R128_INIT_CCE:
@@ -675,7 +675,7 @@ int r128_cce_stop( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t *)data, sizeof(stop) );
+       DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t __user *)data, sizeof(stop) );
 
        /* Flush any pending CCE commands.  This ensures any outstanding
         * commands are exectuted by the engine before we turn it off.
@@ -912,11 +912,12 @@ int r128_cce_buffers( DRM_IOCTL_ARGS )
        DRM_DEVICE;
        drm_device_dma_t *dma = dev->dma;
        int ret = 0;
+       drm_dma_t __user *argp = (void __user *)data;
        drm_dma_t d;
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *) data, sizeof(d) );
+       DRM_COPY_FROM_USER_IOCTL( d, argp, sizeof(d) );
 
        /* Please don't send us buffers.
         */
@@ -940,7 +941,7 @@ int r128_cce_buffers( DRM_IOCTL_ARGS )
                ret = r128_cce_get_buffers( filp, dev, &d );
        }
 
-       DRM_COPY_TO_USER_IOCTL((drm_dma_t *) data, d, sizeof(d) );
+       DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d) );
 
        return ret;
 }
index ae51de3..0cba17d 100644 (file)
@@ -308,14 +308,14 @@ typedef struct drm_r128_depth {
                R128_READ_PIXELS        = 0x04
        } func;
        int n;
-       int *x;
-       int *y;
-       unsigned int *buffer;
-       unsigned char *mask;
+       int __user *x;
+       int __user *y;
+       unsigned int __user *buffer;
+       unsigned char __user *mask;
 } drm_r128_depth_t;
 
 typedef struct drm_r128_stipple {
-       unsigned int *mask;
+       unsigned int __user *mask;
 } drm_r128_stipple_t;
 
 typedef struct drm_r128_indirect {
@@ -339,7 +339,7 @@ typedef struct drm_r128_fullscreen {
 
 typedef struct drm_r128_getparam {
        int param;
-       void *value;
+       void __user *value;
 } drm_r128_getparam_t;
 
 #endif
index 6ec11b0..34ebcae 100644 (file)
@@ -1271,7 +1271,7 @@ int r128_cce_clear( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( clear, (drm_r128_clear_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( clear, (drm_r128_clear_t __user *) data,
                             sizeof(clear) );
 
        RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1386,7 +1386,7 @@ int r128_cce_vertex( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_r128_vertex_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_r128_vertex_t __user *) data,
                             sizeof(vertex) );
 
        DRM_DEBUG( "pid=%d index=%d count=%d discard=%d\n",
@@ -1447,7 +1447,7 @@ int r128_cce_indices( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( elts, (drm_r128_indices_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( elts, (drm_r128_indices_t __user *) data,
                             sizeof(elts) );
 
        DRM_DEBUG( "pid=%d buf=%d s=%d e=%d d=%d\n", DRM_CURRENTPID,
@@ -1512,7 +1512,7 @@ int r128_cce_blit( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( blit, (drm_r128_blit_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( blit, (drm_r128_blit_t __user *) data,
                             sizeof(blit) );
 
        DRM_DEBUG( "pid=%d index=%d\n", DRM_CURRENTPID, blit.idx );
@@ -1541,7 +1541,7 @@ int r128_cce_depth( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( depth, (drm_r128_depth_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( depth, (drm_r128_depth_t __user *) data,
                             sizeof(depth) );
 
        RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1571,7 +1571,7 @@ int r128_cce_stipple( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( stipple, (drm_r128_stipple_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( stipple, (drm_r128_stipple_t __user *) data,
                             sizeof(stipple) );
 
        if ( DRM_COPY_FROM_USER( &mask, stipple.mask,
@@ -1605,7 +1605,7 @@ int r128_cce_indirect( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( indirect, (drm_r128_indirect_t *) data,
+       DRM_COPY_FROM_USER_IOCTL( indirect, (drm_r128_indirect_t __user *) data,
                             sizeof(indirect) );
 
        DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n",
@@ -1674,7 +1674,7 @@ int r128_getparam( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( param, (drm_r128_getparam_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( param, (drm_r128_getparam_t __user *)data,
                             sizeof(param) );
 
        DRM_DEBUG( "pid=%d\n", DRM_CURRENTPID );
index e145c78..f696490 100644 (file)
@@ -1358,7 +1358,7 @@ int radeon_cp_init( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( init, (drm_radeon_init_t *)data, sizeof(init) );
+       DRM_COPY_FROM_USER_IOCTL( init, (drm_radeon_init_t __user *)data, sizeof(init) );
 
        switch ( init.func ) {
        case RADEON_INIT_CP:
@@ -1407,7 +1407,7 @@ int radeon_cp_stop( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( stop, (drm_radeon_cp_stop_t *)data, sizeof(stop) );
+       DRM_COPY_FROM_USER_IOCTL( stop, (drm_radeon_cp_stop_t __user *)data, sizeof(stop) );
 
        if (!dev_priv->cp_running)
                return 0;
@@ -1712,11 +1712,12 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
        DRM_DEVICE;
        drm_device_dma_t *dma = dev->dma;
        int ret = 0;
+       drm_dma_t __user *argp = (void __user *)data;
        drm_dma_t d;
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( d, (drm_dma_t *)data, sizeof(d) );
+       DRM_COPY_FROM_USER_IOCTL( d, argp, sizeof(d) );
 
        /* Please don't send us buffers.
         */
@@ -1740,7 +1741,7 @@ int radeon_cp_buffers( DRM_IOCTL_ARGS )
                ret = radeon_cp_get_buffers( filp, dev, &d );
        }
 
-       DRM_COPY_TO_USER_IOCTL( (drm_dma_t *)data, d, sizeof(d) );
+       DRM_COPY_TO_USER_IOCTL( argp, d, sizeof(d) );
 
        return ret;
 }
index 735e04e..e447308 100644 (file)
@@ -482,7 +482,7 @@ typedef struct drm_radeon_clear {
        unsigned int clear_depth;
        unsigned int color_mask;
        unsigned int depth_mask;   /* misnamed field:  should be stencil */
-       drm_radeon_clear_rect_t *depth_boxes;
+       drm_radeon_clear_rect_t __user *depth_boxes;
 } drm_radeon_clear_t;
 
 typedef struct drm_radeon_vertex {
@@ -508,9 +508,9 @@ typedef struct drm_radeon_vertex2 {
        int idx;                        /* Index of vertex buffer */
        int discard;                    /* Client finished with buffer? */
        int nr_states;
-       drm_radeon_state_t *state;
+       drm_radeon_state_t __user *state;
        int nr_prims;
-       drm_radeon_prim_t *prim;
+       drm_radeon_prim_t __user *prim;
 } drm_radeon_vertex2_t;
 
 /* v1.3 - obsoletes drm_radeon_vertex2
@@ -525,15 +525,15 @@ typedef struct drm_radeon_vertex2 {
  */
 typedef struct drm_radeon_cmd_buffer {
        int bufsz;
-       char *buf;
+       char __user *buf;
        int nbox;
-       drm_clip_rect_t *boxes;
+       drm_clip_rect_t __user *boxes;
 } drm_radeon_cmd_buffer_t;
 
 typedef struct drm_radeon_tex_image {
        unsigned int x, y;              /* Blit coordinates */
        unsigned int width, height;
-       const void *data;
+       const void __user *data;
 } drm_radeon_tex_image_t;
 
 typedef struct drm_radeon_texture {
@@ -542,11 +542,11 @@ typedef struct drm_radeon_texture {
        int format;
        int width;                      /* Texture image coordinates */
        int height;
-       drm_radeon_tex_image_t *image;
+       drm_radeon_tex_image_t __user *image;
 } drm_radeon_texture_t;
 
 typedef struct drm_radeon_stipple {
-       unsigned int *mask;
+       unsigned int __user *mask;
 } drm_radeon_stipple_t;
 
 typedef struct drm_radeon_indirect {
@@ -576,7 +576,7 @@ typedef struct drm_radeon_indirect {
 
 typedef struct drm_radeon_getparam {
        int param;
-       void *value;
+       void __user *value;
 } drm_radeon_getparam_t;
 
 /* 1.6: Set up a memory manager for regions of shared memory:
@@ -588,7 +588,7 @@ typedef struct drm_radeon_mem_alloc {
        int region;
        int alignment;
        int size;
-       int *region_offset;     /* offset from start of fb or GART */
+       int __user *region_offset;      /* offset from start of fb or GART */
 } drm_radeon_mem_alloc_t;
 
 typedef struct drm_radeon_mem_free {
@@ -606,7 +606,7 @@ typedef struct drm_radeon_mem_init_heap {
 /* 1.6: Userspace can request & wait on irq's:
  */
 typedef struct drm_radeon_irq_emit {
-       int *irq_seq;
+       int __user *irq_seq;
 } drm_radeon_irq_emit_t;
 
 typedef struct drm_radeon_irq_wait {
index 45eafd0..e24e0ec 100644 (file)
@@ -887,7 +887,7 @@ do {                                                                        \
 
 #define OUT_RING_USER_TABLE( tab, sz ) do {                    \
        int _size = (sz);                                       \
-       int *_tab = (tab);                                      \
+       int __user *_tab = (tab);                                       \
                                                                \
        if (write + _size > mask) {                             \
                int i = (mask+1) - write;                       \
index f503153..51d1949 100644 (file)
@@ -187,7 +187,7 @@ int radeon_irq_emit( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( emit, (drm_radeon_irq_emit_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( emit, (drm_radeon_irq_emit_t __user *)data,
                                  sizeof(emit) );
 
        result = radeon_emit_irq( dev );
@@ -214,7 +214,7 @@ int radeon_irq_wait( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( irqwait, (drm_radeon_irq_wait_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( irqwait, (drm_radeon_irq_wait_t __user*)data,
                                  sizeof(irqwait) );
 
        return radeon_wait_irq( dev, irqwait.irq_seq );
index 96b76ae..2899574 100644 (file)
@@ -233,7 +233,7 @@ int radeon_mem_alloc( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( alloc, (drm_radeon_mem_alloc_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( alloc, (drm_radeon_mem_alloc_t __user *)data,
                                  sizeof(alloc) );
 
        heap = get_heap( dev_priv, alloc.region );
@@ -275,7 +275,7 @@ int radeon_mem_free( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( memfree, (drm_radeon_mem_free_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( memfree, (drm_radeon_mem_free_t __user *)data,
                                  sizeof(memfree) );
 
        heap = get_heap( dev_priv, memfree.region );
@@ -305,7 +305,7 @@ int radeon_mem_init_heap( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( initheap, (drm_radeon_mem_init_heap_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( initheap, (drm_radeon_mem_init_heap_t __user *)data,
                                  sizeof(initheap) );
 
        heap = get_heap( dev_priv, initheap.region );
index b719354..984d745 100644 (file)
@@ -63,7 +63,7 @@ static __inline__ int radeon_check_and_fixup_offset( drm_radeon_private_t *dev_p
 
 static __inline__ int radeon_check_and_fixup_offset_user( drm_radeon_private_t *dev_priv,
                                                          drm_file_t *filp_priv,
-                                                         u32 *offset ) {
+                                                         u32 __user *offset ) {
        u32 off;
 
        DRM_GET_USER_UNCHECKED( off, offset );
@@ -79,7 +79,7 @@ static __inline__ int radeon_check_and_fixup_offset_user( drm_radeon_private_t *
 static __inline__ int radeon_check_and_fixup_packets( drm_radeon_private_t *dev_priv,
                                                      drm_file_t *filp_priv,
                                                      int id,
-                                                     u32 *data ) {
+                                                     u32 __user *data ) {
        switch ( id ) {
 
        case RADEON_EMIT_PP_MISC:
@@ -217,7 +217,8 @@ static __inline__ int radeon_check_and_fixup_packet3( drm_radeon_private_t *dev_
                                                      drm_file_t *filp_priv,
                                                      drm_radeon_cmd_buffer_t *cmdbuf,
                                                      unsigned int *cmdsz ) {
-       u32 tmp[4], *cmd = ( u32* )cmdbuf->buf;
+       u32 tmp[4];
+       u32 __user *cmd = (u32 __user *)cmdbuf->buf;
 
        if ( DRM_COPY_FROM_USER_UNCHECKED( tmp, cmd, sizeof( tmp ) ) ) {
                DRM_ERROR( "Failed to copy data from user space\n" );
@@ -1339,7 +1340,7 @@ static int radeon_cp_dispatch_texture( DRMFILE filp,
        drm_buf_t *buf;
        u32 format;
        u32 *buffer;
-       const u8 *data;
+       const u8 __user *data;
        int size, dwords, tex_width, blit_width;
        u32 height;
        int i;
@@ -1417,7 +1418,7 @@ static int radeon_cp_dispatch_texture( DRMFILE filp,
                 * update them for a multi-pass texture blit.
                 */
                height = image->height;
-               data = (const u8 *)image->data;
+               data = (const u8 __user *)image->data;
                
                size = height * blit_width;
 
@@ -1499,7 +1500,7 @@ static int radeon_cp_dispatch_texture( DRMFILE filp,
                /* Update the input parameters for next time */
                image->y += height;
                image->height -= height;
-               image->data = (const u8 *)image->data + size;
+               image->data = (const u8 __user *)image->data + size;
        } while (image->height > 0);
 
        /* Flush the pixel cache after the blit completes.  This ensures
@@ -1550,7 +1551,7 @@ int radeon_cp_clear( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( clear, (drm_radeon_clear_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( clear, (drm_radeon_clear_t __user *)data,
                             sizeof(clear) );
 
        RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -1671,7 +1672,7 @@ int radeon_cp_vertex( DRM_IOCTL_ARGS )
 
        DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex_t __user *)data,
                             sizeof(vertex) );
 
        DRM_DEBUG( "pid=%d index=%d count=%d discard=%d\n",
@@ -1762,7 +1763,7 @@ int radeon_cp_indices( DRM_IOCTL_ARGS )
 
        DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( elts, (drm_radeon_indices_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( elts, (drm_radeon_indices_t __user *)data,
                             sizeof(elts) );
 
        DRM_DEBUG( "pid=%d index=%d start=%d end=%d discard=%d\n",
@@ -1853,7 +1854,7 @@ int radeon_cp_texture( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( tex, (drm_radeon_texture_t *)data, sizeof(tex) );
+       DRM_COPY_FROM_USER_IOCTL( tex, (drm_radeon_texture_t __user *)data, sizeof(tex) );
 
        if ( tex.image == NULL ) {
                DRM_ERROR( "null texture image!\n" );
@@ -1861,7 +1862,7 @@ int radeon_cp_texture( DRM_IOCTL_ARGS )
        }
 
        if ( DRM_COPY_FROM_USER( &image,
-                            (drm_radeon_tex_image_t *)tex.image,
+                            (drm_radeon_tex_image_t __user *)tex.image,
                             sizeof(image) ) )
                return DRM_ERR(EFAULT);
 
@@ -1883,7 +1884,7 @@ int radeon_cp_stipple( DRM_IOCTL_ARGS )
 
        LOCK_TEST_WITH_RETURN( dev, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( stipple, (drm_radeon_stipple_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( stipple, (drm_radeon_stipple_t __user *)data,
                             sizeof(stipple) );
 
        if ( DRM_COPY_FROM_USER( &mask, stipple.mask, 32 * sizeof(u32) ) )
@@ -1913,7 +1914,7 @@ int radeon_cp_indirect( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( indirect, (drm_radeon_indirect_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( indirect, (drm_radeon_indirect_t __user *)data,
                             sizeof(indirect) );
 
        DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n",
@@ -1993,7 +1994,7 @@ int radeon_cp_vertex2( DRM_IOCTL_ARGS )
 
        DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex2_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( vertex, (drm_radeon_vertex2_t __user *)data,
                             sizeof(vertex) );
 
        DRM_DEBUG( "pid=%d index=%d discard=%d\n",
@@ -2086,7 +2087,7 @@ static int radeon_emit_packets(
 {
        int id = (int)header.packet.packet_id;
        int sz, reg;
-       int *data = (int *)cmdbuf->buf;
+       int __user *data = (int __user *)cmdbuf->buf;
        RING_LOCALS;
    
        if (id >= RADEON_MAX_STATE_PACKETS)
@@ -2121,7 +2122,7 @@ static __inline__ int radeon_emit_scalars(
        drm_radeon_cmd_buffer_t *cmdbuf )
 {
        int sz = header.scalars.count;
-       int *data = (int *)cmdbuf->buf;
+       int __user *data = (int __user *)cmdbuf->buf;
        int start = header.scalars.offset;
        int stride = header.scalars.stride;
        RING_LOCALS;
@@ -2145,7 +2146,7 @@ static __inline__ int radeon_emit_scalars2(
        drm_radeon_cmd_buffer_t *cmdbuf )
 {
        int sz = header.scalars.count;
-       int *data = (int *)cmdbuf->buf;
+       int __user *data = (int __user *)cmdbuf->buf;
        int start = ((unsigned int)header.scalars.offset) + 0x100;
        int stride = header.scalars.stride;
        RING_LOCALS;
@@ -2167,7 +2168,7 @@ static __inline__ int radeon_emit_vectors(
        drm_radeon_cmd_buffer_t *cmdbuf )
 {
        int sz = header.vectors.count;
-       int *data = (int *)cmdbuf->buf;
+       int __user *data = (int __user *)cmdbuf->buf;
        int start = header.vectors.offset;
        int stride = header.vectors.stride;
        RING_LOCALS;
@@ -2191,7 +2192,8 @@ static int radeon_emit_packet3( drm_device_t *dev,
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;
        unsigned int cmdsz;
-       int *cmd = (int *)cmdbuf->buf, ret;
+       int __user *cmd = (int __user *)cmdbuf->buf;
+       int ret;
        RING_LOCALS;
 
        DRM_DEBUG("\n");
@@ -2220,8 +2222,9 @@ static int radeon_emit_packet3_cliprect( drm_device_t *dev,
        drm_radeon_private_t *dev_priv = dev->dev_private;
        drm_clip_rect_t box;
        unsigned int cmdsz;
-       int *cmd = (int *)cmdbuf->buf, ret;
-       drm_clip_rect_t *boxes = cmdbuf->boxes;
+       int __user *cmd = (int __user *)cmdbuf->buf;
+       int ret;
+       drm_clip_rect_t __user *boxes = cmdbuf->boxes;
        int i = 0;
        RING_LOCALS;
 
@@ -2325,7 +2328,7 @@ int radeon_cp_cmdbuf( DRM_IOCTL_ARGS )
 
        DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( cmdbuf, (drm_radeon_cmd_buffer_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( cmdbuf, (drm_radeon_cmd_buffer_t __user *)data,
                             sizeof(cmdbuf) );
 
        RING_SPACE_TEST_WITH_RETURN( dev_priv );
@@ -2344,7 +2347,7 @@ int radeon_cp_cmdbuf( DRM_IOCTL_ARGS )
 
        while ( cmdbuf.bufsz >= sizeof(header) ) {
                
-               if (DRM_GET_USER_UNCHECKED( header.i, (int *)cmdbuf.buf )) {
+               if (DRM_GET_USER_UNCHECKED( header.i, (int __user *)cmdbuf.buf )) {
                        DRM_ERROR("__get_user %p\n", cmdbuf.buf);
                        return DRM_ERR(EFAULT);
                }
@@ -2455,7 +2458,7 @@ int radeon_cp_getparam( DRM_IOCTL_ARGS )
                return DRM_ERR(EINVAL);
        }
 
-       DRM_COPY_FROM_USER_IOCTL( param, (drm_radeon_getparam_t *)data,
+       DRM_COPY_FROM_USER_IOCTL( param, (drm_radeon_getparam_t __user *)data,
                             sizeof(param) );
 
        DRM_DEBUG( "pid=%d\n", DRM_CURRENTPID );
@@ -2530,7 +2533,7 @@ int radeon_cp_setparam( DRM_IOCTL_ARGS ) {
 
        DRM_GET_PRIV_WITH_RETURN( filp_priv, filp );
 
-       DRM_COPY_FROM_USER_IOCTL( sp, ( drm_radeon_setparam_t* )data,
+       DRM_COPY_FROM_USER_IOCTL( sp, ( drm_radeon_setparam_t __user * )data,
                                  sizeof( sp ) );
 
        switch( sp.param ) {
index 9a10785..5d29b40 100644 (file)
@@ -155,7 +155,7 @@ int sis_fb_init( DRM_IOCTL_ARGS )
        drm_sis_private_t *dev_priv = dev->dev_private;
        drm_sis_fb_t fb;
 
-       DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t *)data, sizeof(fb));
+       DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_fb_t __user *)data, sizeof(fb));
 
        if (dev_priv == NULL) {
                dev->dev_private = DRM(calloc)(1, sizeof(drm_sis_private_t),
@@ -179,6 +179,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS )
 {
        DRM_DEVICE;
        drm_sis_private_t *dev_priv = dev->dev_private;
+       drm_sis_mem_t __user *argp = (void __user *)data;
        drm_sis_mem_t fb;
        PMemBlock block;
        int retval = 0;
@@ -186,7 +187,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS )
        if (dev_priv == NULL || dev_priv->FBHeap == NULL)
                return DRM_ERR(EINVAL);
   
-       DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t *)data, sizeof(fb));
+       DRM_COPY_FROM_USER_IOCTL(fb, argp, sizeof(fb));
   
        block = mmAllocMem(dev_priv->FBHeap, fb.size, 0, 0);
        if (block) {
@@ -204,7 +205,7 @@ int sis_fb_alloc( DRM_IOCTL_ARGS )
                fb.free = 0;
        }
 
-       DRM_COPY_TO_USER_IOCTL((drm_sis_mem_t *)data, fb, sizeof(fb));
+       DRM_COPY_TO_USER_IOCTL(argp, fb, sizeof(fb));
 
        DRM_DEBUG("alloc fb, size = %d, offset = %d\n", fb.size, fb.offset);
 
@@ -220,7 +221,7 @@ int sis_fb_free( DRM_IOCTL_ARGS )
        if (dev_priv == NULL || dev_priv->FBHeap == NULL)
                return DRM_ERR(EINVAL);
 
-       DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t *)data, sizeof(fb));
+       DRM_COPY_FROM_USER_IOCTL(fb, (drm_sis_mem_t __user *)data, sizeof(fb));
 
        if (!mmBlockInHeap(dev_priv->FBHeap, (PMemBlock)fb.free))
                return DRM_ERR(EINVAL);
@@ -255,7 +256,7 @@ int sis_ioctl_agp_init( DRM_IOCTL_ARGS )
        if (dev_priv->AGPHeap != NULL)
                return DRM_ERR(EINVAL);
 
-       DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_agp_t *)data, sizeof(agp));
+       DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_agp_t __user *)data, sizeof(agp));
 
        dev_priv->AGPHeap = mmInit(agp.offset, agp.size);
 
@@ -268,6 +269,7 @@ int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS )
 {
        DRM_DEVICE;
        drm_sis_private_t *dev_priv = dev->dev_private;
+       drm_sis_mem_t __user *argp = (void __user *)data;
        drm_sis_mem_t agp;
        PMemBlock block;
        int retval = 0;
@@ -275,7 +277,7 @@ int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS )
        if (dev_priv == NULL || dev_priv->AGPHeap == NULL)
                return DRM_ERR(EINVAL);
   
-       DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_mem_t *)data, sizeof(agp));
+       DRM_COPY_FROM_USER_IOCTL(agp, argp, sizeof(agp));
   
        block = mmAllocMem(dev_priv->AGPHeap, agp.size, 0, 0);
        if (block) {
@@ -293,7 +295,7 @@ int sis_ioctl_agp_alloc( DRM_IOCTL_ARGS )
                agp.free = 0;
        }
 
-       DRM_COPY_TO_USER_IOCTL((drm_sis_mem_t *)data, agp, sizeof(agp));
+       DRM_COPY_TO_USER_IOCTL(argp, agp, sizeof(agp));
 
        DRM_DEBUG("alloc agp, size = %d, offset = %d\n", agp.size, agp.offset);
 
@@ -309,7 +311,7 @@ int sis_ioctl_agp_free( DRM_IOCTL_ARGS )
        if (dev_priv == NULL || dev_priv->AGPHeap == NULL)
                return DRM_ERR(EINVAL);
 
-       DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_mem_t *)data, sizeof(agp));
+       DRM_COPY_FROM_USER_IOCTL(agp, (drm_sis_mem_t __user *)data, sizeof(agp));
 
        if (!mmBlockInHeap(dev_priv->AGPHeap, (PMemBlock)agp.free))
                return DRM_ERR(EINVAL);
index e6ad246..e8f15f4 100644 (file)
@@ -128,10 +128,6 @@ static ssize_t dtlk_read(struct file *file, char __user *buf,
        char ch;
        int i = 0, retries;
 
-       /* Can't seek (pread) on the DoubleTalk.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        TRACE_TEXT("(dtlk_read");
        /*  printk("DoubleTalk PC - dtlk_read()\n"); */
 
@@ -180,10 +176,6 @@ static ssize_t dtlk_write(struct file *file, const char __user *buf,
        }
 #endif
 
-       /* Can't seek (pwrite) on the DoubleTalk.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (iminor(file->f_dentry->d_inode) != DTLK_MINOR)
                return -EINVAL;
 
@@ -303,11 +295,12 @@ static int dtlk_open(struct inode *inode, struct file *file)
 {
        TRACE_TEXT("(dtlk_open");
 
+       nonseekable_open(inode, file);
        switch (iminor(inode)) {
        case DTLK_MINOR:
                if (dtlk_busy)
                        return -EBUSY;
-               return 0;
+               return nonseekable_open(inode, file);
 
        default:
                return -ENXIO;
index c5b0106..663a1e2 100644 (file)
@@ -933,7 +933,7 @@ static int startup(struct esp_struct * info)
                else if (request_dma(dma, "esp serial")) {
                        free_pages((unsigned long)dma_buffer,
                                   get_order(DMA_BUFFER_SZ));
-                       dma_buffer = 0;
+                       dma_buffer = NULL;
                        info->stat_flags |= ESP_STAT_USE_PIO;
                }
                        
@@ -1038,13 +1038,13 @@ static void shutdown(struct esp_struct * info)
                        free_dma(dma);
                        free_pages((unsigned long)dma_buffer,
                                   get_order(DMA_BUFFER_SZ));
-                       dma_buffer = 0;
+                       dma_buffer = NULL;
                }               
        }
 
        if (info->xmit_buf) {
                free_page((unsigned long) info->xmit_buf);
-               info->xmit_buf = 0;
+               info->xmit_buf = NULL;
        }
 
        info->IER = 0;
@@ -1435,12 +1435,10 @@ static void rs_unthrottle(struct tty_struct * tty)
  */
 
 static int get_serial_info(struct esp_struct * info,
-                          struct serial_struct retinfo)
+                          struct serial_struct __user *retinfo)
 {
        struct serial_struct tmp;
   
-       if (!retinfo)
-               return -EFAULT;
        memset(&tmp, 0, sizeof(tmp));
        tmp.type = PORT_16550A;
        tmp.line = info->line;
@@ -1459,7 +1457,7 @@ static int get_serial_info(struct esp_struct * info,
 }
 
 static int get_esp_config(struct esp_struct * info,
-                         struct hayes_esp_config retinfo)
+                         struct hayes_esp_config __user *retinfo)
 {
        struct hayes_esp_config tmp;
   
@@ -1479,7 +1477,7 @@ static int get_esp_config(struct esp_struct * info,
 }
 
 static int set_serial_info(struct esp_struct * info,
-                          struct serial_struct new_info)
+                          struct serial_struct __user *new_info)
 {
        struct serial_struct new_serial;
        struct esp_struct old_info;
@@ -1594,7 +1592,7 @@ static int set_serial_info(struct esp_struct * info,
 }
 
 static int set_esp_config(struct esp_struct * info,
-                         struct hayes_esp_config * new_info)
+                         struct hayes_esp_config __user * new_info)
 {
        struct hayes_esp_config new_config;
        unsigned int change_dma;
@@ -1739,7 +1737,7 @@ static int set_esp_config(struct esp_struct * info,
  *         transmit holding register is empty.  This functionality
  *         allows an RS485 driver to be written in user space. 
  */
-static int get_lsr_info(struct esp_struct * info, unsigned int *value)
+static int get_lsr_info(struct esp_struct * info, unsigned int __user *value)
 {
        unsigned char status;
        unsigned int result;
@@ -1834,7 +1832,8 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
 {
        struct esp_struct * info = (struct esp_struct *)tty->driver_data;
        struct async_icount cprev, cnow;        /* kernel counter temps */
-       struct serial_icounter_struct *p_cuser; /* user space */
+       struct serial_icounter_struct __user *p_cuser;  /* user space */
+       void __user *argp = (void __user *)arg;
 
        if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
                return -ENODEV;
@@ -1850,20 +1849,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
        
        switch (cmd) {
                case TIOCGSERIAL:
-                       return get_serial_info(info,
-                                              (struct serial_struct *) arg);
+                       return get_serial_info(info, argp);
                case TIOCSSERIAL:
-                       return set_serial_info(info,
-                                              (struct serial_struct *) arg);
+                       return set_serial_info(info, argp);
                case TIOCSERCONFIG:
                        /* do not reconfigure after initial configuration */
                        return 0;
 
                case TIOCSERGWILD:
-                       return put_user(0L, (unsigned long *) arg);
+                       return put_user(0L, (unsigned long __user *)argp);
 
                case TIOCSERGETLSR: /* Get line status register */
-                           return get_lsr_info(info, (unsigned int *) arg);
+                           return get_lsr_info(info, argp);
 
                case TIOCSERSWILD:
                        if (!capable(CAP_SYS_ADMIN))
@@ -1917,7 +1914,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
                        cli();
                        cnow = info->icount;
                        sti();
-                       p_cuser = (struct serial_icounter_struct *) arg;
+                       p_cuser = argp;
                        if (put_user(cnow.cts, &p_cuser->cts) ||
                            put_user(cnow.dsr, &p_cuser->dsr) ||
                            put_user(cnow.rng, &p_cuser->rng) ||
@@ -1926,9 +1923,9 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
 
                        return 0;
        case TIOCGHAYESESP:
-               return (get_esp_config(info, (struct hayes_esp_config *)arg));
+               return get_esp_config(info, argp);
        case TIOCSHAYESESP:
-               return (set_esp_config(info, (struct hayes_esp_config *)arg));
+               return set_esp_config(info, argp);
 
                default:
                        return -ENOIOCTLCMD;
@@ -2076,7 +2073,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
                tty->ldisc.flush_buffer(tty);
        tty->closing = 0;
        info->event = 0;
-       info->tty = 0;
+       info->tty = NULL;
 
        if (info->blocked_open) {
                if (info->close_delay) {
@@ -2144,7 +2141,7 @@ static void esp_hangup(struct tty_struct *tty)
        info->event = 0;
        info->count = 0;
        info->flags &= ~ASYNC_NORMAL_ACTIVE;
-       info->tty = 0;
+       info->tty = NULL;
        wake_up_interruptible(&info->open_wait);
 }
 
@@ -2446,7 +2443,7 @@ int __init espserial_init(void)
        int i, offset;
        int region_start;
        struct esp_struct * info;
-       struct esp_struct *last_primary = 0;
+       struct esp_struct *last_primary = NULL;
        int esp[] = {0x100,0x140,0x180,0x200,0x240,0x280,0x300,0x380};
 
        esp_driver = alloc_tty_driver(NR_PORTS);
index 518e704..17a7f0e 100644 (file)
@@ -90,7 +90,7 @@ KERN_INFO "Compiled for Linux version %s\n", UTS_RELEASE);
        TRACE(ft_t_info, "ftape_init @ 0x%p", ftape_init);
        /*  Allocate the DMA buffers. They are deallocated at cleanup() time.
         */
-#if TESTING
+#ifdef TESTING
 #ifdef MODULE
        while (ftape_set_nr_buffers(CONFIG_FT_NR_BUFFERS) < 0) {
                ftape_sleep(FT_SECOND/20);
index 36e1cb4..266fe40 100644 (file)
@@ -469,7 +469,7 @@ static int __init gen_rtc_proc_init(void)
 {
        struct proc_dir_entry *r;
 
-       r = create_proc_read_entry("driver/rtc", 0, 0, gen_rtc_read_proc, NULL);
+       r = create_proc_read_entry("driver/rtc", 0, NULL, gen_rtc_read_proc, NULL);
        if (!r)
                return -ENOMEM;
        return 0;
index d5c1853..ac97e61 100644 (file)
@@ -203,16 +203,16 @@ static void ip2_wait_until_sent(PTTY,int);
 
 static void set_params (i2ChanStrPtr, struct termios *);
 static int set_modem_info(i2ChanStrPtr, unsigned int, unsigned int *);
-static int get_serial_info(i2ChanStrPtr, struct serial_struct *);
-static int set_serial_info(i2ChanStrPtr, struct serial_struct *);
+static int get_serial_info(i2ChanStrPtr, struct serial_struct __user *);
+static int set_serial_info(i2ChanStrPtr, struct serial_struct __user *);
 
-static ssize_t ip2_ipl_read(struct file *, char *, size_t, loff_t *);
-static ssize_t ip2_ipl_write(struct file *, const char *, size_t, loff_t *);
+static ssize_t ip2_ipl_read(struct file *, char __user *, size_t, loff_t *);
+static ssize_t ip2_ipl_write(struct file *, const char __user *, size_t, loff_t *);
 static int ip2_ipl_ioctl(struct inode *, struct file *, UINT, ULONG);
 static int ip2_ipl_open(struct inode *, struct file *);
 
-static int DumpTraceBuffer(char *, int);
-static int DumpFifoBuffer( char *, int);
+static int DumpTraceBuffer(char __user *, int);
+static int DumpFifoBuffer( char __user *, int);
 
 static void ip2_init_board(int);
 static unsigned short find_eisa_board(int);
@@ -1121,7 +1121,7 @@ set_irq( int boardnum, int boardIrq )
 /******************************************************************************/
 
 static inline void
-service_all_boards()
+service_all_boards(void)
 {
        int i;
        i2eBordStrPtr  pB;
@@ -2082,9 +2082,10 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
        wait_queue_t wait;
        i2ChanStrPtr pCh = DevTable[tty->index];
        struct async_icount cprev, cnow;        /* kernel counter temps */
-       struct serial_icounter_struct *p_cuser; /* user space */
+       struct serial_icounter_struct __user *p_cuser;
        int rc = 0;
        unsigned long flags;
+       void __user *argp = (void __user *)arg;
 
        if ( pCh == NULL ) {
                return -ENODEV;
@@ -2101,7 +2102,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
 
                ip2trace (CHANN, ITRC_IOCTL, 2, 1, rc );
 
-               rc = get_serial_info(pCh, (struct serial_struct *) arg);
+               rc = get_serial_info(pCh, argp);
                if (rc)
                        return rc;
                break;
@@ -2110,7 +2111,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
 
                ip2trace (CHANN, ITRC_IOCTL, 3, 1, rc );
 
-               rc = set_serial_info(pCh, (struct serial_struct *) arg);
+               rc = set_serial_info(pCh, argp);
                if (rc)
                        return rc;
                break;
@@ -2174,7 +2175,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
 
                ip2trace (CHANN, ITRC_IOCTL, 6, 1, rc );
 
-                       rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg);
+                       rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp);
                if (rc) 
                        return rc;
        break;
@@ -2183,7 +2184,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
 
                ip2trace (CHANN, ITRC_IOCTL, 7, 1, rc );
 
-               rc = get_user(arg,(unsigned long *) arg);
+               rc = get_user(arg,(unsigned long __user *) argp);
                if (rc) 
                        return rc;
                tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL)
@@ -2262,7 +2263,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
                save_flags(flags);cli();
                cnow = pCh->icount;
                restore_flags(flags);
-               p_cuser = (struct serial_icounter_struct *) arg;
+               p_cuser = argp;
                rc = put_user(cnow.cts, &p_cuser->cts);
                rc = put_user(cnow.dsr, &p_cuser->dsr);
                rc = put_user(cnow.rng, &p_cuser->rng);
@@ -2311,14 +2312,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
 /* standard Linux serial structure.                                           */
 /******************************************************************************/
 static int
-get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo )
+get_serial_info ( i2ChanStrPtr pCh, struct serial_struct __user *retinfo )
 {
        struct serial_struct tmp;
-       int rc;
-
-       if ( !retinfo ) {
-               return -EFAULT;
-       }
 
        memset ( &tmp, 0, sizeof(tmp) );
        tmp.type = pCh->pMyBord->channelBtypes.bid_value[(pCh->port_index & (IP2_PORTS_PER_BOARD-1))/16];
@@ -2335,8 +2331,7 @@ get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo )
        tmp.close_delay = pCh->ClosingDelay;
        tmp.closing_wait = pCh->ClosingWaitTime;
        tmp.custom_divisor = pCh->BaudDivisor;
-       rc = copy_to_user(retinfo,&tmp,sizeof(*retinfo));
-   return rc;
+       return copy_to_user(retinfo,&tmp,sizeof(*retinfo));
 }
 
 /******************************************************************************/
@@ -2351,18 +2346,13 @@ get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo )
 /* change the IRQ, address or type of the port the ioctl fails.               */
 /******************************************************************************/
 static int
-set_serial_info( i2ChanStrPtr pCh, struct serial_struct *new_info )
+set_serial_info( i2ChanStrPtr pCh, struct serial_struct __user *new_info )
 {
        struct serial_struct ns;
        int   old_flags, old_baud_divisor;
 
-       if ( !new_info ) {
+       if (copy_from_user(&ns, new_info, sizeof (ns)))
                return -EFAULT;
-       }
-
-       if (copy_from_user(&ns, new_info, sizeof (ns))) {
-               return -EFAULT;
-       }
 
        /*
         * We don't allow setserial to change IRQ, board address, type or baud
@@ -2727,7 +2717,7 @@ service_it:
 
 static 
 ssize_t
-ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off )
+ip2_ipl_read(struct file *pFile, char __user *pData, size_t count, loff_t *off )
 {
        unsigned int minor = iminor(pFile->f_dentry->d_inode);
        int rc = 0;
@@ -2760,7 +2750,7 @@ ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off )
 }
 
 static int
-DumpFifoBuffer ( char *pData, int count )
+DumpFifoBuffer ( char __user *pData, int count )
 {
 #ifdef DEBUG_FIFO
        int rc;
@@ -2774,13 +2764,13 @@ DumpFifoBuffer ( char *pData, int count )
 }
 
 static int
-DumpTraceBuffer ( char *pData, int count )
+DumpTraceBuffer ( char __user *pData, int count )
 {
 #ifdef IP2DEBUG_TRACE
        int rc;
        int dumpcount;
        int chunk;
-       int *pIndex = (int*)pData;
+       int *pIndex = (int __user *)pData;
 
        if ( count < (sizeof(int) * 6) ) {
                return -EIO;
@@ -2836,7 +2826,7 @@ DumpTraceBuffer ( char *pData, int count )
 /*                                                                            */
 /******************************************************************************/
 static ssize_t
-ip2_ipl_write(struct file *pFile, const char *pData, size_t count, loff_t *off)
+ip2_ipl_write(struct file *pFile, const char __user *pData, size_t count, loff_t *off)
 {
 #ifdef IP2DEBUG_IPL
        printk (KERN_DEBUG "IP2IPL: write %p, %d bytes\n", pData, count );
@@ -2861,7 +2851,8 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
 {
        unsigned int iplminor = iminor(pInode);
        int rc = 0;
-       ULONG *pIndex = (ULONG*)arg;
+       void __user *argp = (void __user *)arg;
+       ULONG __user *pIndex = argp;
        i2eBordStrPtr pB = i2BoardPtrTable[iplminor / 4];
        i2ChanStrPtr pCh;
 
@@ -2886,9 +2877,9 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
 
                case 65:        /* Board  - ip2stat */
                        if ( pB ) {
-                               rc = copy_to_user((char*)arg, (char*)pB, sizeof(i2eBordStr) );
+                               rc = copy_to_user(argp, pB, sizeof(i2eBordStr));
                                rc = put_user(INB(pB->i2eStatus),
-                                       (ULONG*)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) );
+                                       (ULONG __user *)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) );
                        } else {
                                rc = -ENODEV;
                        }
@@ -2899,7 +2890,7 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
                                pCh = DevTable[cmd];
                                if ( pCh )
                                {
-                                       rc = copy_to_user((char*)arg, (char*)pCh, sizeof(i2ChanStr) );
+                                       rc = copy_to_user(argp, pCh, sizeof(i2ChanStr));
                                } else {
                                        rc = -ENODEV;
                                }
index 0a2eeba..8d1a08b 100644 (file)
@@ -174,7 +174,7 @@ static int handle_send_req(ipmi_user_t     user,
 {
        int              rv;
        struct ipmi_addr addr;
-       unsigned char    *msgdata;
+       struct kernel_ipmi_msg msg;
 
        if (req->addr_len > sizeof(struct ipmi_addr))
                return -EINVAL;
@@ -182,8 +182,11 @@ static int handle_send_req(ipmi_user_t     user,
        if (copy_from_user(&addr, req->addr, req->addr_len))
                return -EFAULT;
 
-       msgdata = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
-       if (!msgdata)
+       msg.netfn = req->msg.netfn;
+       msg.cmd = req->msg.cmd;
+       msg.data_len = req->msg.data_len;
+       msg.data = kmalloc(IPMI_MAX_MSG_LENGTH, GFP_KERNEL);
+       if (!msg.data)
                return -ENOMEM;
 
        /* From here out we cannot return, we must jump to "out" for
@@ -199,7 +202,7 @@ static int handle_send_req(ipmi_user_t     user,
                        goto out;
                }
 
-               if (copy_from_user(msgdata,
+               if (copy_from_user(msg.data,
                                   req->msg.data,
                                   req->msg.data_len))
                {
@@ -207,20 +210,19 @@ static int handle_send_req(ipmi_user_t     user,
                        goto out;
                }
        } else {
-               req->msg.data_len = 0;
+               msg.data_len = 0;
        }
-       req->msg.data = msgdata;
 
        rv = ipmi_request_settime(user,
                                  &addr,
                                  req->msgid,
-                                 &(req->msg),
+                                 &msg,
                                  NULL,
                                  0,
                                  retries,
                                  retry_time_ms);
  out:
-       kfree(msgdata);
+       kfree(msg.data);
        return rv;
 }
 
index 8a82e6e..83ae6f5 100644 (file)
@@ -907,7 +907,7 @@ ipmb_checksum(unsigned char *data, int size)
 }
 
 static inline void format_ipmb_msg(struct ipmi_smi_msg   *smi_msg,
-                                  struct ipmi_msg       *msg,
+                                  struct kernel_ipmi_msg *msg,
                                   struct ipmi_ipmb_addr *ipmb_addr,
                                   long                  msgid,
                                   unsigned char         ipmb_seq,
@@ -949,7 +949,7 @@ static inline void format_ipmb_msg(struct ipmi_smi_msg   *smi_msg,
 }
 
 static inline void format_lan_msg(struct ipmi_smi_msg   *smi_msg,
-                                 struct ipmi_msg       *msg,
+                                 struct kernel_ipmi_msg *msg,
                                  struct ipmi_lan_addr  *lan_addr,
                                  long                  msgid,
                                  unsigned char         ipmb_seq,
@@ -993,7 +993,7 @@ static inline int i_ipmi_request(ipmi_user_t          user,
                                 ipmi_smi_t           intf,
                                 struct ipmi_addr     *addr,
                                 long                 msgid,
-                                struct ipmi_msg      *msg,
+                                struct kernel_ipmi_msg *msg,
                                 void                 *user_msg_data,
                                 void                 *supplied_smi,
                                 struct ipmi_recv_msg *supplied_recv,
@@ -1335,7 +1335,7 @@ static inline int i_ipmi_request(ipmi_user_t          user,
                goto out_err;
        }
 
-#if DEBUG_MSGING
+#ifdef DEBUG_MSGING
        {
                int m;
                for (m=0; m<smi_msg->data_size; m++)
@@ -1356,7 +1356,7 @@ static inline int i_ipmi_request(ipmi_user_t          user,
 int ipmi_request(ipmi_user_t      user,
                 struct ipmi_addr *addr,
                 long             msgid,
-                struct ipmi_msg  *msg,
+                struct kernel_ipmi_msg  *msg,
                 void             *user_msg_data,
                 int              priority)
 {
@@ -1376,7 +1376,7 @@ int ipmi_request(ipmi_user_t      user,
 int ipmi_request_settime(ipmi_user_t      user,
                         struct ipmi_addr *addr,
                         long             msgid,
-                        struct ipmi_msg  *msg,
+                        struct kernel_ipmi_msg  *msg,
                         void             *user_msg_data,
                         int              priority,
                         int              retries,
@@ -1399,7 +1399,7 @@ int ipmi_request_settime(ipmi_user_t      user,
 int ipmi_request_supply_msgs(ipmi_user_t          user,
                             struct ipmi_addr     *addr,
                             long                 msgid,
-                            struct ipmi_msg      *msg,
+                            struct kernel_ipmi_msg *msg,
                             void                 *user_msg_data,
                             void                 *supplied_smi,
                             struct ipmi_recv_msg *supplied_recv,
@@ -1422,7 +1422,7 @@ int ipmi_request_supply_msgs(ipmi_user_t          user,
 int ipmi_request_with_source(ipmi_user_t      user,
                             struct ipmi_addr *addr,
                             long             msgid,
-                            struct ipmi_msg  *msg,
+                            struct kernel_ipmi_msg  *msg,
                             void             *user_msg_data,
                             int              priority,
                             unsigned char    source_address,
@@ -1609,7 +1609,7 @@ static void remove_proc_entries(ipmi_smi_t smi)
 static int
 send_channel_info_cmd(ipmi_smi_t intf, int chan)
 {
-       struct ipmi_msg                   msg;
+       struct kernel_ipmi_msg            msg;
        unsigned char                     data[1];
        struct ipmi_system_interface_addr si;
 
@@ -2033,7 +2033,7 @@ static int handle_ipmb_get_msg_cmd(ipmi_smi_t          intf,
                msg->data[10] = ipmb_checksum(&(msg->data[6]), 4);
                msg->data_size = 11;
 
-#if DEBUG_MSGING
+#ifdef DEBUG_MSGING
        {
                int m;
                printk("Invalid command:");
@@ -2424,7 +2424,7 @@ static int handle_new_recv_msg(ipmi_smi_t          intf,
        int requeue;
        int chan;
 
-#if DEBUG_MSGING
+#ifdef DEBUG_MSGING
        int m;
        printk("Recv:");
        for (m=0; m<msg->rsp_size; m++)
@@ -2639,7 +2639,7 @@ send_from_recv_msg(ipmi_smi_t intf, struct ipmi_recv_msg *recv_msg,
           MC, which don't get resent. */
        intf->handlers->sender(intf->send_info, smi_msg, 0);
 
-#if DEBUG_MSGING
+#ifdef DEBUG_MSGING
        {
                int m;
                printk("Resend: ");
@@ -2873,7 +2873,7 @@ static void device_id_fetcher(ipmi_smi_t intf, struct ipmi_smi_msg *msg)
 
 static void send_panic_events(char *str)
 {
-       struct ipmi_msg                   msg;
+       struct kernel_ipmi_msg            msg;
        ipmi_smi_t                        intf;
        unsigned char                     data[16];
        int                               i;
@@ -3098,7 +3098,7 @@ static struct notifier_block panic_block = {
        200   /* priority: INT_MAX >= x >= 0 */
 };
 
-static __init int ipmi_init_msghandler(void)
+static int ipmi_init_msghandler(void)
 {
        int i;
 
@@ -3133,6 +3133,12 @@ static __init int ipmi_init_msghandler(void)
        return 0;
 }
 
+static __init int ipmi_init_msghandler_mod(void)
+{
+       ipmi_init_msghandler();
+       return 0;
+}
+
 static __exit void cleanup_ipmi(void)
 {
        int count;
@@ -3169,7 +3175,7 @@ static __exit void cleanup_ipmi(void)
 }
 module_exit(cleanup_ipmi);
 
-module_init(ipmi_init_msghandler);
+module_init(ipmi_init_msghandler_mod);
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(ipmi_alloc_recv_msg);
index 348c359..ea330f3 100644 (file)
@@ -51,7 +51,7 @@
 #include <linux/list.h>
 #include <linux/pci.h>
 #include <linux/ioport.h>
-#include <linux/irq.h>
+#include <asm/irq.h>
 #ifdef CONFIG_HIGH_RES_TIMERS
 #include <linux/hrtime.h>
 # if defined(schedule_next_int)
@@ -1132,7 +1132,7 @@ static int try_init_mem(int intf_num, struct smi_info **new_info)
 static int acpi_failure = 0;
 
 /* For GPE-type interrupts. */
-u32 ipmi_acpi_gpe(void *context)
+void ipmi_acpi_gpe(void *context)
 {
        struct smi_info *smi_info = context;
        unsigned long   flags;
@@ -1156,7 +1156,6 @@ u32 ipmi_acpi_gpe(void *context)
        smi_event_handler(smi_info, 0);
  out:
        spin_unlock_irqrestore(&(smi_info->si_lock), flags);
-       return 0;
 }
 
 static int acpi_gpe_irq_setup(struct smi_info *info)
index 2d201d0..fb84924 100644 (file)
 #define        WDIOC_GET_PRETIMEOUT     _IOW(WATCHDOG_IOCTL_BASE, 22, int)
 #endif
 
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
+static int nowayout = 1;
+#else
+static int nowayout;
+#endif
+
 static ipmi_user_t watchdog_user = NULL;
 
 /* Default the timeout to 10 seconds. */
@@ -175,6 +181,8 @@ MODULE_PARM_DESC(preop, "Pretimeout driver operation.  One of: "
 module_param(start_now, int, 0);
 MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as"
                 "soon as the driver is loaded.");
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
 
 /* Default state of the timer. */
 static unsigned char ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
@@ -229,7 +237,7 @@ static int i_ipmi_set_timeout(struct ipmi_smi_msg  *smi_msg,
                              struct ipmi_recv_msg *recv_msg,
                              int                  *send_heartbeat_now)
 {
-       struct ipmi_msg                   msg;
+       struct kernel_ipmi_msg            msg;
        unsigned char                     data[6];
        int                               rv;
        struct ipmi_system_interface_addr addr;
@@ -406,7 +414,7 @@ static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg =
  
 static int ipmi_heartbeat(void)
 {
-       struct ipmi_msg                   msg;
+       struct kernel_ipmi_msg            msg;
        int                               rv;
        struct ipmi_system_interface_addr addr;
 
@@ -478,7 +486,7 @@ static int ipmi_heartbeat(void)
 
 static void panic_halt_ipmi_heartbeat(void)
 {
-       struct ipmi_msg                   msg;
+       struct kernel_ipmi_msg             msg;
        struct ipmi_system_interface_addr addr;
 
 
@@ -590,10 +598,6 @@ static ssize_t ipmi_write(struct file *file,
 {
        int rv;
 
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (len) {
                rv = ipmi_heartbeat();
                if (rv)
@@ -611,10 +615,6 @@ static ssize_t ipmi_read(struct file *file,
        int          rv = 0;
        wait_queue_t wait;
 
-       /*  Can't seek (pread) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count <= 0)
                return 0;
 
@@ -670,7 +670,7 @@ static int ipmi_open(struct inode *ino, struct file *filep)
                    /* Don't start the timer now, let it start on the
                       first heartbeat. */
                    ipmi_start_timer_on_heartbeat = 1;
-                    return(0);
+                    return nonseekable_open(ino, filep);
 
                 default:
                     return (-ENODEV);
@@ -704,10 +704,10 @@ static int ipmi_close(struct inode *ino, struct file *filep)
 {
        if (iminor(ino)==WATCHDOG_MINOR)
        {
-#ifndef CONFIG_WATCHDOG_NOWAYOUT       
-               ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
-               ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
-#endif         
+               if (!nowayout) {
+                       ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
+                       ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
+               }
                ipmi_wdog_open = 0;
        }
 
index ba5229b..4a8b7d5 100644 (file)
@@ -680,8 +680,8 @@ static int  stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p
 
 static int     stli_brdinit(stlibrd_t *brdp);
 static int     stli_startbrd(stlibrd_t *brdp);
-static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp);
-static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp);
+static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp);
+static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp);
 static int     stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg);
 static void    stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp);
 static void    stli_poll(unsigned long arg);
@@ -700,14 +700,14 @@ static void       stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
 static void    stli_mkasysigs(asysigs_t *sp, int dtr, int rts);
 static long    stli_mktiocm(unsigned long sigvalue);
 static void    stli_read(stlibrd_t *brdp, stliport_t *portp);
-static int     stli_getserial(stliport_t *portp, struct serial_struct *sp);
-static int     stli_setserial(stliport_t *portp, struct serial_struct *sp);
-static int     stli_getbrdstats(combrd_t *bp);
-static int     stli_getportstats(stliport_t *portp, comstats_t *cp);
+static int     stli_getserial(stliport_t *portp, struct serial_struct __user *sp);
+static int     stli_setserial(stliport_t *portp, struct serial_struct __user *sp);
+static int     stli_getbrdstats(combrd_t __user *bp);
+static int     stli_getportstats(stliport_t *portp, comstats_t __user *cp);
 static int     stli_portcmdstats(stliport_t *portp);
-static int     stli_clrportstats(stliport_t *portp, comstats_t *cp);
-static int     stli_getportstruct(unsigned long arg);
-static int     stli_getbrdstruct(unsigned long arg);
+static int     stli_clrportstats(stliport_t *portp, comstats_t __user *cp);
+static int     stli_getportstruct(stliport_t __user *arg);
+static int     stli_getbrdstruct(stlibrd_t __user *arg);
 static void    *stli_memalloc(int len);
 static stlibrd_t *stli_allocbrd(void);
 
@@ -808,7 +808,7 @@ static int __init istallion_module_init(void)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("init_module()\n");
 #endif
 
@@ -829,7 +829,7 @@ static void __exit istallion_module_exit(void)
        unsigned long   flags;
        int             i, j;
 
-#if DEBUG
+#ifdef DEBUG
        printk("cleanup_module()\n");
 #endif
 
@@ -901,13 +901,13 @@ module_exit(istallion_module_exit);
  *     Check for any arguments passed in on the module load command line.
  */
 
-static void stli_argbrds()
+static void stli_argbrds(void)
 {
        stlconf_t       conf;
        stlibrd_t       *brdp;
        int             nrargs, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_argbrds()\n");
 #endif
 
@@ -975,7 +975,7 @@ static int stli_parsebrd(stlconf_t *confp, char **argp)
        char    *sp;
        int     nrbrdnames, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
 #endif
 
@@ -1025,7 +1025,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp)
        unsigned int    minordev;
        int             brdnr, portnr, rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty,
                (int) filp, tty->name);
 #endif
@@ -1125,7 +1125,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp)
        stliport_t      *portp;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);
 #endif
 
@@ -1210,7 +1210,7 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp)
        asyport_t               aport;
        int                     rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp);
 #endif
 
@@ -1263,7 +1263,7 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i
        unsigned long           flags;
        int                     rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
                (int) brdp, (int) portp, (int) arg, wait);
 #endif
@@ -1344,7 +1344,7 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg,
        unsigned long           flags;
        int                     rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n",
                (int) brdp, (int) portp, (int) arg, wait);
 #endif
@@ -1417,7 +1417,7 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
                "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
                (int) arg, size, copyback);
@@ -1461,7 +1461,7 @@ static int stli_setport(stliport_t *portp)
        stlibrd_t       *brdp;
        asyport_t       aport;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_setport(portp=%x)\n", (int) portp);
 #endif
 
@@ -1489,7 +1489,7 @@ static int stli_setport(stliport_t *portp)
 
 static void stli_delay(int len)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stli_delay(len=%d)\n", len);
 #endif
        if (len > 0) {
@@ -1510,7 +1510,7 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil
        unsigned long   flags;
        int             rc, doclocal;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n",
                (int) brdp, (int) portp, (int) filp);
 #endif
@@ -1578,7 +1578,7 @@ static int stli_write(struct tty_struct *tty, int from_user, const unsigned char
        unsigned int            len, stlen, head, tail, size;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_write(tty=%x,from_user=%d,buf=%x,count=%d)\n",
                (int) tty, from_user, (int) buf, count);
 #endif
@@ -1699,7 +1699,7 @@ static int stli_write(struct tty_struct *tty, int from_user, const unsigned char
 
 static void stli_putchar(struct tty_struct *tty, unsigned char ch)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);
 #endif
 
@@ -1736,7 +1736,7 @@ static void stli_flushchars(struct tty_struct *tty)
        unsigned char           *buf, *shbuf;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_flushchars(tty=%x)\n", (int) tty);
 #endif
 
@@ -1827,7 +1827,7 @@ static int stli_writeroom(struct tty_struct *tty)
        unsigned int            head, tail, len;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_writeroom(tty=%x)\n", (int) tty);
 #endif
 
@@ -1887,7 +1887,7 @@ static int stli_charsinbuffer(struct tty_struct *tty)
        unsigned int            head, tail, len;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_charsinbuffer(tty=%x)\n", (int) tty);
 #endif
 
@@ -1927,12 +1927,12 @@ static int stli_charsinbuffer(struct tty_struct *tty)
  *     Generate the serial struct info.
  */
 
-static int stli_getserial(stliport_t *portp, struct serial_struct *sp)
+static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp)
 {
        struct serial_struct    sio;
        stlibrd_t               *brdp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
 #endif
 
@@ -1964,13 +1964,13 @@ static int stli_getserial(stliport_t *portp, struct serial_struct *sp)
  *     just quietly ignore any requests to change irq, etc.
  */
 
-static int stli_setserial(stliport_t *portp, struct serial_struct *sp)
+static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp)
 {
        struct serial_struct    sio;
        int                     rc;
 
-#if DEBUG
-       printk("stli_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
+#ifdef DEBUG
+       printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp);
 #endif
 
        if (copy_from_user(&sio, sp, sizeof(struct serial_struct)))
@@ -2058,8 +2058,9 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
        stlibrd_t       *brdp;
        unsigned int    ival;
        int             rc;
+       void __user *argp = (void __user *)arg;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n",
                (int) tty, (int) file, cmd, (int) arg);
 #endif
@@ -2086,40 +2087,32 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm
        switch (cmd) {
        case TIOCGSOFTCAR:
                rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
-                       (unsigned int *) arg);
+                       (unsigned __user *) arg);
                break;
        case TIOCSSOFTCAR:
-               if ((rc = get_user(ival, (unsigned int *) arg)) == 0)
+               if ((rc = get_user(ival, (unsigned __user *) arg)) == 0)
                        tty->termios->c_cflag =
                                (tty->termios->c_cflag & ~CLOCAL) |
                                (ival ? CLOCAL : 0);
                break;
        case TIOCGSERIAL:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(struct serial_struct))) == 0)
-                       rc = stli_getserial(portp, (struct serial_struct *) arg);
+               rc = stli_getserial(portp, argp);
                break;
        case TIOCSSERIAL:
-               if ((rc = verify_area(VERIFY_READ, (void *) arg,
-                   sizeof(struct serial_struct))) == 0)
-                       rc = stli_setserial(portp, (struct serial_struct *)arg);
+               rc = stli_setserial(portp, argp);
                break;
        case STL_GETPFLAG:
-               rc = put_user(portp->pflag, (unsigned int *) arg);
+               rc = put_user(portp->pflag, (unsigned __user *)argp);
                break;
        case STL_SETPFLAG:
-               if ((rc = get_user(portp->pflag, (unsigned int *) arg)) == 0)
+               if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0)
                        stli_setport(portp);
                break;
        case COM_GETPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stli_getportstats(portp, (comstats_t *) arg);
+               rc = stli_getportstats(portp, argp);
                break;
        case COM_CLRPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stli_clrportstats(portp, (comstats_t *) arg);
+               rc = stli_clrportstats(portp, argp);
                break;
        case TIOCSERCONFIG:
        case TIOCSERGWILD:
@@ -2150,7 +2143,7 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old)
        struct termios  *tiosp;
        asyport_t       aport;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old);
 #endif
 
@@ -2197,7 +2190,7 @@ static void stli_throttle(struct tty_struct *tty)
 {
        stliport_t      *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_throttle(tty=%x)\n", (int) tty);
 #endif
 
@@ -2222,7 +2215,7 @@ static void stli_unthrottle(struct tty_struct *tty)
 {
        stliport_t      *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_unthrottle(tty=%x)\n", (int) tty);
 #endif
 
@@ -2248,7 +2241,7 @@ static void stli_stop(struct tty_struct *tty)
        stliport_t      *portp;
        asyctrl_t       actrl;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_stop(tty=%x)\n", (int) tty);
 #endif
 
@@ -2282,7 +2275,7 @@ static void stli_start(struct tty_struct *tty)
        stlibrd_t       *brdp;
        asyctrl_t       actrl;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_start(tty=%x)\n", (int) tty);
 #endif
 
@@ -2319,7 +2312,7 @@ static void stli_dohangup(void *arg)
 {
        stliport_t      *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg);
 #endif
 
@@ -2351,7 +2344,7 @@ static void stli_hangup(struct tty_struct *tty)
        stlibrd_t       *brdp;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty);
 #endif
 
@@ -2409,7 +2402,7 @@ static void stli_flushbuffer(struct tty_struct *tty)
        stlibrd_t       *brdp;
        unsigned long   ftype, flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty);
 #endif
 
@@ -2459,7 +2452,7 @@ static void stli_breakctl(struct tty_struct *tty, int state)
        long            arg;
        /* long savestate, savetime; */
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state);
 #endif
 
@@ -2498,7 +2491,7 @@ static void stli_waituntilsent(struct tty_struct *tty, int timeout)
        stliport_t      *portp;
        unsigned long   tend;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout);
 #endif
 
@@ -2529,7 +2522,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch)
        stliport_t      *portp;
        asyctrl_t       actrl;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch);
 #endif
 
@@ -2636,7 +2629,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo
        int             curoff, maxoff;
        char            *pos;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x,"
                "data=%x\n", (int) page, (int) start, (int) off, count,
                (int) eof, (int) data);
@@ -2712,7 +2705,7 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd,
        volatile unsigned char  *bits;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d,"
                "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd,
                (int) arg, size, copyback);
@@ -2766,7 +2759,7 @@ static inline void stli_read(stlibrd_t *brdp, stliport_t *portp)
        unsigned int            head, tail, size;
        unsigned int            len, stlen;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n",
                        (int) brdp, (int) portp);
 #endif
@@ -2883,7 +2876,7 @@ static inline int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp)
        unsigned long           oldsigs;
        int                     rc, donerx;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n",
                        (int) brdp, channr);
 #endif
@@ -3135,7 +3128,7 @@ static void stli_poll(unsigned long arg)
 
 static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n",
                (int) portp, (int) pp, (int) tiosp);
 #endif
@@ -3258,7 +3251,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio
 
 static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts)
 {
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n",
                        (int) sp, dtr, rts);
 #endif
@@ -3285,7 +3278,7 @@ static long stli_mktiocm(unsigned long sigvalue)
 {
        long    tiocm;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue);
 #endif
 
@@ -3311,7 +3304,7 @@ static inline int stli_initports(stlibrd_t *brdp)
        stliport_t      *portp;
        int             i, panelnr, panelport;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3355,7 +3348,7 @@ static void stli_ecpinit(stlibrd_t *brdp)
 {
        unsigned long   memconf;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp);
 #endif
 
@@ -3372,7 +3365,7 @@ static void stli_ecpinit(stlibrd_t *brdp)
 
 static void stli_ecpenable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp);
 #endif
        outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR));
@@ -3382,7 +3375,7 @@ static void stli_ecpenable(stlibrd_t *brdp)
 
 static void stli_ecpdisable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp);
 #endif
        outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR));
@@ -3395,7 +3388,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
        void            *ptr;
        unsigned char   val;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
                (int) offset);
 #endif
@@ -3404,7 +3397,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                        (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % ECP_ATPAGESIZE);
@@ -3418,7 +3411,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 
 static void stli_ecpreset(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3432,7 +3425,7 @@ static void stli_ecpreset(stlibrd_t *brdp)
 
 static void stli_ecpintr(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp);
 #endif
        outb(0x1, brdp->iobase);
@@ -3448,7 +3441,7 @@ static void stli_ecpeiinit(stlibrd_t *brdp)
 {
        unsigned long   memconf;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3485,7 +3478,7 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line
        void            *ptr;
        unsigned char   val;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n",
                (int) brdp, (int) offset, line);
 #endif
@@ -3494,7 +3487,7 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                        (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % ECP_EIPAGESIZE);
@@ -3546,7 +3539,7 @@ static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                        (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % ECP_MCPAGESIZE);
@@ -3574,7 +3567,7 @@ static void stli_ecpmcreset(stlibrd_t *brdp)
 
 static void stli_ecppciinit(stlibrd_t *brdp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3591,7 +3584,7 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin
        void            *ptr;
        unsigned char   val;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n",
                (int) brdp, (int) offset, line);
 #endif
@@ -3600,7 +3593,7 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), board=%d\n",
                                (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % ECP_PCIPAGESIZE);
@@ -3630,7 +3623,7 @@ static void stli_onbinit(stlibrd_t *brdp)
 {
        unsigned long   memconf;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp);
 #endif
 
@@ -3649,7 +3642,7 @@ static void stli_onbinit(stlibrd_t *brdp)
 
 static void stli_onbenable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp);
 #endif
        outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR));
@@ -3659,7 +3652,7 @@ static void stli_onbenable(stlibrd_t *brdp)
 
 static void stli_onbdisable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp);
 #endif
        outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR));
@@ -3671,7 +3664,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 {      
        void    *ptr;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
                (int) offset);
 #endif
@@ -3680,7 +3673,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                                (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
        } else {
                ptr = brdp->membase + (offset % ONB_ATPAGESIZE);
        }
@@ -3692,7 +3685,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 static void stli_onbreset(stlibrd_t *brdp)
 {      
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3712,7 +3705,7 @@ static void stli_onbeinit(stlibrd_t *brdp)
 {
        unsigned long   memconf;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp);
 #endif
 
@@ -3734,7 +3727,7 @@ static void stli_onbeinit(stlibrd_t *brdp)
 
 static void stli_onbeenable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp);
 #endif
        outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR));
@@ -3744,7 +3737,7 @@ static void stli_onbeenable(stlibrd_t *brdp)
 
 static void stli_onbedisable(stlibrd_t *brdp)
 {      
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp);
 #endif
        outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR));
@@ -3757,7 +3750,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
        void            *ptr;
        unsigned char   val;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n",
                (int) brdp, (int) offset, line);
 #endif
@@ -3766,7 +3759,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                        (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % ONB_EIPAGESIZE);
@@ -3784,7 +3777,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 static void stli_onbereset(stlibrd_t *brdp)
 {      
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3803,7 +3796,7 @@ static void stli_onbereset(stlibrd_t *brdp)
 static void stli_bbyinit(stlibrd_t *brdp)
 {
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp);
 #endif
 
@@ -3822,7 +3815,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
        void            *ptr;
        unsigned char   val;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
                (int) offset);
 #endif
@@ -3831,7 +3824,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                                (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
                val = 0;
        } else {
                ptr = brdp->membase + (offset % BBY_PAGESIZE);
@@ -3846,7 +3839,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 static void stli_bbyreset(stlibrd_t *brdp)
 {      
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3865,7 +3858,7 @@ static void stli_bbyreset(stlibrd_t *brdp)
 static void stli_stalinit(stlibrd_t *brdp)
 {
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp);
 #endif
 
@@ -3879,7 +3872,7 @@ static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
 {      
        void    *ptr;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp,
                (int) offset);
 #endif
@@ -3888,7 +3881,7 @@ static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line)
                printk(KERN_ERR "STALLION: shared memory pointer=%x out of "
                                "range at line=%d(%d), brd=%d\n",
                                (int) offset, line, __LINE__, brdp->brdnr);
-               ptr = 0;
+               ptr = NULL;
        } else {
                ptr = brdp->membase + (offset % STAL_PAGESIZE);
        }
@@ -3901,7 +3894,7 @@ static void stli_stalreset(stlibrd_t *brdp)
 {      
        volatile unsigned long  *vecp;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -3926,7 +3919,7 @@ static inline int stli_initecp(stlibrd_t *brdp)
        char            *name;
        int             panelnr, nrports;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -4086,7 +4079,7 @@ static inline int stli_initonb(stlibrd_t *brdp)
        char            *name;
        int             i;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -4254,7 +4247,7 @@ static int stli_startbrd(stlibrd_t *brdp)
        stliport_t              *portp;
        int                     portnr, nrdevs, i, rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -4360,7 +4353,7 @@ stli_donestartup:
 
 static int __init stli_brdinit(stlibrd_t *brdp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -4427,7 +4420,7 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp)
        cdkonbsig_t     onbsig, *onbsigp;
        int             i, foundit;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -4504,7 +4497,7 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp)
 
        if (! foundit) {
                brdp->memaddr = 0;
-               brdp->membase = 0;
+               brdp->membase = NULL;
                printk(KERN_ERR "STALLION: failed to probe shared memory "
                                "region for %s in EISA slot=%d\n",
                        stli_brdnames[brdp->brdtype], (brdp->iobase >> 12));
@@ -4513,6 +4506,20 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp)
        return(0);
 }
 
+static inline int stli_getbrdnr(void)
+{
+       int i;
+
+       for (i = 0; i < STL_MAXBRDS; i++) {
+               if (!stli_brds[i]) {
+                       if (i >= stli_nrbrds)
+                               stli_nrbrds = i + 1;
+                       return i;
+               }
+       }
+       return -1;
+}
+
 /*****************************************************************************/
 
 /*
@@ -4525,13 +4532,13 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp)
  *     do is go probing around in the usual places hoping we can find it.
  */
 
-static inline int stli_findeisabrds()
+static inline int stli_findeisabrds(void)
 {
        stlibrd_t       *brdp;
        unsigned int    iobase, eid;
        int             i;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_findeisabrds()\n");
 #endif
 
@@ -4599,20 +4606,6 @@ static inline int stli_findeisabrds()
  *     Find the next available board number that is free.
  */
 
-static inline int stli_getbrdnr()
-{
-       int     i;
-
-       for (i = 0; (i < STL_MAXBRDS); i++) {
-               if (stli_brds[i] == (stlibrd_t *) NULL) {
-                       if (i >= stli_nrbrds)
-                               stli_nrbrds = i + 1;
-                       return(i);
-               }
-       }
-       return(-1);
-}
-
 /*****************************************************************************/
 
 #ifdef CONFIG_PCI
@@ -4627,7 +4620,7 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp)
 {
        stlibrd_t       *brdp;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n",
                brdtype, dev->bus->number, dev->devfn);
 #endif
@@ -4643,7 +4636,7 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp)
        }
        brdp->brdtype = brdtype;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__,
                pci_resource_start(devp, 0),
                pci_resource_start(devp, 1),
@@ -4669,12 +4662,12 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp)
  *     one as it is found.
  */
 
-static inline int stli_findpcibrds()
+static inline int stli_findpcibrds(void)
 {
        struct pci_dev  *dev = NULL;
        int             rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stli_findpcibrds()\n");
 #endif
 
@@ -4695,7 +4688,7 @@ static inline int stli_findpcibrds()
  *     Allocate a new board structure. Fill out the basic info in it.
  */
 
-static stlibrd_t *stli_allocbrd()
+static stlibrd_t *stli_allocbrd(void)
 {
        stlibrd_t       *brdp;
 
@@ -4718,13 +4711,13 @@ static stlibrd_t *stli_allocbrd()
  *     can find.
  */
 
-static inline int stli_initbrds()
+static inline int stli_initbrds(void)
 {
        stlibrd_t       *brdp, *nxtbrdp;
        stlconf_t       *confp;
        int             i, j;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_initbrds()\n");
 #endif
 
@@ -4815,14 +4808,14 @@ static inline int stli_initbrds()
  *     the slave image (and debugging :-)
  */
 
-static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp)
+static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp)
 {
        unsigned long   flags;
        void            *memptr;
        stlibrd_t       *brdp;
        int             brdnr, size, n;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n",
                        (int) fp, (int) buf, count, (int) offp);
 #endif
@@ -4869,15 +4862,15 @@ out:
  *     the slave image (and debugging :-)
  */
 
-static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp)
+static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp)
 {
        unsigned long   flags;
        void            *memptr;
        stlibrd_t       *brdp;
-       char            *chbuf;
+       char            __user *chbuf;
        int             brdnr, size, n;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n",
                        (int) fp, (int) buf, count, (int) offp);
 #endif
@@ -4893,7 +4886,7 @@ static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, lof
        if (fp->f_pos >= brdp->memsize)
                return(0);
 
-       chbuf = (char *) buf;
+       chbuf = (char __user *) buf;
        size = MIN(count, (brdp->memsize - fp->f_pos));
 
        save_flags(flags);
@@ -4923,7 +4916,7 @@ out:
  *     Return the board stats structure to user app.
  */
 
-static int stli_getbrdstats(combrd_t *bp)
+static int stli_getbrdstats(combrd_t __user *bp)
 {
        stlibrd_t       *brdp;
        int             i;
@@ -5062,26 +5055,26 @@ static int stli_portcmdstats(stliport_t *portp)
  *     what port to get stats for (used through board control device).
  */
 
-static int stli_getportstats(stliport_t *portp, comstats_t *cp)
+static int stli_getportstats(stliport_t *portp, comstats_t __user *cp)
 {
        stlibrd_t       *brdp;
        int             rc;
 
-       if (portp == (stliport_t *) NULL) {
+       if (!portp) {
                if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
                        return -EFAULT;
                portp = stli_getport(stli_comstats.brd, stli_comstats.panel,
                        stli_comstats.port);
-               if (portp == (stliport_t *) NULL)
-                       return(-ENODEV);
+               if (!portp)
+                       return -ENODEV;
        }
 
        brdp = stli_brds[portp->brdnr];
-       if (brdp == (stlibrd_t *) NULL)
-               return(-ENODEV);
+       if (!brdp)
+               return -ENODEV;
 
        if ((rc = stli_portcmdstats(portp)) < 0)
-               return(rc);
+               return rc;
 
        return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ?
                        -EFAULT : 0;
@@ -5093,27 +5086,27 @@ static int stli_getportstats(stliport_t *portp, comstats_t *cp)
  *     Clear the port stats structure. We also return it zeroed out...
  */
 
-static int stli_clrportstats(stliport_t *portp, comstats_t *cp)
+static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp)
 {
        stlibrd_t       *brdp;
        int             rc;
 
-       if (portp == (stliport_t *) NULL) {
+       if (!portp) {
                if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t)))
                        return -EFAULT;
                portp = stli_getport(stli_comstats.brd, stli_comstats.panel,
                        stli_comstats.port);
-               if (portp == (stliport_t *) NULL)
-                       return(-ENODEV);
+               if (!portp)
+                       return -ENODEV;
        }
 
        brdp = stli_brds[portp->brdnr];
-       if (brdp == (stlibrd_t *) NULL)
-               return(-ENODEV);
+       if (!brdp)
+               return -ENODEV;
 
        if (brdp->state & BST_STARTED) {
-               if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, 0, 0, 0)) < 0)
-                       return(rc);
+               if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, NULL, 0, 0)) < 0)
+                       return rc;
        }
 
        memset(&stli_comstats, 0, sizeof(comstats_t));
@@ -5123,7 +5116,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t *cp)
 
        if (copy_to_user(cp, &stli_comstats, sizeof(comstats_t)))
                return -EFAULT;
-       return(0);
+       return 0;
 }
 
 /*****************************************************************************/
@@ -5132,19 +5125,19 @@ static int stli_clrportstats(stliport_t *portp, comstats_t *cp)
  *     Return the entire driver ports structure to a user app.
  */
 
-static int stli_getportstruct(unsigned long arg)
+static int stli_getportstruct(stliport_t __user *arg)
 {
        stliport_t      *portp;
 
-       if (copy_from_user(&stli_dummyport, (void *)arg, sizeof(stliport_t)))
+       if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t)))
                return -EFAULT;
        portp = stli_getport(stli_dummyport.brdnr, stli_dummyport.panelnr,
                 stli_dummyport.portnr);
-       if (portp == (stliport_t *) NULL)
-               return(-ENODEV);
-       if (copy_to_user((void *) arg, portp, sizeof(stliport_t)))
+       if (!portp)
+               return -ENODEV;
+       if (copy_to_user(arg, portp, sizeof(stliport_t)))
                return -EFAULT;
-       return(0);
+       return 0;
 }
 
 /*****************************************************************************/
@@ -5153,20 +5146,20 @@ static int stli_getportstruct(unsigned long arg)
  *     Return the entire driver board structure to a user app.
  */
 
-static int stli_getbrdstruct(unsigned long arg)
+static int stli_getbrdstruct(stlibrd_t __user *arg)
 {
        stlibrd_t       *brdp;
 
-       if (copy_from_user(&stli_dummybrd, (void *)arg, sizeof(stlibrd_t)))
+       if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t)))
                return -EFAULT;
        if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS))
-               return(-ENODEV);
+               return -ENODEV;
        brdp = stli_brds[stli_dummybrd.brdnr];
-       if (brdp == (stlibrd_t *) NULL)
-               return(-ENODEV);
-       if (copy_to_user((void *) arg, brdp, sizeof(stlibrd_t)))
+       if (!brdp)
+               return -ENODEV;
+       if (copy_to_user(arg, brdp, sizeof(stlibrd_t)))
                return -EFAULT;
-       return(0);
+       return 0;
 }
 
 /*****************************************************************************/
@@ -5181,8 +5174,9 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
 {
        stlibrd_t       *brdp;
        int             brdnr, rc, done;
+       void __user *argp = (void __user *)arg;
 
-#if DEBUG
+#ifdef DEBUG
        printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n",
                        (int) ip, (int) fp, cmd, (int) arg);
 #endif
@@ -5195,23 +5189,23 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
 
        switch (cmd) {
        case COM_GETPORTSTATS:
-               rc = stli_getportstats((stliport_t *)NULL, (comstats_t *)arg);
+               rc = stli_getportstats(NULL, argp);
                done++;
                break;
        case COM_CLRPORTSTATS:
-               rc = stli_clrportstats((stliport_t *)NULL, (comstats_t *)arg);
+               rc = stli_clrportstats(NULL, argp);
                done++;
                break;
        case COM_GETBRDSTATS:
-               rc = stli_getbrdstats((combrd_t *) arg);
+               rc = stli_getbrdstats(argp);
                done++;
                break;
        case COM_READPORT:
-               rc = stli_getportstruct(arg);
+               rc = stli_getportstruct(argp);
                done++;
                break;
        case COM_READBOARD:
-               rc = stli_getbrdstruct(arg);
+               rc = stli_getbrdstruct(argp);
                done++;
                break;
        }
@@ -5227,7 +5221,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
        if (brdnr >= STL_MAXBRDS)
                return(-ENODEV);
        brdp = stli_brds[brdnr];
-       if (brdp == (stlibrd_t *) NULL)
+       if (!brdp)
                return(-ENODEV);
        if (brdp->state == 0)
                return(-ENODEV);
index 82ab436..8b86d01 100644 (file)
@@ -114,29 +114,13 @@ static inline int valid_phys_addr_range(unsigned long addr, size_t *count)
 }
 #endif
 
-extern int page_is_ram(unsigned long pagenr);
-
-static inline int page_is_allowed(unsigned long pagenr)
-{ 
- #ifdef CONFIG_X86
-       if (pagenr <= 256)
-               return 1;
-       if (!page_is_ram(pagenr))
-               return 1;
-       printk("Access to 0x%lx by %s denied \n", pagenr << PAGE_SHIFT, current->comm);
-       return 0;
- #else
-       return 1;
- #endif
-}
-
 static inline int range_is_allowed(unsigned long from, unsigned long to)
 {
        unsigned long cursor;
        
        cursor = from >> PAGE_SHIFT;
-       while ( (cursor << PAGE_SHIFT) < to) {
-               if (!page_is_allowed(cursor))
+       while ((cursor << PAGE_SHIFT) < to) {
+               if (!devmem_is_allowed(cursor))
                        return 0;
                cursor++;
        }
@@ -162,7 +146,7 @@ static ssize_t do_write_mem(void *p, unsigned long realp,
        }
 #endif
        if (!range_is_allowed(realp, realp+count))
-               return -EFAULT;
+               return -EPERM;
        copied = copy_from_user(p, buf, count);
        if (copied) {
                ssize_t ret = written + (count - copied);
@@ -207,7 +191,7 @@ static ssize_t read_mem(struct file * file, char __user * buf,
        }
 #endif
        if (!range_is_allowed(p, p+count))
-               return -EFAULT;
+               return -EPERM;
        if (copy_to_user(buf, __va(p), count))
                return -EFAULT;
        read += count;
@@ -248,8 +232,8 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma)
                
        cursor = vma->vm_pgoff;
        while ((cursor << PAGE_SHIFT) < offset + vma->vm_end-vma->vm_start) {
-               if (!page_is_allowed(cursor))
-                       return -EFAULT;
+               if (!devmem_is_allowed(cursor))
+                       return -EPERM;
                cursor++;
        }
 
@@ -327,67 +311,6 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
        return virtr + read;
 }
 
-/*
- * This function writes to the *virtual* memory as seen by the kernel.
- */
-static ssize_t write_kmem(struct file * file, const char __user * buf, 
-                         size_t count, loff_t *ppos)
-{
-       unsigned long p = *ppos;
-       ssize_t wrote = 0;
-       ssize_t virtr = 0;
-       ssize_t written;
-       char * kbuf; /* k-addr because vwrite() takes vmlist_lock rwlock */
-       
-       return -EPERM;
-
-       if (p < (unsigned long) high_memory) {
-
-               wrote = count;
-               if (count > (unsigned long) high_memory - p)
-                       wrote = (unsigned long) high_memory - p;
-
-               written = do_write_mem((void*)p, p, buf, wrote, ppos);
-               if (written != wrote)
-                       return written;
-               wrote = written;
-               p += wrote;
-               buf += wrote;
-               count -= wrote;
-       }
-
-       if (count > 0) {
-               kbuf = (char *)__get_free_page(GFP_KERNEL);
-               if (!kbuf)
-                       return wrote ? wrote : -ENOMEM;
-               while (count > 0) {
-                       int len = count;
-
-                       if (len > PAGE_SIZE)
-                               len = PAGE_SIZE;
-                       if (len) {
-                               written = copy_from_user(kbuf, buf, len);
-                               if (written) {
-                                       ssize_t ret;
-
-                                       free_page((unsigned long)kbuf);
-                                       ret = wrote + virtr + (len - written);
-                                       return ret ? ret : -EFAULT;
-                               }
-                       }
-                       len = vwrite(kbuf, (char *)p, len);
-                       count -= len;
-                       buf += len;
-                       virtr += len;
-                       p += len;
-               }
-               free_page((unsigned long)kbuf);
-       }
-
-       *ppos = p;
-       return virtr + wrote;
-}
-
 #if defined(CONFIG_ISA) || !defined(__mc68000__)
 static ssize_t read_port(struct file * file, char __user * buf,
                         size_t count, loff_t *ppos)
@@ -638,7 +561,6 @@ static struct file_operations mem_fops = {
 static struct file_operations kmem_fops = {
        .llseek         = memory_lseek,
        .read           = read_kmem,
-       .write          = write_kmem,
        .mmap           = mmap_kmem,
        .open           = open_kmem,
 };
index a38f0fe..2983c27 100644 (file)
@@ -94,8 +94,8 @@ static int mwave_open(struct inode *inode, struct file *file)
        unsigned int retval = 0;
 
        PRINTK_3(TRACE_MWAVE,
-               "mwavedd::mwave_open, entry inode %x file %x\n",
-               (int) inode, (int) file);
+               "mwavedd::mwave_open, entry inode %p file %p\n",
+                inode, file);
        PRINTK_2(TRACE_MWAVE,
                "mwavedd::mwave_open, exit return retval %x\n", retval);
 
@@ -107,8 +107,8 @@ static int mwave_close(struct inode *inode, struct file *file)
        unsigned int retval = 0;
 
        PRINTK_3(TRACE_MWAVE,
-               "mwavedd::mwave_close, entry inode %x file %x\n",
-               (int) inode, (int) file);
+               "mwavedd::mwave_close, entry inode %p file %p\n",
+                inode,  file);
 
        PRINTK_2(TRACE_MWAVE, "mwavedd::mwave_close, exit retval %x\n",
                retval);
@@ -124,8 +124,8 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
        void __user *arg = (void __user *)ioarg;
 
        PRINTK_5(TRACE_MWAVE,
-               "mwavedd::mwave_ioctl, entry inode %x file %x cmd %x arg %x\n",
-               (int) inode, (int) file, iocmd, (int) ioarg);
+               "mwavedd::mwave_ioctl, entry inode %p file %p cmd %x arg %x\n",
+                inode,  file, iocmd, (int) ioarg);
 
        switch (iocmd) {
 
@@ -389,7 +389,7 @@ static ssize_t mwave_read(struct file *file, char __user *buf, size_t count,
                           loff_t * ppos)
 {
        PRINTK_5(TRACE_MWAVE,
-               "mwavedd::mwave_read entry file %p, buf %p, count %x ppos %p\n",
+               "mwavedd::mwave_read entry file %p, buf %p, count %zx ppos %p\n",
                file, buf, count, ppos);
 
        return -EINVAL;
@@ -401,7 +401,7 @@ static ssize_t mwave_write(struct file *file, const char __user *buf,
 {
        PRINTK_5(TRACE_MWAVE,
                "mwavedd::mwave_write entry file %p, buf %p,"
-               " count %x ppos %p\n",
+               " count %zx ppos %p\n",
                file, buf, count, ppos);
 
        return -EINVAL;
index bfc3732..ab650cd 100644 (file)
@@ -99,7 +99,7 @@ static void EnableSRAM(THINKPAD_BD_DATA * pBDData)
 static irqreturn_t UartInterrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
        PRINTK_3(TRACE_TP3780I,
-               "tp3780i::UartInterrupt entry irq %x dev_id %x\n", irq, (int) dev_id);
+               "tp3780i::UartInterrupt entry irq %x dev_id %p\n", irq, dev_id);
        return IRQ_HANDLED;
 }
 
@@ -111,7 +111,7 @@ static irqreturn_t DspInterrupt(int irq, void *dev_id, struct pt_regs *regs)
        unsigned short usIPCSource = 0, usIsolationMask, usPCNum;
 
        PRINTK_3(TRACE_TP3780I,
-               "tp3780i::DspInterrupt entry irq %x dev_id %x\n", irq, (int) dev_id);
+               "tp3780i::DspInterrupt entry irq %x dev_id %p\n", irq, dev_id);
 
        if (dsp3780I_GetIPCSource(usDspBaseIO, &usIPCSource) == 0) {
                PRINTK_2(TRACE_TP3780I,
@@ -368,14 +368,14 @@ int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
        pSettings->bPllBypass = TP_CFG_PllBypass;
        pSettings->usChipletEnable = TP_CFG_ChipletEnable;
 
-       if (request_irq(pSettings->usUartIrq, &UartInterrupt, 0, "mwave_uart", 0)) {
+       if (request_irq(pSettings->usUartIrq, &UartInterrupt, 0, "mwave_uart", NULL)) {
                PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Could not get UART IRQ %x\n", pSettings->usUartIrq);
                goto exit_cleanup;
        } else {                /* no conflict just release */
                free_irq(pSettings->usUartIrq, NULL);
        }
 
-       if (request_irq(pSettings->usDspIrq, &DspInterrupt, 0, "mwave_3780i", 0)) {
+       if (request_irq(pSettings->usDspIrq, &DspInterrupt, 0, "mwave_3780i", NULL)) {
                PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Could not get 3780i IRQ %x\n", pSettings->usDspIrq);
                goto exit_cleanup;
        } else {
index 6ff41b4..d4ba62a 100644 (file)
@@ -198,6 +198,7 @@ static int mxser_numports[] =
 #define         MOXA_GET_CUMAJOR      (MOXA + 64)
 #define         MOXA_GETMSTATUS       (MOXA + 65)
 
+#ifdef CONFIG_PCI
 static struct pci_device_id mxser_pcibrds[] = {
        { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 
          MXSER_BOARD_C168_PCI },
@@ -214,6 +215,7 @@ static struct pci_device_id mxser_pcibrds[] = {
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
+#endif /* CONFIG_PCI */
 
 static int ioaddr[MXSER_BOARDS];
 static int ttymajor = MXSERMAJOR;
@@ -330,7 +332,6 @@ struct mxser_hwconf mxsercfg[MXSER_BOARDS];
 
 static void mxser_getcfg(int board, struct mxser_hwconf *hwconf);
 static int mxser_get_ISA_conf(int, struct mxser_hwconf *);
-static int mxser_get_PCI_conf(struct pci_dev *, int, struct mxser_hwconf *);
 static void mxser_do_softint(void *);
 static int mxser_open(struct tty_struct *, struct file *);
 static void mxser_close(struct tty_struct *, struct file *);
@@ -356,9 +357,9 @@ static int mxser_block_til_ready(struct tty_struct *, struct file *, struct mxse
 static int mxser_startup(struct mxser_struct *);
 static void mxser_shutdown(struct mxser_struct *);
 static int mxser_change_speed(struct mxser_struct *, struct termios *old_termios);
-static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct *);
-static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct *);
-static int mxser_get_lsr_info(struct mxser_struct *, unsigned int *);
+static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct __user *);
+static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct __user *);
+static int mxser_get_lsr_info(struct mxser_struct *, unsigned int __user *);
 static void mxser_send_break(struct mxser_struct *, int);
 static int mxser_tiocmget(struct tty_struct *, struct file *);
 static int mxser_tiocmset(struct tty_struct *, struct file *, unsigned int, unsigned int);
@@ -461,6 +462,7 @@ static void mxser_getcfg(int board, struct mxser_hwconf *hwconf)
        mxsercfg[board] = *hwconf;
 }
 
+#ifdef CONFIG_PCI
 static int mxser_get_PCI_conf(struct pci_dev *pdev, int board_type, struct mxser_hwconf *hwconf)
 {
        int i;
@@ -485,6 +487,7 @@ static int mxser_get_PCI_conf(struct pci_dev *pdev, int board_type, struct mxser
        }
        return (0);
 }
+#endif /* CONFIG_PCI */
 
 static struct tty_operations mxser_ops = {
        .open = mxser_open,
@@ -818,7 +821,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)
                tty->ldisc.flush_buffer(tty);
        tty->closing = 0;
        info->event = 0;
-       info->tty = 0;
+       info->tty = NULL;
        if (info->blocked_open) {
                if (info->close_delay) {
                        set_current_state(TASK_INTERRUPTIBLE);
@@ -985,8 +988,9 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
        struct mxser_struct *info = (struct mxser_struct *) tty->driver_data;
        int retval;
        struct async_icount cprev, cnow;        /* kernel counter temps */
-       struct serial_icounter_struct *p_cuser;         /* user space */
+       struct serial_icounter_struct __user *p_cuser;
        unsigned long templ;
+       void __user *argp = (void __user *)arg;
 
        if (PORTNO(tty) == MXSER_PORTS)
                return (mxser_ioctl_special(cmd, arg));
@@ -1012,20 +1016,20 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
                mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4);
                return (0);
        case TIOCGSOFTCAR:
-               return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg);
+               return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp);
        case TIOCSSOFTCAR:
-               if(get_user(templ, (unsigned long *) arg))
+               if(get_user(templ, (unsigned long __user *) arg))
                        return -EFAULT;
                arg = templ;
                tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) |
                                         (arg ? CLOCAL : 0));
                return (0);
        case TIOCGSERIAL:
-               return (mxser_get_serial_info(info, (struct serial_struct *) arg));
+               return mxser_get_serial_info(info, argp);
        case TIOCSSERIAL:
-               return (mxser_set_serial_info(info, (struct serial_struct *) arg));
+               return mxser_set_serial_info(info, argp);
        case TIOCSERGETLSR:     /* Get line status register */
-               return (mxser_get_lsr_info(info, (unsigned int *) arg));
+               return mxser_get_lsr_info(info, argp);
                /*
                 * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
                 * - mask passed in arg for lines of interest
@@ -1069,7 +1073,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
                cli();
                cnow = info->icount;
                restore_flags(flags);
-               p_cuser = (struct serial_icounter_struct *) arg;
+               p_cuser = argp;
                if(put_user(cnow.cts, &p_cuser->cts))
                        return -EFAULT;
                if(put_user(cnow.dsr, &p_cuser->dsr))
@@ -1078,7 +1082,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
                        return -EFAULT;
                return put_user(cnow.dcd, &p_cuser->dcd);
        case MOXA_HighSpeedOn:
-               return put_user(info->baud_base != 115200 ? 1 : 0, (int *) arg);
+               return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp);
        default:
                return (-ENOIOCTLCMD);
        }
@@ -1088,21 +1092,22 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
 static int mxser_ioctl_special(unsigned int cmd, unsigned long arg)
 {
        int i, result, status;
+       void __user *argp = (void __user *)arg;
 
        switch (cmd) {
        case MOXA_GET_CONF:
-               if(copy_to_user((struct mxser_hwconf *) arg, mxsercfg,
+               if(copy_to_user(argp, mxsercfg,
                             sizeof(struct mxser_hwconf) * 4))
                                return -EFAULT;
                return 0;
        case MOXA_GET_MAJOR:
-               if(copy_to_user((int *) arg, &ttymajor, sizeof(int)))
+               if(copy_to_user(argp, &ttymajor, sizeof(int)))
                        return -EFAULT;
                return 0;
 
        case MOXA_GET_CUMAJOR:
                result = 0;
-               if(copy_to_user((int *) arg, &result, sizeof(int)))
+               if(copy_to_user(argp, &result, sizeof(int)))
                        return -EFAULT;
                return 0;
 
@@ -1112,9 +1117,9 @@ static int mxser_ioctl_special(unsigned int cmd, unsigned long arg)
                        if (mxvar_table[i].base)
                                result |= (1 << i);
                }
-               return put_user(result, (unsigned long *) arg);
+               return put_user(result, (unsigned long __user *) argp);
        case MOXA_GETDATACOUNT:
-               if(copy_to_user((struct mxser_log *) arg, &mxvar_log, sizeof(mxvar_log)))
+               if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log)))
                        return -EFAULT;
                return (0);
        case MOXA_GETMSTATUS:
@@ -1148,7 +1153,7 @@ static int mxser_ioctl_special(unsigned int cmd, unsigned long arg)
                        else
                                GMStatus[i].cts = 0;
                }
-               if(copy_to_user((struct mxser_mstatus *) arg, GMStatus,
+               if(copy_to_user(argp, GMStatus,
                             sizeof(struct mxser_mstatus) * MXSER_PORTS))
                        return -EFAULT;
                return 0;
@@ -1298,7 +1303,7 @@ void mxser_hangup(struct tty_struct *tty)
        info->event = 0;
        info->count = 0;
        info->flags &= ~ASYNC_NORMAL_ACTIVE;
-       info->tty = 0;
+       info->tty = NULL;
        wake_up_interruptible(&info->open_wait);
 }
 
@@ -1314,7 +1319,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        int pass_counter = 0;
        int handled = 0;
 
-       port = 0;
+       port = NULL;
        for (i = 0; i < MXSER_BOARDS; i++) {
                if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) {
                        port = dev_id;
@@ -1662,7 +1667,7 @@ static int mxser_startup(struct mxser_struct *info)
        /*
         * and set the speed of the serial port
         */
-       mxser_change_speed(info, 0);
+       mxser_change_speed(info, NULL);
 
        info->flags |= ASYNC_INITIALIZED;
        restore_flags(flags);
@@ -1694,7 +1699,7 @@ static void mxser_shutdown(struct mxser_struct *info)
         */
        if (info->xmit_buf) {
                free_page((unsigned long) info->xmit_buf);
-               info->xmit_buf = 0;
+               info->xmit_buf = NULL;
        }
        info->IER = 0;
        outb(0x00, info->base + UART_IER);      /* disable all intrs */
@@ -2045,7 +2050,7 @@ static int mxser_change_speed(struct mxser_struct *info,
  * ------------------------------------------------------------
  */
 static int mxser_get_serial_info(struct mxser_struct *info,
-                                struct serial_struct *retinfo)
+                                struct serial_struct __user *retinfo)
 {
        struct serial_struct tmp;
 
@@ -2066,7 +2071,7 @@ static int mxser_get_serial_info(struct mxser_struct *info,
 }
 
 static int mxser_set_serial_info(struct mxser_struct *info,
-                                struct serial_struct *new_info)
+                                struct serial_struct __user *new_info)
 {
        struct serial_struct new_serial;
        unsigned int flags;
@@ -2107,7 +2112,7 @@ static int mxser_set_serial_info(struct mxser_struct *info,
 
        if (info->flags & ASYNC_INITIALIZED) {
                if (flags != (info->flags & ASYNC_SPD_MASK)) {
-                       mxser_change_speed(info, 0);
+                       mxser_change_speed(info, NULL);
                }
        } else
                retval = mxser_startup(info);
@@ -2124,7 +2129,7 @@ static int mxser_set_serial_info(struct mxser_struct *info,
  *          transmit holding register is empty.  This functionality
  *          allows an RS485 driver to be written in user space.
  */
-static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int *value)
+static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int __user *value)
 {
        unsigned char status;
        unsigned int result;
index 0f1966d..3e10c70 100644 (file)
@@ -294,7 +294,7 @@ static void n_hdlc_tty_close(struct tty_struct *tty)
 #endif
                tty->disc_data = NULL;
                if (tty == n_hdlc->backup_tty)
-                       n_hdlc->backup_tty = 0;
+                       n_hdlc->backup_tty = NULL;
                if (tty != n_hdlc->tty)
                        return;
                if (n_hdlc->backup_tty) {
@@ -829,7 +829,7 @@ static struct n_hdlc *n_hdlc_alloc(void)
        struct n_hdlc *n_hdlc = kmalloc(sizeof(*n_hdlc), GFP_KERNEL);
 
        if (!n_hdlc)
-               return 0;
+               return NULL;
 
        memset(n_hdlc, 0, sizeof(*n_hdlc));
 
index bac378d..0721974 100644 (file)
 
 static inline unsigned char *alloc_buf(void)
 {
-       unsigned char *p;
        int prio = in_interrupt() ? GFP_ATOMIC : GFP_KERNEL;
 
-       if (PAGE_SIZE != N_TTY_BUF_SIZE) {
-               p = kmalloc(N_TTY_BUF_SIZE, prio);
-               if (p)
-                       memset(p, 0, N_TTY_BUF_SIZE);
-       } else
-               p = (unsigned char *)get_zeroed_page(prio);
-
-       return p;
+       if (PAGE_SIZE != N_TTY_BUF_SIZE)
+               return kmalloc(N_TTY_BUF_SIZE, prio);
+       else
+               return (unsigned char *)__get_free_page(prio);
 }
 
 static inline void free_buf(unsigned char *buf)
index adfd48e..cb1cfb0 100644 (file)
@@ -257,6 +257,11 @@ typedef struct _mgslpc_info {
     
 #define CHA     0x00   /* channel A offset */
 #define CHB     0x40   /* channel B offset */
+
+/*
+ *  FIXME: PPC has PVR defined in asm/reg.h.  For now we just undef it.
+ */
+#undef PVR
     
 #define RXFIFO  0
 #define TXFIFO  0
@@ -849,9 +854,8 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info,
 static BOOLEAN wait_command_complete(MGSLPC_INFO *info, unsigned char channel) 
 {
        int i = 0;
-       unsigned char status;
        /* wait for command completion */ 
-       while ((status = read_reg(info, (unsigned char)(channel+STAR)) & BIT2)) {
+       while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) {
                udelay(1);
                if (i++ == 1000)
                        return FALSE;
index f51b541..a261179 100644 (file)
@@ -822,6 +822,11 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
        } else {
                time = jiffies;
        }
+#elif defined (__sparc_v9__)
+       unsigned long tick = tick_ops->get_tick();
+
+       time = (unsigned int) tick;
+       num ^= (tick >> 32UL);
 #else
        time = jiffies;
 #endif
@@ -1894,13 +1899,13 @@ static int change_poolsize(int poolsize)
 }
 
 static int proc_do_poolsize(ctl_table *table, int write, struct file *filp,
-                           void __user *buffer, size_t *lenp)
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int     ret;
 
        sysctl_poolsize = random_state->poolinfo.POOLBYTES;
 
-       ret = proc_dointvec(table, write, filp, buffer, lenp);
+       ret = proc_dointvec(table, write, filp, buffer, lenp, ppos);
        if (ret || !write ||
            (sysctl_poolsize == random_state->poolinfo.POOLBYTES))
                return ret;
@@ -1945,7 +1950,7 @@ static int poolsize_strategy(ctl_table *table, int __user *name, int nlen,
  * sysctl system call, it is returned as 16 bytes of binary data.
  */
 static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp)
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        ctl_table       fake_table;
        unsigned char   buf[64], tmp_uuid[16], *uuid;
@@ -1967,7 +1972,7 @@ static int proc_do_uuid(ctl_table *table, int write, struct file *filp,
        fake_table.data = buf;
        fake_table.maxlen = sizeof(buf);
 
-       return proc_dostring(&fake_table, write, filp, buffer, lenp);
+       return proc_dostring(&fake_table, write, filp, buffer, lenp, ppos);
 }
 
 static int uuid_strategy(ctl_table *table, int __user *name, int nlen,
@@ -2478,3 +2483,36 @@ __u32 check_tcp_syn_cookie(__u32 cookie, __u32 saddr, __u32 daddr, __u16 sport,
        return (cookie - tmp[17]) & COOKIEMASK; /* Leaving the data behind */
 }
 #endif
+
+/*
+ * Get a random word:
+ */
+unsigned int get_random_int(void)
+{
+       unsigned int val = 0;
+
+       if (!exec_shield_randomize)
+               return 0;
+
+#ifdef CONFIG_X86_HAS_TSC
+       rdtscl(val);
+#endif
+       val += current->pid + jiffies + (int)&val;
+
+       /*
+        * Use IP's RNG. It suits our purpose perfectly: it re-keys itself
+        * every second, from the entropy pool (and thus creates a limited
+        * drain on it), and uses halfMD4Transform within the second. We
+        * also spice it with the TSC (if available), jiffies, PID and the
+        * stack address:
+        */
+       return secure_ip_id(val);
+}
+
+unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len)
+{
+       unsigned long range = end - len - start;
+       if (end <= start + len)
+               return 0;
+       return PAGE_ALIGN(get_random_int() % range + start);
+}
diff --git a/drivers/char/sn_serial.c b/drivers/char/sn_serial.c
deleted file mode 100644 (file)
index c3ba299..0000000
+++ /dev/null
@@ -1,1028 +0,0 @@
-/*
- * C-Brick Serial Port (and console) driver for SGI Altix machines.
- *
- * This driver is NOT suitable for talking to the l1-controller for
- * anything other than 'console activities' --- please use the l1
- * driver for that.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 Silicon Graphics, Inc. All rights reserved.
- */
-
-#include <linux/config.h>
-#include <linux/interrupt.h>
-#include <linux/tty.h>
-#include <linux/serial.h>
-#include <linux/console.h>
-#include <linux/module.h>
-#include <linux/sysrq.h>
-#include <linux/circ_buf.h>
-#include <linux/serial_reg.h>
-#include <asm/uaccess.h>
-#include <asm/sn/sgi.h>
-#include <asm/sn/sn_sal.h>
-#include <asm/sn/pci/pciio.h>
-#include <asm/sn/simulator.h>
-#include <asm/sn/sn2/sn_private.h>
-
-#if defined(CONFIG_SGI_L1_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-static char sysrq_serial_str[] = "\eSYS";
-static char *sysrq_serial_ptr = sysrq_serial_str;
-static unsigned long sysrq_requested;
-#endif /* CONFIG_SGI_L1_SERIAL_CONSOLE && CONFIG_MAGIC_SYSRQ */
-
-/* minor device number */
-#define SN_SAL_MINOR 64
-
-/* number of characters left in xmit buffer before we ask for more */
-#define WAKEUP_CHARS 128
-
-/* number of characters we can transmit to the SAL console at a time */
-#define SN_SAL_MAX_CHARS 120
-
-#define SN_SAL_EVENT_WRITE_WAKEUP 0
-
-/* 64K, when we're asynch, it must be at least printk's LOG_BUF_LEN to
- * avoid losing chars, (always has to be a power of 2) */
-#define SN_SAL_BUFFER_SIZE (64 * (1 << 10))
-
-#define SN_SAL_UART_FIFO_DEPTH 16
-#define SN_SAL_UART_FIFO_SPEED_CPS 9600/10
-
-/* we don't kmalloc/get_free_page these as we want them available
- * before either of those are initialized */
-static char sn_xmit_buff_mem[SN_SAL_BUFFER_SIZE];
-
-struct volatile_circ_buf {
-       char *cb_buf;
-       int cb_head;
-       int cb_tail;
-};
-
-static struct volatile_circ_buf xmit = { .cb_buf = sn_xmit_buff_mem };
-static char sn_tmp_buffer[SN_SAL_BUFFER_SIZE];
-
-static struct tty_struct *sn_sal_tty;
-
-static struct timer_list sn_sal_timer;
-static int sn_sal_event; /* event type for task queue */
-
-static int sn_sal_is_asynch;
-static int sn_sal_irq;
-static spinlock_t sn_sal_lock = SPIN_LOCK_UNLOCKED;
-static int sn_total_tx_count;
-static int sn_total_rx_count;
-
-static void sn_sal_tasklet_action(unsigned long data);
-static DECLARE_TASKLET(sn_sal_tasklet, sn_sal_tasklet_action, 0);
-
-static unsigned long sn_interrupt_timeout;
-
-extern u64 master_node_bedrock_address;
-
-#undef DEBUG
-#ifdef DEBUG
-static int sn_debug_printf(const char *fmt, ...);
-#define DPRINTF(x...) sn_debug_printf(x)
-#else
-#define DPRINTF(x...) do { } while (0)
-#endif
-
-struct sn_sal_ops {
-       int (*sal_puts)(const char *s, int len);
-       int (*sal_getc)(void);
-       int (*sal_input_pending)(void);
-       void (*sal_wakeup_transmit)(void);
-};
-
-/* This is the pointer used. It is assigned to point to one of
- * the tables below.
- */
-static struct sn_sal_ops *sn_func;
-
-/* Prototypes */
-static int snt_hw_puts(const char *, int);
-static int snt_poll_getc(void);
-static int snt_poll_input_pending(void);
-static int snt_sim_puts(const char *, int);
-static int snt_sim_getc(void);
-static int snt_sim_input_pending(void);
-static int snt_intr_getc(void);
-static int snt_intr_input_pending(void);
-static void sn_intr_transmit_chars(void);
-
-/* A table for polling */
-static struct sn_sal_ops poll_ops = {
-       .sal_puts               = snt_hw_puts,
-       .sal_getc               = snt_poll_getc,
-       .sal_input_pending      = snt_poll_input_pending
-};
-
-/* A table for the simulator */
-static struct sn_sal_ops sim_ops = {
-       .sal_puts               = snt_sim_puts,
-       .sal_getc               = snt_sim_getc,
-       .sal_input_pending      = snt_sim_input_pending
-};
-
-/* A table for interrupts enabled */
-static struct sn_sal_ops intr_ops = {
-       .sal_puts               = snt_hw_puts,
-       .sal_getc               = snt_intr_getc,
-       .sal_input_pending      = snt_intr_input_pending,
-       .sal_wakeup_transmit    = sn_intr_transmit_chars
-};
-
-
-/* the console does output in two distinctly different ways:
- * synchronous and asynchronous (buffered).  initally, early_printk
- * does synchronous output.  any data written goes directly to the SAL
- * to be output (incidentally, it is internally buffered by the SAL)
- * after interrupts and timers are initialized and available for use,
- * the console init code switches to asynchronous output.  this is
- * also the earliest opportunity to begin polling for console input.
- * after console initialization, console output and tty (serial port)
- * output is buffered and sent to the SAL asynchronously (either by
- * timer callback or by UART interrupt) */
-
-
-/* routines for running the console in polling mode */
-
-static int
-snt_hw_puts(const char *s, int len)
-{
-       /* looking at the PROM source code, putb calls the flush
-        * routine, so if we send characters in FIFO sized chunks, it
-        * should go out by the next time the timer gets called */
-       return ia64_sn_console_putb(s, len);
-}
-
-static int
-snt_poll_getc(void)
-{
-       int ch;
-       ia64_sn_console_getc(&ch);
-       return ch;
-}
-
-static int
-snt_poll_input_pending(void)
-{
-       int status, input;
-
-       status = ia64_sn_console_check(&input);
-       return !status && input;
-}
-
-
-/* routines for running the console on the simulator */
-
-static int
-snt_sim_puts(const char *str, int count)
-{
-       int counter = count;
-
-#ifdef FLAG_DIRECT_CONSOLE_WRITES
-       /* This is an easy way to pre-pend the output to know whether the output
-        * was done via sal or directly */
-       writeb('[', master_node_bedrock_address + (UART_TX << 3));
-       writeb('+', master_node_bedrock_address + (UART_TX << 3));
-       writeb(']', master_node_bedrock_address + (UART_TX << 3));
-       writeb(' ', master_node_bedrock_address + (UART_TX << 3));
-#endif /* FLAG_DIRECT_CONSOLE_WRITES */
-       while (counter > 0) {
-               writeb(*str, master_node_bedrock_address + (UART_TX << 3));
-               counter--;
-               str++;
-       }
-
-       return count;
-}
-
-static int
-snt_sim_getc(void)
-{
-       return readb(master_node_bedrock_address + (UART_RX << 3));
-}
-
-static int
-snt_sim_input_pending(void)
-{
-       return readb(master_node_bedrock_address + (UART_LSR << 3)) & UART_LSR_DR;
-}
-
-
-/* routines for an interrupt driven console (normal) */
-
-static int
-snt_intr_getc(void)
-{
-       return ia64_sn_console_readc();
-}
-
-static int
-snt_intr_input_pending(void)
-{
-       return ia64_sn_console_intr_status() & SAL_CONSOLE_INTR_RECV;
-}
-
-/* The early printk (possible setup) and function call */
-
-void
-early_printk_sn_sal(const char *s, unsigned count)
-{
-       extern void early_sn_setup(void);
-
-       if (!sn_func) {
-               if (IS_RUNNING_ON_SIMULATOR())
-                       sn_func = &sim_ops;
-               else
-                       sn_func = &poll_ops;
-
-               early_sn_setup();
-       }
-       sn_func->sal_puts(s, count);
-}
-
-#ifdef DEBUG
-/* this is as "close to the metal" as we can get, used when the driver
- * itself may be broken */
-static int
-sn_debug_printf(const char *fmt, ...)
-{
-       static char printk_buf[1024];
-       int printed_len;
-       va_list args;
-
-       va_start(args, fmt);
-       printed_len = vscnprintf(printk_buf, sizeof(printk_buf), fmt, args);
-       early_printk_sn_sal(printk_buf, printed_len);
-       va_end(args);
-       return printed_len;
-}
-#endif /* DEBUG */
-
-/*
- * Interrupt handling routines.
- */
-
-static void
-sn_sal_sched_event(int event)
-{
-       sn_sal_event |= (1 << event);
-       tasklet_schedule(&sn_sal_tasklet);
-}
-
-/* sn_receive_chars can be called before sn_sal_tty is initialized.  in
- * that case, its only use is to trigger sysrq and kdb */
-static void
-sn_receive_chars(struct pt_regs *regs, unsigned long *flags)
-{
-       int ch;
-
-       while (sn_func->sal_input_pending()) {
-               ch = sn_func->sal_getc();
-               if (ch < 0) {
-                       printk(KERN_ERR "sn_serial: An error occured while "
-                              "obtaining data from the console (0x%0x)\n", ch);
-                       break;
-               }
-#if defined(CONFIG_SGI_L1_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-               if (sysrq_requested) {
-                       unsigned long sysrq_timeout = sysrq_requested + HZ*5;
-
-                       sysrq_requested = 0;
-                       if (ch && time_before(jiffies, sysrq_timeout)) {
-                               spin_unlock_irqrestore(&sn_sal_lock, *flags);
-                               handle_sysrq(ch, regs, NULL);
-                               spin_lock_irqsave(&sn_sal_lock, *flags);
-                               /* don't record this char */
-                               continue;
-                       }
-               }
-               if (ch == *sysrq_serial_ptr) {
-                       if (!(*++sysrq_serial_ptr)) {
-                               sysrq_requested = jiffies;
-                               sysrq_serial_ptr = sysrq_serial_str;
-                       }
-               }
-               else
-                       sysrq_serial_ptr = sysrq_serial_str;
-#endif /* CONFIG_SGI_L1_SERIAL_CONSOLE && CONFIG_MAGIC_SYSRQ */
-
-               /* record the character to pass up to the tty layer */
-               if (sn_sal_tty) {
-                       *sn_sal_tty->flip.char_buf_ptr = ch;
-                       sn_sal_tty->flip.char_buf_ptr++;
-                       sn_sal_tty->flip.count++;
-                       if (sn_sal_tty->flip.count == TTY_FLIPBUF_SIZE)
-                               break;
-               }
-               sn_total_rx_count++;
-       }
-
-       if (sn_sal_tty)
-               tty_flip_buffer_push((struct tty_struct *)sn_sal_tty);
-}
-
-
-/* synch_flush_xmit must be called with sn_sal_lock */
-static void
-synch_flush_xmit(void)
-{
-       int xmit_count, tail, head, loops, ii;
-       int result;
-       char *start;
-
-       if (xmit.cb_head == xmit.cb_tail)
-               return; /* Nothing to do. */
-
-       head = xmit.cb_head;
-       tail = xmit.cb_tail;
-       start = &xmit.cb_buf[tail];
-
-       /* twice around gets the tail to the end of the buffer and
-        * then to the head, if needed */
-       loops = (head < tail) ? 2 : 1;
-
-       for (ii = 0; ii < loops; ii++) {
-               xmit_count = (head < tail) ?  (SN_SAL_BUFFER_SIZE - tail) : (head - tail);
-
-               if (xmit_count > 0) {
-                       result = sn_func->sal_puts((char *)start, xmit_count);
-                       if (!result)
-                               DPRINTF("\n*** synch_flush_xmit failed to flush\n");
-                       if (result > 0) {
-                               xmit_count -= result;
-                               sn_total_tx_count += result;
-                               tail += result;
-                               tail &= SN_SAL_BUFFER_SIZE - 1;
-                               xmit.cb_tail = tail;
-                               start = (char *)&xmit.cb_buf[tail];
-                       }
-               }
-       }
-}
-
-/* must be called with a lock protecting the circular buffer and
- * sn_sal_tty */
-static void
-sn_poll_transmit_chars(void)
-{
-       int xmit_count, tail, head;
-       int result;
-       char *start;
-
-       BUG_ON(!sn_sal_is_asynch);
-
-       if (xmit.cb_head == xmit.cb_tail ||
-           (sn_sal_tty && (sn_sal_tty->stopped || sn_sal_tty->hw_stopped))) {
-               /* Nothing to do. */
-               return;
-       }
-
-       head = xmit.cb_head;
-       tail = xmit.cb_tail;
-       start = &xmit.cb_buf[tail];
-
-       xmit_count = (head < tail) ?  (SN_SAL_BUFFER_SIZE - tail) : (head - tail);
-
-       if (xmit_count == 0)
-               DPRINTF("\n*** empty xmit_count\n");
-
-       /* use the ops, as we could be on the simulator */
-       result = sn_func->sal_puts((char *)start, xmit_count);
-       if (!result)
-               DPRINTF("\n*** error in synchronous sal_puts\n");
-       /* XXX chadt clean this up */
-       if (result > 0) {
-               xmit_count -= result;
-               sn_total_tx_count += result;
-               tail += result;
-               tail &= SN_SAL_BUFFER_SIZE - 1;
-               xmit.cb_tail = tail;
-               start = &xmit.cb_buf[tail];
-       }
-
-       /* if there's few enough characters left in the xmit buffer
-        * that we could stand for the upper layer to send us some
-        * more, ask for it. */
-       if (sn_sal_tty)
-               if (CIRC_CNT(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE) < WAKEUP_CHARS)
-                       sn_sal_sched_event(SN_SAL_EVENT_WRITE_WAKEUP);
-}
-
-
-/* must be called with a lock protecting the circular buffer and
- * sn_sal_tty */
-static void
-sn_intr_transmit_chars(void)
-{
-       int xmit_count, tail, head, loops, ii;
-       int result;
-       char *start;
-
-       BUG_ON(!sn_sal_is_asynch);
-
-       if (xmit.cb_head == xmit.cb_tail ||
-           (sn_sal_tty && (sn_sal_tty->stopped || sn_sal_tty->hw_stopped))) {
-               /* Nothing to do. */
-               return;
-       }
-
-       head = xmit.cb_head;
-       tail = xmit.cb_tail;
-       start = &xmit.cb_buf[tail];
-
-       /* twice around gets the tail to the end of the buffer and
-        * then to the head, if needed */
-       loops = (head < tail) ? 2 : 1;
-
-       for (ii = 0; ii < loops; ii++) {
-               xmit_count = (head < tail) ?
-                       (SN_SAL_BUFFER_SIZE - tail) : (head - tail);
-
-               if (xmit_count > 0) {
-                       result = ia64_sn_console_xmit_chars((char *)start, xmit_count);
-#ifdef DEBUG
-                       if (!result)
-                               DPRINTF("`");
-#endif
-                       if (result > 0) {
-                               xmit_count -= result;
-                               sn_total_tx_count += result;
-                               tail += result;
-                               tail &= SN_SAL_BUFFER_SIZE - 1;
-                               xmit.cb_tail = tail;
-                               start = &xmit.cb_buf[tail];
-                       }
-               }
-       }
-
-       /* if there's few enough characters left in the xmit buffer
-        * that we could stand for the upper layer to send us some
-        * more, ask for it. */
-       if (sn_sal_tty)
-               if (CIRC_CNT(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE) < WAKEUP_CHARS)
-                       sn_sal_sched_event(SN_SAL_EVENT_WRITE_WAKEUP);
-}
-
-
-static irqreturn_t
-sn_sal_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-       /* this call is necessary to pass the interrupt back to the
-        * SAL, since it doesn't intercept the UART interrupts
-        * itself */
-       int status = ia64_sn_console_intr_status();
-       unsigned long flags;
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       if (status & SAL_CONSOLE_INTR_RECV)
-               sn_receive_chars(regs, &flags);
-       if (status & SAL_CONSOLE_INTR_XMIT)
-               sn_intr_transmit_chars();
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-       return IRQ_HANDLED;
-}
-
-
-/* returns the console irq if interrupt is successfully registered,
- * else 0 */
-static int
-sn_sal_connect_interrupt(void)
-{
-       cpuid_t intr_cpuid;
-       unsigned int intr_cpuloc;
-       nasid_t console_nasid;
-       unsigned int console_irq;
-       int result;
-
-       console_nasid = ia64_sn_get_console_nasid();
-       intr_cpuid = first_cpu(node_to_cpumask(nasid_to_cnodeid(console_nasid)));
-       intr_cpuloc = cpu_physical_id(intr_cpuid);
-       console_irq = CPU_VECTOR_TO_IRQ(intr_cpuloc, SGI_UART_VECTOR);
-
-       result = intr_connect_level(intr_cpuid, SGI_UART_VECTOR);
-       BUG_ON(result != SGI_UART_VECTOR);
-
-       result = request_irq(console_irq, sn_sal_interrupt, SA_INTERRUPT,  "SAL console driver", &sn_sal_tty);
-       if (result >= 0)
-               return console_irq;
-
-       printk(KERN_WARNING "sn_serial: console proceeding in polled mode\n");
-       return 0;
-}
-
-static void
-sn_sal_tasklet_action(unsigned long data)
-{
-       unsigned long flags;
-
-       if (sn_sal_tty) {
-               spin_lock_irqsave(&sn_sal_lock, flags);
-               if (sn_sal_tty) {
-                       if (test_and_clear_bit(SN_SAL_EVENT_WRITE_WAKEUP, &sn_sal_event)) {
-                               if ((sn_sal_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && sn_sal_tty->ldisc.write_wakeup)
-                                       (sn_sal_tty->ldisc.write_wakeup)((struct tty_struct *)sn_sal_tty);
-                               wake_up_interruptible((wait_queue_head_t *)&sn_sal_tty->write_wait);
-                       }
-               }
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-       }
-}
-
-
-/*
- * This function handles polled mode.
- */
-static void
-sn_sal_timer_poll(unsigned long dummy)
-{
-       unsigned long flags;
-
-       if (!sn_sal_irq) {
-               spin_lock_irqsave(&sn_sal_lock, flags);
-               sn_receive_chars(NULL, &flags);
-               sn_poll_transmit_chars();
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-               mod_timer(&sn_sal_timer, jiffies + sn_interrupt_timeout);
-       }
-}
-
-
-/*
- * User-level console routines
- */
-
-static int
-sn_sal_open(struct tty_struct *tty, struct file *filp)
-{
-       unsigned long flags;
-
-       DPRINTF("sn_sal_open: sn_sal_tty = %p, tty = %p, filp = %p\n",
-               sn_sal_tty, tty, filp);
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       if (!sn_sal_tty)
-               sn_sal_tty = tty;
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-
-       return 0;
-}
-
-
-/* We're keeping all our resources.  We're keeping interrupts turned
- * on.  Maybe just let the tty layer finish its stuff...? GMSH
- */
-static void
-sn_sal_close(struct tty_struct *tty, struct file * filp)
-{
-       if (tty->count == 1) {
-               unsigned long flags;
-               tty->closing = 1;
-               if (tty->driver->flush_buffer)
-                       tty->driver->flush_buffer(tty);
-               if (tty->ldisc.flush_buffer)
-                       tty->ldisc.flush_buffer(tty);
-               tty->closing = 0;
-               spin_lock_irqsave(&sn_sal_lock, flags);
-               sn_sal_tty = NULL;
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-       }
-}
-
-
-static int
-sn_sal_write(struct tty_struct *tty, int from_user,
-            const unsigned char *buf, int count)
-{
-       int c, ret = 0;
-       unsigned long flags;
-
-       if (from_user) {
-               while (1) {
-                       int c1;
-                       c = CIRC_SPACE_TO_END(xmit.cb_head, xmit.cb_tail,
-                                             SN_SAL_BUFFER_SIZE);
-
-                       if (count < c)
-                               c = count;
-                       if (c <= 0)
-                               break;
-
-                       c -= copy_from_user(sn_tmp_buffer, buf, c);
-                       if (!c) {
-                               if (!ret)
-                                       ret = -EFAULT;
-                               break;
-                       }
-
-                       /* Turn off interrupts and see if the xmit buffer has
-                        * moved since the last time we looked.
-                        */
-                       spin_lock_irqsave(&sn_sal_lock, flags);
-                       c1 = CIRC_SPACE_TO_END(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE);
-
-                       if (c1 < c)
-                               c = c1;
-
-                       memcpy(xmit.cb_buf + xmit.cb_head, sn_tmp_buffer, c);
-                       xmit.cb_head = ((xmit.cb_head + c) & (SN_SAL_BUFFER_SIZE - 1));
-                       spin_unlock_irqrestore(&sn_sal_lock, flags);
-
-                       buf += c;
-                       count -= c;
-                       ret += c;
-               }
-       }
-       else {
-               /* The buffer passed in isn't coming from userland,
-                * so cut out the middleman (sn_tmp_buffer).
-                */
-               spin_lock_irqsave(&sn_sal_lock, flags);
-               while (1) {
-                       c = CIRC_SPACE_TO_END(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE);
-
-                       if (count < c)
-                               c = count;
-                       if (c <= 0) {
-                               break;
-                       }
-                       memcpy(xmit.cb_buf + xmit.cb_head, buf, c);
-                       xmit.cb_head = ((xmit.cb_head + c) & (SN_SAL_BUFFER_SIZE - 1));
-                       buf += c;
-                       count -= c;
-                       ret += c;
-               }
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-       }
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       if (xmit.cb_head != xmit.cb_tail && !(tty && (tty->stopped || tty->hw_stopped)))
-               if (sn_func->sal_wakeup_transmit)
-                       sn_func->sal_wakeup_transmit();
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-
-       return ret;
-}
-
-
-static void
-sn_sal_put_char(struct tty_struct *tty, unsigned char ch)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       if (CIRC_SPACE(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE) != 0) {
-               xmit.cb_buf[xmit.cb_head] = ch;
-               xmit.cb_head = (xmit.cb_head + 1) & (SN_SAL_BUFFER_SIZE-1);
-               if ( sn_func->sal_wakeup_transmit )
-                       sn_func->sal_wakeup_transmit();
-       }
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-}
-
-
-static void
-sn_sal_flush_chars(struct tty_struct *tty)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       if (CIRC_CNT(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE))
-               if (sn_func->sal_wakeup_transmit)
-                       sn_func->sal_wakeup_transmit();
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-}
-
-
-static int
-sn_sal_write_room(struct tty_struct *tty)
-{
-       unsigned long flags;
-       int space;
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       space = CIRC_SPACE(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE);
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-       return space;
-}
-
-
-static int
-sn_sal_chars_in_buffer(struct tty_struct *tty)
-{
-       unsigned long flags;
-       int space;
-
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       space = CIRC_CNT(xmit.cb_head, xmit.cb_tail, SN_SAL_BUFFER_SIZE);
-       DPRINTF("<%d>", space);
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-       return space;
-}
-
-
-static void
-sn_sal_flush_buffer(struct tty_struct *tty)
-{
-       unsigned long flags;
-
-       /* drop everything */
-       spin_lock_irqsave(&sn_sal_lock, flags);
-       xmit.cb_head = xmit.cb_tail = 0;
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-
-       /* wake up tty level */
-       wake_up_interruptible(&tty->write_wait);
-       if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup)
-               (tty->ldisc.write_wakeup)(tty);
-}
-
-
-static void
-sn_sal_hangup(struct tty_struct *tty)
-{
-       sn_sal_flush_buffer(tty);
-}
-
-
-static void
-sn_sal_wait_until_sent(struct tty_struct *tty, int timeout)
-{
-       /* this is SAL's problem */
-       DPRINTF("<sn_serial: should wait until sent>");
-}
-
-
-/*
- * sn_sal_read_proc
- *
- * Console /proc interface
- */
-
-static int
-sn_sal_read_proc(char *page, char **start, off_t off, int count,
-                  int *eof, void *data)
-{
-       int len = 0;
-       off_t   begin = 0;
-
-       len += sprintf(page, "sn_serial: nasid:%ld irq:%d tx:%d rx:%d\n",
-                      ia64_sn_get_console_nasid(), sn_sal_irq,
-                      sn_total_tx_count, sn_total_rx_count);
-       *eof = 1;
-
-       if (off >= len+begin)
-               return 0;
-       *start = page + (off-begin);
-
-       return count < begin+len-off ? count : begin+len-off;
-}
-
-
-static struct tty_operations sn_sal_driver_ops = {
-       .open            = sn_sal_open,
-       .close           = sn_sal_close,
-       .write           = sn_sal_write,
-       .put_char        = sn_sal_put_char,
-       .flush_chars     = sn_sal_flush_chars,
-       .write_room      = sn_sal_write_room,
-       .chars_in_buffer = sn_sal_chars_in_buffer,
-       .hangup          = sn_sal_hangup,
-       .wait_until_sent = sn_sal_wait_until_sent,
-       .read_proc       = sn_sal_read_proc,
-};
-static struct tty_driver *sn_sal_driver;
-
-/* sn_sal_init wishlist:
- * - allocate sn_tmp_buffer
- * - fix up the tty_driver struct
- * - turn on receive interrupts
- * - do any termios twiddling once and for all
- */
-
-/*
- * Boot-time initialization code
- */
-
-static void __init
-sn_sal_switch_to_asynch(void)
-{
-       unsigned long flags;
-
-       /* without early_printk, we may be invoked late enough to race
-        * with other cpus doing console IO at this point, however
-        * console interrupts will never be enabled */
-       spin_lock_irqsave(&sn_sal_lock, flags);
-
-       if (sn_sal_is_asynch) {
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-               return;
-       }
-
-       DPRINTF("sn_serial: switch to asynchronous console\n");
-
-       /* early_printk invocation may have done this for us */
-       if (!sn_func) {
-               if (IS_RUNNING_ON_SIMULATOR())
-                       sn_func = &sim_ops;
-               else
-                       sn_func = &poll_ops;
-       }
-
-       /* we can't turn on the console interrupt (as request_irq
-        * calls kmalloc, which isn't set up yet), so we rely on a
-        * timer to poll for input and push data from the console
-        * buffer.
-        */
-       init_timer(&sn_sal_timer);
-       sn_sal_timer.function = sn_sal_timer_poll;
-
-       if (IS_RUNNING_ON_SIMULATOR())
-               sn_interrupt_timeout = 6;
-       else {
-               /* 960cps / 16 char FIFO = 60HZ
-                * HZ / (SN_SAL_FIFO_SPEED_CPS / SN_SAL_FIFO_DEPTH) */
-               sn_interrupt_timeout = HZ * SN_SAL_UART_FIFO_DEPTH / SN_SAL_UART_FIFO_SPEED_CPS;
-       }
-       mod_timer(&sn_sal_timer, jiffies + sn_interrupt_timeout);
-
-       sn_sal_is_asynch = 1;
-       spin_unlock_irqrestore(&sn_sal_lock, flags);
-}
-
-static void __init
-sn_sal_switch_to_interrupts(void)
-{
-       int irq;
-
-       DPRINTF("sn_serial: switching to interrupt driven console\n");
-
-       irq = sn_sal_connect_interrupt();
-       if (irq) {
-               unsigned long flags;
-               spin_lock_irqsave(&sn_sal_lock, flags);
-
-               /* sn_sal_irq is a global variable.  When it's set to
-                * a non-zero value, we stop polling for input (since
-                * interrupts should now be enabled). */
-               sn_sal_irq = irq;
-               sn_func = &intr_ops;
-
-               /* turn on receive interrupts */
-               ia64_sn_console_intr_enable(SAL_CONSOLE_INTR_RECV);
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-       }
-}
-
-static int __init
-sn_sal_module_init(void)
-{
-       int retval;
-
-       DPRINTF("sn_serial: sn_sal_module_init\n");
-
-       if (!ia64_platform_is("sn2"))
-               return -ENODEV;
-
-       sn_sal_driver = alloc_tty_driver(1);
-       if ( !sn_sal_driver )
-               return -ENOMEM;
-
-       sn_sal_driver->owner = THIS_MODULE;
-       sn_sal_driver->driver_name = "sn_serial";
-       sn_sal_driver->name = "ttyS";
-       sn_sal_driver->major = TTY_MAJOR;
-       sn_sal_driver->minor_start = SN_SAL_MINOR;
-       sn_sal_driver->type = TTY_DRIVER_TYPE_SERIAL;
-       sn_sal_driver->subtype = SERIAL_TYPE_NORMAL;
-       sn_sal_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
-
-       tty_set_operations(sn_sal_driver, &sn_sal_driver_ops);
-
-       /* when this driver is compiled in, the console initialization
-        * will have already switched us into asynchronous operation
-        * before we get here through the module initcalls */
-       sn_sal_switch_to_asynch();
-
-       /* at this point (module_init) we can try to turn on interrupts */
-       if (!IS_RUNNING_ON_SIMULATOR())
-           sn_sal_switch_to_interrupts();
-
-       sn_sal_driver->init_termios = tty_std_termios;
-       sn_sal_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-
-       if ((retval = tty_register_driver(sn_sal_driver))) {
-               printk(KERN_ERR "sn_serial: Unable to register tty driver\n");
-               return retval;
-       }
-       return 0;
-}
-
-
-static void __exit
-sn_sal_module_exit(void)
-{
-       del_timer_sync(&sn_sal_timer);
-       tty_unregister_driver(sn_sal_driver);
-       put_tty_driver(sn_sal_driver);
-}
-
-module_init(sn_sal_module_init);
-module_exit(sn_sal_module_exit);
-
-/*
- * Kernel console definitions
- */
-
-#ifdef CONFIG_SGI_L1_SERIAL_CONSOLE
-/*
- * Print a string to the SAL console.  The console_lock must be held
- * when we get here.
- */
-static void
-sn_sal_console_write(struct console *co, const char *s, unsigned count)
-{
-       unsigned long flags;
-       const char *s1;
-
-       BUG_ON(!sn_sal_is_asynch);
-
-       /* somebody really wants this output, might be an
-        * oops, kdb, panic, etc.  make sure they get it. */
-       if (spin_is_locked(&sn_sal_lock)) {
-               synch_flush_xmit();
-               /* Output '\r' before each '\n' */
-               while ((s1 = memchr(s, '\n', count)) != NULL) {
-                       sn_func->sal_puts(s, s1 - s);
-                       sn_func->sal_puts("\r\n", 2);
-                       count -= s1 + 1 - s;
-                       s = s1 + 1;
-               }
-               sn_func->sal_puts(s, count);
-       }
-       else if (in_interrupt()) {
-               spin_lock_irqsave(&sn_sal_lock, flags);
-               synch_flush_xmit();
-               spin_unlock_irqrestore(&sn_sal_lock, flags);
-               /* Output '\r' before each '\n' */
-               while ((s1 = memchr(s, '\n', count)) != NULL) {
-                       sn_func->sal_puts(s, s1 - s);
-                       sn_func->sal_puts("\r\n", 2);
-                       count -= s1 + 1 - s;
-                       s = s1 + 1;
-               }
-               sn_func->sal_puts(s, count);
-       }
-       else {
-               /* Output '\r' before each '\n' */
-               while ((s1 = memchr(s, '\n', count)) != NULL) {
-                       sn_sal_write(NULL, 0, s, s1 - s);
-                       sn_sal_write(NULL, 0, "\r\n", 2);
-                       count -= s1 + 1 - s;
-                       s = s1 + 1;
-               }
-               sn_sal_write(NULL, 0, s, count);
-       }
-}
-
-static struct tty_driver *
-sn_sal_console_device(struct console *c, int *index)
-{
-       *index = c->index;
-       return sn_sal_driver;
-}
-
-static int __init
-sn_sal_console_setup(struct console *co, char *options)
-{
-       return 0;
-}
-
-
-static struct console sal_console = {
-       .name = "ttyS",
-       .write = sn_sal_console_write,
-       .device = sn_sal_console_device,
-       .setup = sn_sal_console_setup,
-       .index = -1
-};
-
-static int __init
-sn_sal_serial_console_init(void)
-{
-       if (ia64_platform_is("sn2")) {
-               sn_sal_switch_to_asynch();
-               DPRINTF("sn_sal_serial_console_init : register console\n");
-               register_console(&sal_console);
-       }
-       return 0;
-}
-console_initcall(sn_sal_serial_console_init);
-
-#endif /* CONFIG_SGI_L1_SERIAL_CONSOLE */
index d22a496..0eb8f46 100644 (file)
@@ -336,7 +336,7 @@ struct sonypi_eventtypes {
        { SONYPI_DEVICE_MODEL_TYPE2, 0x41, SONYPI_BATTERY_MASK, sonypi_batteryev },
        { SONYPI_DEVICE_MODEL_TYPE2, 0x31, SONYPI_PKEY_MASK, sonypi_pkeyev },
 
-       { 0, 0, 0, 0 }
+       { 0 }
 };
 
 #define SONYPI_BUF_SIZE        128
index 04955d4..a0b3ba7 100644 (file)
@@ -504,13 +504,13 @@ static int        stl_readproc(char *page, char **start, off_t off, int count, int *eof
 static int     stl_brdinit(stlbrd_t *brdp);
 static int     stl_initports(stlbrd_t *brdp, stlpanel_t *panelp);
 static int     stl_mapirq(int irq, char *name);
-static int     stl_getserial(stlport_t *portp, struct serial_struct *sp);
-static int     stl_setserial(stlport_t *portp, struct serial_struct *sp);
-static int     stl_getbrdstats(combrd_t *bp);
-static int     stl_getportstats(stlport_t *portp, comstats_t *cp);
-static int     stl_clrportstats(stlport_t *portp, comstats_t *cp);
-static int     stl_getportstruct(unsigned long arg);
-static int     stl_getbrdstruct(unsigned long arg);
+static int     stl_getserial(stlport_t *portp, struct serial_struct __user *sp);
+static int     stl_setserial(stlport_t *portp, struct serial_struct __user *sp);
+static int     stl_getbrdstats(combrd_t __user *bp);
+static int     stl_getportstats(stlport_t *portp, comstats_t __user *cp);
+static int     stl_clrportstats(stlport_t *portp, comstats_t __user *cp);
+static int     stl_getportstruct(stlport_t __user *arg);
+static int     stl_getbrdstruct(stlbrd_t __user *arg);
 static int     stl_waitcarrier(stlport_t *portp, struct file *filp);
 static void    stl_delay(int len);
 static void    stl_eiointr(stlbrd_t *brdp);
@@ -745,7 +745,7 @@ static int __init stallion_module_init(void)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("init_module()\n");
 #endif
 
@@ -767,7 +767,7 @@ static void __exit stallion_module_exit(void)
        unsigned long   flags;
        int             i, j, k;
 
-#if DEBUG
+#ifdef DEBUG
        printk("cleanup_module()\n");
 #endif
 
@@ -847,13 +847,13 @@ module_exit(stallion_module_exit);
  *     Check for any arguments passed in on the module load command line.
  */
 
-static void stl_argbrds()
+static void stl_argbrds(void)
 {
        stlconf_t       conf;
        stlbrd_t        *brdp;
        int             nrargs, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_argbrds()\n");
 #endif
 
@@ -923,7 +923,7 @@ static int stl_parsebrd(stlconf_t *confp, char **argp)
        char    *sp;
        int     nrbrdnames, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp);
 #endif
 
@@ -978,7 +978,7 @@ static void *stl_memalloc(int len)
  *     Allocate a new board structure. Fill out the basic info in it.
  */
 
-static stlbrd_t *stl_allocbrd()
+static stlbrd_t *stl_allocbrd(void)
 {
        stlbrd_t        *brdp;
 
@@ -1003,7 +1003,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp)
        unsigned int    minordev;
        int             brdnr, panelnr, portnr, rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_open(tty=%x,filp=%x): device=%s\n", (int) tty,
                (int) filp, tty->name);
 #endif
@@ -1096,7 +1096,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp)
        unsigned long   flags;
        int             rc, doclocal;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_waitcarrier(portp=%x,filp=%x)\n", (int) portp, (int) filp);
 #endif
 
@@ -1148,7 +1148,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
        stlport_t       *portp;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_close(tty=%x,filp=%x)\n", (int) tty, (int) filp);
 #endif
 
@@ -1224,7 +1224,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp)
 
 static void stl_delay(int len)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stl_delay(len=%d)\n", len);
 #endif
        if (len > 0) {
@@ -1247,7 +1247,7 @@ static int stl_write(struct tty_struct *tty, int from_user, const unsigned char
        unsigned char   *chbuf;
        char            *head, *tail;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_write(tty=%x,from_user=%d,buf=%x,count=%d)\n",
                (int) tty, from_user, (int) buf, count);
 #endif
@@ -1324,7 +1324,7 @@ static void stl_putchar(struct tty_struct *tty, unsigned char ch)
        unsigned int    len;
        char            *head, *tail;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch);
 #endif
 
@@ -1362,7 +1362,7 @@ static void stl_flushchars(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_flushchars(tty=%x)\n", (int) tty);
 #endif
 
@@ -1389,7 +1389,7 @@ static int stl_writeroom(struct tty_struct *tty)
        stlport_t       *portp;
        char            *head, *tail;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_writeroom(tty=%x)\n", (int) tty);
 #endif
 
@@ -1423,7 +1423,7 @@ static int stl_charsinbuffer(struct tty_struct *tty)
        unsigned int    size;
        char            *head, *tail;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_charsinbuffer(tty=%x)\n", (int) tty);
 #endif
 
@@ -1449,12 +1449,12 @@ static int stl_charsinbuffer(struct tty_struct *tty)
  *     Generate the serial struct info.
  */
 
-static int stl_getserial(stlport_t *portp, struct serial_struct *sp)
+static int stl_getserial(stlport_t *portp, struct serial_struct __user *sp)
 {
        struct serial_struct    sio;
        stlbrd_t                *brdp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
 #endif
 
@@ -1490,11 +1490,11 @@ static int stl_getserial(stlport_t *portp, struct serial_struct *sp)
  *     just quietly ignore any requests to change irq, etc.
  */
 
-static int stl_setserial(stlport_t *portp, struct serial_struct *sp)
+static int stl_setserial(stlport_t *portp, struct serial_struct __user *sp)
 {
        struct serial_struct    sio;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp);
 #endif
 
@@ -1567,8 +1567,9 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
        stlport_t       *portp;
        unsigned int    ival;
        int             rc;
+       void __user *argp = (void __user *)arg;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n",
                (int) tty, (int) file, cmd, (int) arg);
 #endif
@@ -1590,36 +1591,26 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd
        switch (cmd) {
        case TIOCGSOFTCAR:
                rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0),
-                       (unsigned int *) arg);
+                       (unsigned __user *) argp);
                break;
        case TIOCSSOFTCAR:
-               if ((rc = verify_area(VERIFY_READ, (void *) arg,
-                   sizeof(int))) == 0) {
-                       get_user(ival, (unsigned int *) arg);
-                       tty->termios->c_cflag =
+               if (get_user(ival, (unsigned int __user *) arg))
+                       return -EFAULT;
+               tty->termios->c_cflag =
                                (tty->termios->c_cflag & ~CLOCAL) |
                                (ival ? CLOCAL : 0);
-               }
                break;
        case TIOCGSERIAL:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(struct serial_struct))) == 0)
-                       rc = stl_getserial(portp, (struct serial_struct *) arg);
+               rc = stl_getserial(portp, argp);
                break;
        case TIOCSSERIAL:
-               if ((rc = verify_area(VERIFY_READ, (void *) arg,
-                   sizeof(struct serial_struct))) == 0)
-                       rc = stl_setserial(portp, (struct serial_struct *) arg);
+               rc = stl_setserial(portp, argp);
                break;
        case COM_GETPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stl_getportstats(portp, (comstats_t *) arg);
+               rc = stl_getportstats(portp, argp);
                break;
        case COM_CLRPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stl_clrportstats(portp, (comstats_t *) arg);
+               rc = stl_clrportstats(portp, argp);
                break;
        case TIOCSERCONFIG:
        case TIOCSERGWILD:
@@ -1643,7 +1634,7 @@ static void stl_settermios(struct tty_struct *tty, struct termios *old)
        stlport_t       *portp;
        struct termios  *tiosp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_settermios(tty=%x,old=%x)\n", (int) tty, (int) old);
 #endif
 
@@ -1680,7 +1671,7 @@ static void stl_throttle(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_throttle(tty=%x)\n", (int) tty);
 #endif
 
@@ -1702,7 +1693,7 @@ static void stl_unthrottle(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_unthrottle(tty=%x)\n", (int) tty);
 #endif
 
@@ -1725,7 +1716,7 @@ static void stl_stop(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_stop(tty=%x)\n", (int) tty);
 #endif
 
@@ -1747,7 +1738,7 @@ static void stl_start(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_start(tty=%x)\n", (int) tty);
 #endif
 
@@ -1771,7 +1762,7 @@ static void stl_hangup(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_hangup(tty=%x)\n", (int) tty);
 #endif
 
@@ -1807,7 +1798,7 @@ static void stl_flushbuffer(struct tty_struct *tty)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_flushbuffer(tty=%x)\n", (int) tty);
 #endif
 
@@ -1830,7 +1821,7 @@ static void stl_breakctl(struct tty_struct *tty, int state)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_breakctl(tty=%x,state=%d)\n", (int) tty, state);
 #endif
 
@@ -1850,7 +1841,7 @@ static void stl_waituntilsent(struct tty_struct *tty, int timeout)
        stlport_t       *portp;
        unsigned long   tend;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_waituntilsent(tty=%x,timeout=%d)\n", (int) tty, timeout);
 #endif
 
@@ -1879,7 +1870,7 @@ static void stl_sendxchar(struct tty_struct *tty, char ch)
 {
        stlport_t       *portp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch);
 #endif
 
@@ -1960,7 +1951,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof
        int             curoff, maxoff;
        char            *pos;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x,"
                "data=%x\n", (int) page, (int) start, (int) off, count,
                (int) eof, (int) data);
@@ -2043,7 +2034,7 @@ static irqreturn_t stl_intr(int irq, void *dev_id, struct pt_regs *regs)
        int             i;
        int handled = 0;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_intr(irq=%d,regs=%x)\n", irq, (int) regs);
 #endif
 
@@ -2189,7 +2180,7 @@ static void stl_offintr(void *private)
 
        portp = private;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_offintr(portp=%x)\n", (int) portp);
 #endif
 
@@ -2233,7 +2224,7 @@ static int __init stl_mapirq(int irq, char *name)
 {
        int     rc, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_mapirq(irq=%d,name=%s)\n", irq, name);
 #endif
 
@@ -2265,7 +2256,7 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp)
        stlport_t       *portp;
        int             chipmask, i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_initports(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp);
 #endif
 
@@ -2319,7 +2310,7 @@ static inline int stl_initeio(stlbrd_t *brdp)
        char            *name;
        int             rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_initeio(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -2457,7 +2448,7 @@ static inline int stl_initech(stlbrd_t *brdp)
        int             panelnr, banknr, i;
        char            *name;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_initech(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -2661,7 +2652,7 @@ static int __init stl_brdinit(stlbrd_t *brdp)
 {
        int     i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_brdinit(brdp=%x)\n", (int) brdp);
 #endif
 
@@ -2707,7 +2698,7 @@ static int __init stl_brdinit(stlbrd_t *brdp)
  *     Find the next available board number that is free.
  */
 
-static inline int stl_getbrdnr()
+static inline int stl_getbrdnr(void)
 {
        int     i;
 
@@ -2735,7 +2726,7 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp)
 {
        stlbrd_t        *brdp;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", brdtype,
                devp->bus->number, devp->devfn);
 #endif
@@ -2755,7 +2746,7 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp)
  *     Different Stallion boards use the BAR registers in different ways,
  *     so set up io addresses based on board type.
  */
-#if DEBUG
+#ifdef DEBUG
        printk("%s(%d): BAR[]=%x,%x,%x,%x IRQ=%x\n", __FILE__, __LINE__,
                pci_resource_start(devp, 0), pci_resource_start(devp, 1),
                pci_resource_start(devp, 2), pci_resource_start(devp, 3), devp->irq);
@@ -2797,12 +2788,12 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp)
  */
 
 
-static inline int stl_findpcibrds()
+static inline int stl_findpcibrds(void)
 {
        struct pci_dev  *dev = NULL;
        int             i, rc;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_findpcibrds()\n");
 #endif
 
@@ -2835,13 +2826,13 @@ static inline int stl_findpcibrds()
  *     since the initial search and setup is too different.
  */
 
-static inline int stl_initbrds()
+static inline int stl_initbrds(void)
 {
        stlbrd_t        *brdp;
        stlconf_t       *confp;
        int             i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_initbrds()\n");
 #endif
 
@@ -2891,7 +2882,7 @@ static inline int stl_initbrds()
  *     Return the board stats structure to user app.
  */
 
-static int stl_getbrdstats(combrd_t *bp)
+static int stl_getbrdstats(combrd_t __user *bp)
 {
        stlbrd_t        *brdp;
        stlpanel_t      *panelp;
@@ -2959,12 +2950,12 @@ static stlport_t *stl_getport(int brdnr, int panelnr, int portnr)
  *     what port to get stats for (used through board control device).
  */
 
-static int stl_getportstats(stlport_t *portp, comstats_t *cp)
+static int stl_getportstats(stlport_t *portp, comstats_t __user *cp)
 {
        unsigned char   *head, *tail;
        unsigned long   flags;
 
-       if (portp == (stlport_t *) NULL) {
+       if (!portp) {
                if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t)))
                        return -EFAULT;
                portp = stl_getport(stl_comstats.brd, stl_comstats.panel,
@@ -3017,9 +3008,9 @@ static int stl_getportstats(stlport_t *portp, comstats_t *cp)
  *     Clear the port stats structure. We also return it zeroed out...
  */
 
-static int stl_clrportstats(stlport_t *portp, comstats_t *cp)
+static int stl_clrportstats(stlport_t *portp, comstats_t __user *cp)
 {
-       if (portp == (stlport_t *) NULL) {
+       if (!portp) {
                if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t)))
                        return -EFAULT;
                portp = stl_getport(stl_comstats.brd, stl_comstats.panel,
@@ -3042,18 +3033,17 @@ static int stl_clrportstats(stlport_t *portp, comstats_t *cp)
  *     Return the entire driver ports structure to a user app.
  */
 
-static int stl_getportstruct(unsigned long arg)
+static int stl_getportstruct(stlport_t __user *arg)
 {
        stlport_t       *portp;
 
-       if (copy_from_user(&stl_dummyport, (void *) arg, sizeof(stlport_t)))
+       if (copy_from_user(&stl_dummyport, arg, sizeof(stlport_t)))
                return -EFAULT;
        portp = stl_getport(stl_dummyport.brdnr, stl_dummyport.panelnr,
                 stl_dummyport.portnr);
-       if (portp == (stlport_t *) NULL)
-               return(-ENODEV);
-       return copy_to_user((void *)arg, portp,
-                           sizeof(stlport_t)) ? -EFAULT : 0;
+       if (!portp)
+               return -ENODEV;
+       return copy_to_user(arg, portp, sizeof(stlport_t)) ? -EFAULT : 0;
 }
 
 /*****************************************************************************/
@@ -3062,18 +3052,18 @@ static int stl_getportstruct(unsigned long arg)
  *     Return the entire driver board structure to a user app.
  */
 
-static int stl_getbrdstruct(unsigned long arg)
+static int stl_getbrdstruct(stlbrd_t __user *arg)
 {
        stlbrd_t        *brdp;
 
-       if (copy_from_user(&stl_dummybrd, (void *) arg, sizeof(stlbrd_t)))
+       if (copy_from_user(&stl_dummybrd, arg, sizeof(stlbrd_t)))
                return -EFAULT;
        if ((stl_dummybrd.brdnr < 0) || (stl_dummybrd.brdnr >= STL_MAXBRDS))
-               return(-ENODEV);
+               return -ENODEV;
        brdp = stl_brds[stl_dummybrd.brdnr];
-       if (brdp == (stlbrd_t *) NULL)
+       if (!brdp)
                return(-ENODEV);
-       return copy_to_user((void *)arg, brdp, sizeof(stlbrd_t)) ? -EFAULT : 0;
+       return copy_to_user(arg, brdp, sizeof(stlbrd_t)) ? -EFAULT : 0;
 }
 
 /*****************************************************************************/
@@ -3087,8 +3077,9 @@ static int stl_getbrdstruct(unsigned long arg)
 static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg)
 {
        int     brdnr, rc;
+       void __user *argp = (void __user *)arg;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", (int) ip,
                (int) fp, cmd, (int) arg);
 #endif
@@ -3100,31 +3091,19 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns
 
        switch (cmd) {
        case COM_GETPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stl_getportstats((stlport_t *) NULL,
-                               (comstats_t *) arg);
+               rc = stl_getportstats(NULL, argp);
                break;
        case COM_CLRPORTSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(comstats_t))) == 0)
-                       rc = stl_clrportstats((stlport_t *) NULL,
-                               (comstats_t *) arg);
+               rc = stl_clrportstats(NULL, argp);
                break;
        case COM_GETBRDSTATS:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(combrd_t))) == 0)
-                       rc = stl_getbrdstats((combrd_t *) arg);
+               rc = stl_getbrdstats(argp);
                break;
        case COM_READPORT:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(stlport_t))) == 0)
-                       rc = stl_getportstruct(arg);
+               rc = stl_getportstruct(argp);
                break;
        case COM_READBOARD:
-               if ((rc = verify_area(VERIFY_WRITE, (void *) arg,
-                   sizeof(stlbrd_t))) == 0)
-                       rc = stl_getbrdstruct(arg);
+               rc = stl_getbrdstruct(argp);
                break;
        default:
                rc = -ENOIOCTLCMD;
@@ -3262,7 +3241,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
        int             chipmask, i, j;
        int             nrchips, uartaddr, ioaddr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp);
 #endif
 
@@ -3314,7 +3293,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
 
 static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n",
                (int) brdp, (int) panelp, (int) portp);
 #endif
@@ -3529,7 +3508,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp)
  *     them all up.
  */
 
-#if DEBUG
+#ifdef DEBUG
        printk("SETPORT: portnr=%d panelnr=%d brdnr=%d\n",
                portp->portnr, portp->panelnr, portp->brdnr);
        printk("    cor1=%x cor2=%x cor3=%x cor4=%x cor5=%x\n",
@@ -3594,7 +3573,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts)
        unsigned char   msvr1, msvr2;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400setsignals(portp=%x,dtr=%d,rts=%d)\n",
                (int) portp, dtr, rts);
 #endif
@@ -3630,7 +3609,7 @@ static int stl_cd1400getsignals(stlport_t *portp)
        unsigned long   flags;
        int             sigs;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400getsignals(portp=%x)\n", (int) portp);
 #endif
 
@@ -3668,7 +3647,7 @@ static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx)
        unsigned char   ccr;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400enablerxtx(portp=%x,rx=%d,tx=%d)\n",
                (int) portp, rx, tx);
 #endif
@@ -3705,7 +3684,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx)
        unsigned char   sreron, sreroff;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400startrxtx(portp=%x,rx=%d,tx=%d)\n",
                (int) portp, rx, tx);
 #endif
@@ -3745,7 +3724,7 @@ static void stl_cd1400disableintrs(stlport_t *portp)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp);
 #endif
        save_flags(flags);
@@ -3763,7 +3742,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len);
 #endif
 
@@ -3792,7 +3771,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state)
        struct tty_struct       *tty;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400flowctrl(portp=%x,state=%x)\n", (int) portp, state);
 #endif
 
@@ -3857,7 +3836,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state)
        struct tty_struct       *tty;
        unsigned long           flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400sendflow(portp=%x,state=%x)\n", (int) portp, state);
 #endif
 
@@ -3892,7 +3871,7 @@ static void stl_cd1400flush(stlport_t *portp)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400flush(portp=%x)\n", (int) portp);
 #endif
 
@@ -3922,7 +3901,7 @@ static void stl_cd1400flush(stlport_t *portp)
 
 static int stl_cd1400datastate(stlport_t *portp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400datastate(portp=%x)\n", (int) portp);
 #endif
 
@@ -3942,7 +3921,7 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase)
 {
        unsigned char   svrtype;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400eiointr(panelp=%x,iobase=%x)\n",
                (int) panelp, iobase);
 #endif
@@ -3972,7 +3951,7 @@ static void stl_cd1400echintr(stlpanel_t *panelp, unsigned int iobase)
 {
        unsigned char   svrtype;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400echintr(panelp=%x,iobase=%x)\n", (int) panelp,
                iobase);
 #endif
@@ -4046,7 +4025,7 @@ static void stl_cd1400txisr(stlpanel_t *panelp, int ioaddr)
        char            *head, *tail;
        unsigned char   ioack, srer;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400txisr(panelp=%x,ioaddr=%x)\n", (int) panelp, ioaddr);
 #endif
 
@@ -4128,7 +4107,7 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr)
        unsigned char           status;
        char                    ch;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400rxisr(panelp=%x,ioaddr=%x)\n", (int) panelp, ioaddr);
 #endif
 
@@ -4237,7 +4216,7 @@ static void stl_cd1400mdmisr(stlpanel_t *panelp, int ioaddr)
        unsigned int    ioack;
        unsigned char   misr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_cd1400mdmisr(panelp=%x)\n", (int) panelp);
 #endif
 
@@ -4326,7 +4305,7 @@ static int stl_sc26198panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
        int     chipmask, i;
        int     nrchips, ioaddr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198panelinit(brdp=%x,panelp=%x)\n",
                (int) brdp, (int) panelp);
 #endif
@@ -4371,7 +4350,7 @@ static int stl_sc26198panelinit(stlbrd_t *brdp, stlpanel_t *panelp)
 
 static void stl_sc26198portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp)
 {
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198portinit(brdp=%x,panelp=%x,portp=%x)\n",
                (int) brdp, (int) panelp, (int) portp);
 #endif
@@ -4548,7 +4527,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp)
  *     them all up.
  */
 
-#if DEBUG
+#ifdef DEBUG
        printk("SETPORT: portnr=%d panelnr=%d brdnr=%d\n",
                portp->portnr, portp->panelnr, portp->brdnr);
        printk("    mr0=%x mr1=%x mr2=%x clk=%x\n", mr0, mr1, mr2, clk);
@@ -4600,7 +4579,7 @@ static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts)
        unsigned char   iopioron, iopioroff;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198setsignals(portp=%x,dtr=%d,rts=%d)\n",
                (int) portp, dtr, rts);
 #endif
@@ -4637,7 +4616,7 @@ static int stl_sc26198getsignals(stlport_t *portp)
        unsigned long   flags;
        int             sigs;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198getsignals(portp=%x)\n", (int) portp);
 #endif
 
@@ -4668,7 +4647,7 @@ static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx)
        unsigned char   ccr;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198enablerxtx(portp=%x,rx=%d,tx=%d)\n",
                (int) portp, rx, tx);
 #endif
@@ -4703,7 +4682,7 @@ static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx)
        unsigned char   imr;
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198startrxtx(portp=%x,rx=%d,tx=%d)\n",
                (int) portp, rx, tx);
 #endif
@@ -4739,7 +4718,7 @@ static void stl_sc26198disableintrs(stlport_t *portp)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp);
 #endif
 
@@ -4758,7 +4737,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len);
 #endif
 
@@ -4787,7 +4766,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state)
        unsigned long           flags;
        unsigned char           mr0;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198flowctrl(portp=%x,state=%x)\n", (int) portp, state);
 #endif
 
@@ -4859,7 +4838,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state)
        unsigned long           flags;
        unsigned char           mr0;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198sendflow(portp=%x,state=%x)\n", (int) portp, state);
 #endif
 
@@ -4899,7 +4878,7 @@ static void stl_sc26198flush(stlport_t *portp)
 {
        unsigned long   flags;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198flush(portp=%x)\n", (int) portp);
 #endif
 
@@ -4931,7 +4910,7 @@ static int stl_sc26198datastate(stlport_t *portp)
        unsigned long   flags;
        unsigned char   sr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198datastate(portp=%x)\n", (int) portp);
 #endif
 
@@ -4961,7 +4940,7 @@ static void stl_sc26198wait(stlport_t *portp)
 {
        int     i;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198wait(portp=%x)\n", (int) portp);
 #endif
 
@@ -5039,7 +5018,7 @@ static void stl_sc26198txisr(stlport_t *portp)
        int             len, stlen;
        char            *head, *tail;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198txisr(portp=%x)\n", (int) portp);
 #endif
 
@@ -5100,7 +5079,7 @@ static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack)
        struct tty_struct       *tty;
        unsigned int            len, buflen, ioaddr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198rxisr(portp=%x,iack=%x)\n", (int) portp, iack);
 #endif
 
@@ -5256,7 +5235,7 @@ static void stl_sc26198otherisr(stlport_t *portp, unsigned int iack)
 {
        unsigned char   cir, ipr, xisr;
 
-#if DEBUG
+#ifdef DEBUG
        printk("stl_sc26198otherisr(portp=%x,iack=%x)\n", (int) portp, iack);
 #endif
 
index eec8815..1361ea0 100644 (file)
@@ -361,6 +361,10 @@ typedef struct _synclinkmp_info {
 #define TMCS   0x64
 #define TEPR   0x65
 
+/*
+ *  FIXME: DAR here clashed with asm-ppc/reg.h and asm-sh/.../dma.h
+ */
+#undef DAR
 /* DMA Controller Register macros */
 #define DAR    0x80
 #define DARL   0x80
@@ -796,7 +800,7 @@ static int open(struct tty_struct *tty, struct file *filp)
 cleanup:
        if (retval) {
                if (tty->count == 1)
-                       info->tty = 0; /* tty layer will release tty struct */
+                       info->tty = NULL;/* tty layer will release tty struct */
                if(info->count)
                        info->count--;
        }
@@ -871,7 +875,7 @@ static void close(struct tty_struct *tty, struct file *filp)
        shutdown(info);
 
        tty->closing = 0;
-       info->tty = 0;
+       info->tty = NULL;
 
        if (info->blocked_open) {
                if (info->close_delay) {
@@ -910,7 +914,7 @@ static void hangup(struct tty_struct *tty)
 
        info->count = 0;
        info->flags &= ~ASYNC_NORMAL_ACTIVE;
-       info->tty = 0;
+       info->tty = NULL;
 
        wake_up_interruptible(&info->open_wait);
 }
@@ -2607,7 +2611,7 @@ static void shutdown(SLMP_INFO * info)
 
        if (info->tx_buf) {
                kfree(info->tx_buf);
-               info->tx_buf = 0;
+               info->tx_buf = NULL;
        }
 
        spin_lock_irqsave(&info->lock,flags);
@@ -3548,22 +3552,22 @@ void release_resources(SLMP_INFO *info)
 
        if (info->memory_base){
                iounmap(info->memory_base);
-               info->memory_base = 0;
+               info->memory_base = NULL;
        }
 
        if (info->sca_base) {
                iounmap(info->sca_base - info->sca_offset);
-               info->sca_base=0;
+               info->sca_base=NULL;
        }
 
        if (info->statctrl_base) {
                iounmap(info->statctrl_base - info->statctrl_offset);
-               info->statctrl_base=0;
+               info->statctrl_base=NULL;
        }
 
        if (info->lcr_base){
                iounmap(info->lcr_base - info->lcr_offset);
-               info->lcr_base = 0;
+               info->lcr_base = NULL;
        }
 
        if ( debug_level >= DEBUG_LEVEL_INFO )
@@ -5143,7 +5147,7 @@ int loopback_test(SLMP_INFO *info)
        u32 speed = info->params.clock_speed;
 
        info->params.clock_speed = 3686400;
-       info->tty = 0;
+       info->tty = NULL;
 
        /* assume failure */
        info->init_error = DiagStatus_DmaFailure;
index 5f821fe..48d7a7c 100644 (file)
@@ -262,7 +262,7 @@ tipar_open(struct inode *inode, struct file *file)
        init_ti_parallel(minor);
        parport_release(table[minor].dev);
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
@@ -316,9 +316,6 @@ tipar_read(struct file *file, char __user *buf, size_t count, loff_t * ppos)
        if (count == 0)
                return 0;
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        parport_claim_or_block(table[minor].dev);
 
        while (n < count) {
index 5e49ad3..4f6ff61 100644 (file)
@@ -142,6 +142,7 @@ static ssize_t tty_write(struct file *, const char __user *, size_t, loff_t *);
 ssize_t redirected_tty_write(struct file *, const char __user *, size_t, loff_t *);
 static unsigned int tty_poll(struct file *, poll_table *);
 static int tty_open(struct inode *, struct file *);
+static int ptmx_open(struct inode *, struct file *);
 static int tty_release(struct inode *, struct file *);
 int tty_ioctl(struct inode * inode, struct file * file,
              unsigned int cmd, unsigned long arg);
@@ -345,18 +346,12 @@ EXPORT_SYMBOL(tty_check_change);
 static ssize_t hung_up_tty_read(struct file * file, char __user * buf,
                                size_t count, loff_t *ppos)
 {
-       /* Can't seek (pread) on ttys.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        return 0;
 }
 
 static ssize_t hung_up_tty_write(struct file * file, const char __user * buf,
                                 size_t count, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on ttys.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        return -EIO;
 }
 
@@ -383,6 +378,19 @@ static struct file_operations tty_fops = {
        .fasync         = tty_fasync,
 };
 
+#ifdef CONFIG_UNIX98_PTYS
+static struct file_operations ptmx_fops = {
+       .llseek         = no_llseek,
+       .read           = tty_read,
+       .write          = tty_write,
+       .poll           = tty_poll,
+       .ioctl          = tty_ioctl,
+       .open           = ptmx_open,
+       .release        = tty_release,
+       .fasync         = tty_fasync,
+};
+#endif
+
 static struct file_operations console_fops = {
        .llseek         = no_llseek,
        .read           = tty_read,
@@ -648,10 +656,6 @@ static ssize_t tty_read(struct file * file, char __user * buf, size_t count,
        struct tty_struct * tty;
        struct inode *inode;
 
-       /* Can't seek (pread) on ttys.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        tty = (struct tty_struct *)file->private_data;
        inode = file->f_dentry->d_inode;
        if (tty_paranoia_check(tty, inode, "tty_read"))
@@ -726,10 +730,6 @@ static ssize_t tty_write(struct file * file, const char __user * buf, size_t cou
        struct tty_struct * tty;
        struct inode *inode = file->f_dentry->d_inode;
 
-       /* Can't seek (pwrite) on ttys.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        tty = (struct tty_struct *)file->private_data;
        if (tty_paranoia_check(tty, inode, "tty_write"))
                return -EIO;
@@ -755,9 +755,6 @@ ssize_t redirected_tty_write(struct file * file, const char __user * buf, size_t
 
        if (p) {
                ssize_t res;
-               /* Can't seek (pwrite) on ttys.  */
-               if (ppos != &file->f_pos)
-                       return -ESPIPE;
                res = vfs_write(p, buf, count, &p->f_pos);
                fput(p);
                return res;
@@ -1068,7 +1065,7 @@ static void release_dev(struct file * filp)
 {
        struct tty_struct *tty, *o_tty;
        int     pty_master, tty_closing, o_tty_closing, do_sleep;
-       int     devpts_master;
+       int     devpts_master, devpts;
        int     idx;
        char    buf[64];
        
@@ -1083,7 +1080,8 @@ static void release_dev(struct file * filp)
        idx = tty->index;
        pty_master = (tty->driver->type == TTY_DRIVER_TYPE_PTY &&
                      tty->driver->subtype == PTY_TYPE_MASTER);
-       devpts_master = pty_master && (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM);
+       devpts = (tty->driver->flags & TTY_DRIVER_DEVPTS_MEM) != 0;
+       devpts_master = pty_master && devpts;
        o_tty = tty->link;
 
 #ifdef TTY_PARANOIA_CHECK
@@ -1308,7 +1306,7 @@ static void release_dev(struct file * filp)
 
 #ifdef CONFIG_UNIX98_PTYS
        /* Make this pty number available for reallocation */
-       if (devpts_master) {
+       if (devpts) {
                down(&allocated_ptys_lock);
                idr_remove(&allocated_ptys, idx);
                up(&allocated_ptys_lock);
@@ -1338,6 +1336,7 @@ static int tty_open(struct inode * inode, struct file * filp)
        dev_t device = inode->i_rdev;
        unsigned short saved_flags = filp->f_flags;
 
+       nonseekable_open(inode, filp);
 retry_open:
        noctty = filp->f_flags & O_NOCTTY;
        index  = -1;
@@ -1373,53 +1372,13 @@ retry_open:
                return -ENODEV;
        }
 
-#ifdef CONFIG_UNIX98_PTYS
-       if (device == MKDEV(TTYAUX_MAJOR,2)) {
-               int idr_ret;
-
-               /* find a device that is not in use. */
-               down(&allocated_ptys_lock);
-               if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
-                       up(&allocated_ptys_lock);
-                       return -ENOMEM;
-               }
-               idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
-               if (idr_ret < 0) {
-                       up(&allocated_ptys_lock);
-                       if (idr_ret == -EAGAIN)
-                               return -ENOMEM;
-                       return -EIO;
-               }
-               if (index >= pty_limit) {
-                       idr_remove(&allocated_ptys, index);
-                       up(&allocated_ptys_lock);
-                       return -EIO;
-               }
-               up(&allocated_ptys_lock);
-
-               driver = ptm_driver;
-               retval = init_dev(driver, index, &tty);
-               if (retval) {
-                       down(&allocated_ptys_lock);
-                       idr_remove(&allocated_ptys, index);
-                       up(&allocated_ptys_lock);
-                       return retval;
-               }
-
-               set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
-               if (devpts_pty_new(tty->link))
-                       retval = -ENOMEM;
-       } else
-#endif
-       {
-               driver = get_tty_driver(device, &index);
-               if (!driver)
-                       return -ENODEV;
+       driver = get_tty_driver(device, &index);
+       if (!driver)
+               return -ENODEV;
 got_driver:
-               retval = init_dev(driver, index, &tty);
-               if (retval)
-                       return retval;
-       }
+       retval = init_dev(driver, index, &tty);
+       if (retval)
+               return retval;
 
        filp->private_data = tty;
        file_move(filp, &tty->tty_files);
@@ -1446,15 +1405,6 @@ got_driver:
                printk(KERN_DEBUG "error %d in opening %s...", retval,
                       tty->name);
 #endif
-
-#ifdef CONFIG_UNIX98_PTYS
-               if (index != -1) {
-                       down(&allocated_ptys_lock);
-                       idr_remove(&allocated_ptys, index);
-                       up(&allocated_ptys_lock);
-               }
-#endif
-
                release_dev(filp);
                if (retval != -ERESTARTSYS)
                        return retval;
@@ -1482,6 +1432,62 @@ got_driver:
        return 0;
 }
 
+#ifdef CONFIG_UNIX98_PTYS
+static int ptmx_open(struct inode * inode, struct file * filp)
+{
+       struct tty_struct *tty;
+       int retval;
+       int index;
+       int idr_ret;
+
+       nonseekable_open(inode, filp);
+
+       /* find a device that is not in use. */
+       down(&allocated_ptys_lock);
+       if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
+               up(&allocated_ptys_lock);
+               return -ENOMEM;
+       }
+       idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
+       if (idr_ret < 0) {
+               up(&allocated_ptys_lock);
+               if (idr_ret == -EAGAIN)
+                       return -ENOMEM;
+               return -EIO;
+       }
+       if (index >= pty_limit) {
+               idr_remove(&allocated_ptys, index);
+               up(&allocated_ptys_lock);
+               return -EIO;
+       }
+       up(&allocated_ptys_lock);
+
+       retval = init_dev(ptm_driver, index, &tty);
+       if (retval)
+               goto out;
+
+       set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
+       filp->private_data = tty;
+       file_move(filp, &tty->tty_files);
+
+       retval = -ENOMEM;
+       if (devpts_pty_new(tty->link))
+               goto out1;
+
+       check_tty_count(tty, "tty_open");
+       retval = ptm_driver->open(tty, filp);
+       if (!retval)
+               return 0;
+out1:
+       release_dev(filp);
+out:
+       down(&allocated_ptys_lock);
+       idr_remove(&allocated_ptys, index);
+       up(&allocated_ptys_lock);
+       return retval;
+}
+#endif
+
 static int tty_release(struct inode * inode, struct file * filp)
 {
        lock_kernel();
@@ -2456,7 +2462,7 @@ static int __init tty_init(void)
        class_simple_device_add(tty_class, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
 
 #ifdef CONFIG_UNIX98_PTYS
-       cdev_init(&ptmx_cdev, &tty_fops);
+       cdev_init(&ptmx_cdev, &ptmx_fops);
        if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
            register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
                panic("Couldn't register /dev/ptmx driver\n");
index b6da553..a204572 100644 (file)
 #include <linux/workqueue.h>
 #include <linux/bootmem.h>
 #include <linux/pm.h>
+#include <linux/font.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -3023,98 +3024,182 @@ void reset_palette(int currcons)
 
 #define max_font_size 65536
 
-int con_font_op(int currcons, struct console_font_op *op)
+int con_font_get(int currcons, struct console_font_op *op)
 {
+       struct console_font font;
        int rc = -EINVAL;
-       int size = max_font_size, set;
-       u8 *temp = NULL;
-       struct console_font_op old_op;
+       int c;
 
        if (vt_cons[currcons]->vc_mode != KD_TEXT)
-               goto quit;
-       memcpy(&old_op, op, sizeof(old_op));
-       if (op->op == KD_FONT_OP_SET) {
-               if (!op->data)
-                       return -EINVAL;
-               if (op->charcount > 512)
-                       goto quit;
-               if (!op->height) {              /* Need to guess font height [compat] */
-                       int h, i;
-                       u8 __user *charmap = op->data;
-                       u8 tmp;
-                       
-                       /* If from KDFONTOP ioctl, don't allow things which can be done in userland,
-                          so that we can get rid of this soon */
-                       if (!(op->flags & KD_FONT_FLAG_OLD))
-                               goto quit;
-                       rc = -EFAULT;
-                       for (h = 32; h > 0; h--)
-                               for (i = 0; i < op->charcount; i++) {
-                                       if (get_user(tmp, &charmap[32*i+h-1]))
-                                               goto quit;
-                                       if (tmp)
-                                               goto nonzero;
-                               }
-                       rc = -EINVAL;
-                       goto quit;
-               nonzero:
-                       rc = -EINVAL;
-                       op->height = h;
-               }
-               if (op->width > 32 || op->height > 32)
-                       goto quit;
-               size = (op->width+7)/8 * 32 * op->charcount;
-               if (size > max_font_size)
-                       return -ENOSPC;
-               set = 1;
-       } else if (op->op == KD_FONT_OP_GET)
-               set = 0;
-       else {
-               acquire_console_sem();
-               rc = sw->con_font_op(vc_cons[currcons].d, op);
-               release_console_sem();
-               return rc;
-       }
+               return -EINVAL;
+
        if (op->data) {
-               temp = kmalloc(size, GFP_KERNEL);
-               if (!temp)
+               font.data = kmalloc(max_font_size, GFP_KERNEL);
+               if (!font.data)
                        return -ENOMEM;
-               if (set && copy_from_user(temp, op->data, size)) {
-                       rc = -EFAULT;
-                       goto quit;
-               }
-               op->data = temp;
-       }
+       } else
+               font.data = NULL;
 
        acquire_console_sem();
-       rc = sw->con_font_op(vc_cons[currcons].d, op);
+       if (sw->con_font_get)
+               rc = sw->con_font_get(vc_cons[currcons].d, &font);
+       else
+               rc = -ENOSYS;
        release_console_sem();
 
-       op->data = old_op.data;
-       if (!rc && !set) {
-               int c = (op->width+7)/8 * 32 * op->charcount;
-               
-               if (op->data && op->charcount > old_op.charcount)
+       if (rc)
+               goto out;
+
+       c = (font.width+7)/8 * 32 * font.charcount;
+       
+       if (op->data && font.charcount > op->charcount)
+               rc = -ENOSPC;
+       if (!(op->flags & KD_FONT_FLAG_OLD)) {
+               if (font.width > op->width || font.height > op->height) 
+                       rc = -ENOSPC;
+       } else {
+               if (font.width != 8)
+                       rc = -EIO;
+               else if ((op->height && font.height > op->height) ||
+                        font.height > 32)
                        rc = -ENOSPC;
-               if (!(op->flags & KD_FONT_FLAG_OLD)) {
-                       if (op->width > old_op.width || 
-                           op->height > old_op.height)
-                               rc = -ENOSPC;
-               } else {
-                       if (op->width != 8)
-                               rc = -EIO;
-                       else if ((old_op.height && op->height > old_op.height) ||
-                                op->height > 32)
-                               rc = -ENOSPC;
-               }
-               if (!rc && op->data && copy_to_user(op->data, temp, c))
-                       rc = -EFAULT;
        }
-quit:  if (temp)
-               kfree(temp);
+       if (rc)
+               goto out;
+
+       if (op->data && copy_to_user(op->data, font.data, c))
+               rc = -EFAULT;
+
+out:
+       kfree(font.data);
        return rc;
 }
 
+int con_font_set(int currcons, struct console_font_op *op)
+{
+       struct console_font font;
+       int rc = -EINVAL;
+       int size;
+
+       if (vt_cons[currcons]->vc_mode != KD_TEXT)
+               return -EINVAL;
+       if (!op->data)
+               return -EINVAL;
+       if (op->charcount > 512)
+               return -EINVAL;
+       if (!op->height) {              /* Need to guess font height [compat] */
+               int h, i;
+               u8 __user *charmap = op->data;
+               u8 tmp;
+               
+               /* If from KDFONTOP ioctl, don't allow things which can be done in userland,
+                  so that we can get rid of this soon */
+               if (!(op->flags & KD_FONT_FLAG_OLD))
+                       return -EINVAL;
+               for (h = 32; h > 0; h--)
+                       for (i = 0; i < op->charcount; i++) {
+                               if (get_user(tmp, &charmap[32*i+h-1]))
+                                       return -EFAULT;
+                               if (tmp)
+                                       goto nonzero;
+                       }
+               return -EINVAL;
+       nonzero:
+               op->height = h;
+       }
+       if (op->width <= 0 || op->width > 32 || op->height > 32)
+               return -EINVAL;
+       size = (op->width+7)/8 * 32 * op->charcount;
+       if (size > max_font_size)
+               return -ENOSPC;
+       font.charcount = op->charcount;
+       font.height = op->height;
+       font.width = op->width;
+       font.data = kmalloc(size, GFP_KERNEL);
+       if (!font.data)
+               return -ENOMEM;
+       if (copy_from_user(font.data, op->data, size)) {
+               kfree(font.data);
+               return -EFAULT;
+       }
+       acquire_console_sem();
+       if (sw->con_font_set)
+               rc = sw->con_font_set(vc_cons[currcons].d, &font, op->flags);
+       else
+               rc = -ENOSYS;
+       release_console_sem();
+       kfree(font.data);
+       return rc;
+}
+
+int con_font_default(int currcons, struct console_font_op *op)
+{
+       struct console_font font = {.width = op->width, .height = op->height};
+       char name[MAX_FONT_NAME];
+       char *s = name;
+       int rc;
+
+       if (vt_cons[currcons]->vc_mode != KD_TEXT)
+               return -EINVAL;
+
+       if (!op->data)
+               s = NULL;
+       else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
+               return -EFAULT;
+       else
+               name[MAX_FONT_NAME - 1] = 0;
+
+       acquire_console_sem();
+       if (sw->con_font_default)
+               rc = sw->con_font_default(vc_cons[currcons].d, &font, s);
+       else
+               rc = -ENOSYS;
+       release_console_sem();
+       if (!rc) {
+               op->width = font.width;
+               op->height = font.height;
+       }
+       return rc;
+}
+
+int con_font_copy(int currcons, struct console_font_op *op)
+{
+       int con = op->height;
+       struct vc_data *vc;
+       int rc;
+
+       if (vt_cons[currcons]->vc_mode != KD_TEXT)
+               return -EINVAL;
+
+       acquire_console_sem();
+       vc = vc_cons[currcons].d;
+       if (!sw->con_font_copy)
+               rc = -ENOSYS;
+       else if (con < 0 || !vc_cons_allocated(con))
+               rc = -ENOTTY;
+       else if (con == vc->vc_num)     /* nothing to do */
+               rc = 0;
+       else
+               rc = sw->con_font_copy(vc, con);
+       release_console_sem();
+       return rc;
+}
+
+int con_font_op(int currcons, struct console_font_op *op)
+{
+       switch (op->op) {
+       case KD_FONT_OP_SET:
+               return con_font_set(currcons, op);
+       case KD_FONT_OP_GET:
+               return con_font_get(currcons, op);
+       case KD_FONT_OP_SET_DEFAULT:
+               return con_font_default(currcons, op);
+       case KD_FONT_OP_COPY:
+               return con_font_copy(currcons, op);
+       }
+       return -ENOSYS;
+}
+
 /*
  *     Interface exported to selection and vcs.
  */
index bf05ec6..682b44e 100644 (file)
@@ -915,7 +915,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                op.width = 8;
                op.height = 0;
                op.charcount = 256;
-               op.data = (char *) arg;
+               op.data = up;
                return con_font_op(fg_console, &op);
        }
 
@@ -925,7 +925,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
                op.width = 8;
                op.height = 32;
                op.charcount = 256;
-               op.data = (char *) arg;
+               op.data = up;
                return con_font_op(fg_console, &op);
        }
 
index 703adb1..a9dec9e 100644 (file)
@@ -95,6 +95,17 @@ config IXP4XX_WATCHDOG
 
          Say N if you are unsure.
 
+config IXP2000_WATCHDOG
+       tristate "IXP2000 Watchdog"
+       depends on WATCHDOG && ARCH_IXP2000
+       help
+         Say Y here if to include support for the watchdog timer
+         in the Intel IXP2000(2400, 2800, 2850) network processors.
+         This driver can be built as a module by choosing M. The module
+         will be called ixp2000_wdt.
+
+         Say N if you are unsure.
+
 config SA1100_WATCHDOG
        tristate "SA1100/PXA2xx watchdog"
        depends on WATCHDOG && ( ARCH_SA1100 || ARCH_PXA )
index 76d2605..c5f99d3 100644 (file)
@@ -36,3 +36,4 @@ obj-$(CONFIG_INDYDOG) += indydog.o
 obj-$(CONFIG_PCIPCWATCHDOG) += pcwd_pci.o
 obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
 obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o
+obj-$(CONFIG_IXP2000_WATCHDOG) += ixp2000_wdt.o
index 2febb25..8f30212 100644 (file)
@@ -113,10 +113,6 @@ static void acq_stop(void)
 
 static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if(count) {
                if (!nowayout) {
@@ -206,7 +202,7 @@ static int acq_open(struct inode *inode, struct file *file)
 
        /* Activate */
        acq_keepalive();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int acq_close(struct inode *inode, struct file *file)
index 4090794..ea73c83 100644 (file)
@@ -102,10 +102,6 @@ advwdt_disable(void)
 static ssize_t
 advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
@@ -200,7 +196,7 @@ advwdt_open(struct inode *inode, struct file *file)
         */
 
        advwdt_ping();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index f093a69..35dcbf8 100644 (file)
@@ -141,10 +141,6 @@ static int ali_settimer(int t)
 static ssize_t ali_write(struct file *file, const char __user *data,
                              size_t len, loff_t * ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
@@ -266,7 +262,7 @@ static int ali_open(struct inode *inode, struct file *file)
 
        /* Activate */
        ali_start();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /*
index c137cd3..5ff6a6e 100644 (file)
@@ -150,10 +150,6 @@ static void wdt_keepalive(void)
 
 static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
 {
-       /* We can't seek */
-       if(ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if(count) {
                if (!nowayout) {
@@ -185,7 +181,7 @@ static int fop_open(struct inode * inode, struct file * file)
                return -EBUSY;
        /* Good, fire up the show */
        wdt_startup();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int fop_close(struct inode * inode, struct file * file)
index 01df656..d10e554 100644 (file)
@@ -199,10 +199,6 @@ static void eurwdt_ping(void)
 static ssize_t eurwdt_write(struct file *file, const char __user *buf,
 size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-       return -ESPIPE;
-
        if (count)      {
                if (!nowayout) {
                        size_t i;
@@ -310,7 +306,7 @@ static int eurwdt_open(struct inode *inode, struct file *file)
        eurwdt_timeout = WDT_TIMEOUT;   /* initial timeout */
        /* Activate the WDT */
        eurwdt_activate_timer();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
index 8a63f7f..5fc0547 100644 (file)
@@ -193,7 +193,7 @@ static int i8xx_tco_open (struct inode *inode, struct file *file)
         */
        tco_timer_keepalive ();
        tco_timer_start ();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int i8xx_tco_release (struct inode *inode, struct file *file)
@@ -215,10 +215,6 @@ static int i8xx_tco_release (struct inode *inode, struct file *file)
 static ssize_t i8xx_tco_write (struct file *file, const char __user *data,
                              size_t len, loff_t * ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
index 0d48439..cd6467e 100644 (file)
@@ -141,10 +141,6 @@ ibwdt_ping(void)
 static ssize_t
 ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
@@ -228,7 +224,7 @@ ibwdt_open(struct inode *inode, struct file *file)
        /* Activate */
        ibwdt_ping();
        spin_unlock(&ibwdt_lock);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index 23fc364..4e9093b 100644 (file)
@@ -81,7 +81,7 @@ static int indydog_open(struct inode *inode, struct file *file)
        indydog_alive = 1;
        printk(KERN_INFO "Started watchdog timer.\n");
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int indydog_release(struct inode *inode, struct file *file)
@@ -98,10 +98,6 @@ static int indydog_release(struct inode *inode, struct file *file)
 
 static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* Refresh the timer. */
        if (len) {
                indydog_ping();
index e8dc517..3782930 100644 (file)
@@ -305,10 +305,6 @@ static void zf_ping(unsigned long data)
 static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
                                                                loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character */
        if(count){
 
@@ -389,7 +385,7 @@ static int zf_open(struct inode *inode, struct file *file)
 
        zf_timer_on();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int zf_close(struct inode *inode, struct file *file)
index 2790f9c..15a3547 100644 (file)
@@ -108,7 +108,7 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
                        mixcomwd_timer_alive=0;
                }
        }
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int mixcomwd_release(struct inode *inode, struct file *file)
@@ -136,10 +136,6 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
 
 static ssize_t mixcomwd_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
 {
-       if (ppos != &file->f_pos) {
-               return -ESPIPE;
-       }
-
        if(len)
        {
                if (!nowayout) {
index ddfeee8..7216e48 100644 (file)
@@ -261,10 +261,6 @@ static int pcipcwd_get_temperature(int *temperature)
 static ssize_t pcipcwd_write(struct file *file, const char __user *data,
                              size_t len, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
@@ -392,7 +388,7 @@ static int pcipcwd_open(struct inode *inode, struct file *file)
        /* Activate */
        pcipcwd_start();
        pcipcwd_keepalive();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int pcipcwd_release(struct inode *inode, struct file *file)
@@ -420,10 +416,6 @@ static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
 {
        int temperature;
 
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (pcipcwd_get_temperature(&temperature))
                return -EFAULT;
 
@@ -438,7 +430,7 @@ static int pcipcwd_temp_open(struct inode *inode, struct file *file)
        if (!pcipcwd_private.supports_temp)
                return -ENODEV;
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int pcipcwd_temp_release(struct inode *inode, struct file *file)
index 5032553..cdfe0db 100644 (file)
@@ -329,10 +329,6 @@ static int usb_pcwd_get_temperature(struct usb_pcwd_private *usb_pcwd, int *temp
 static ssize_t usb_pcwd_write(struct file *file, const char __user *data,
                              size_t len, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (len) {
                if (!nowayout) {
@@ -445,7 +441,7 @@ static int usb_pcwd_open(struct inode *inode, struct file *file)
        /* Activate */
        usb_pcwd_start(usb_pcwd_device);
        usb_pcwd_keepalive(usb_pcwd_device);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_pcwd_release(struct inode *inode, struct file *file)
@@ -473,10 +469,6 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data,
 {
        int temperature;
 
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (usb_pcwd_get_temperature(usb_pcwd_device, &temperature))
                return -EFAULT;
 
@@ -488,7 +480,7 @@ static ssize_t usb_pcwd_temperature_read(struct file *file, char __user *data,
 
 static int usb_pcwd_temperature_open(struct inode *inode, struct file *file)
 {
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_pcwd_temperature_release(struct inode *inode, struct file *file)
index aa3901f..1adf09f 100644 (file)
@@ -49,6 +49,7 @@ static int nowayout = 0;
  */
 static int sa1100dog_open(struct inode *inode, struct file *file)
 {
+       nonseekable_open(inode, file);
        if (test_and_set_bit(1,&sa1100wdt_users))
                return -EBUSY;
 
@@ -84,10 +85,6 @@ static int sa1100dog_release(struct inode *inode, struct file *file)
 
 static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (len) {
                if (!nowayout) {
                        size_t i;
index b1c2990..d7de988 100644 (file)
@@ -168,10 +168,6 @@ static void wdt_keepalive(void)
 
 static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
 {
-       /* We can't seek */
-       if(ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if(count)
        {
@@ -202,6 +198,8 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
 
 static int fop_open(struct inode * inode, struct file * file)
 {
+       nonseekable_open(inode, file);
+
        /* Just in case we're already talking to someone... */
        if(test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
index df38161..9ddebae 100644 (file)
@@ -157,6 +157,8 @@ static inline int sc1200wdt_status(void)
 
 static int sc1200wdt_open(struct inode *inode, struct file *file)
 {
+       nonseekable_open(inode, file);
+
        /* allow one at a time */
        if (down_trylock(&open_sem))
                return -EBUSY;
@@ -258,9 +260,6 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
 
 static ssize_t sc1200wdt_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
 {
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (len) {
                if (!nowayout) {
                        size_t i;
index ebd0bb1..8b68721 100644 (file)
@@ -227,10 +227,6 @@ static int wdt_set_heartbeat(int t)
 
 static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
 {
-       /* We can't seek */
-       if(ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if(count) {
                if (!nowayout) {
@@ -258,6 +254,8 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
 
 static int fop_open(struct inode * inode, struct file * file)
 {
+       nonseekable_open(inode, file);
+
        /* Just in case we're already talking to someone... */
        if(test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
index bc61e82..ed1800c 100644 (file)
@@ -101,7 +101,7 @@ static int scx200_wdt_open(struct inode *inode, struct file *file)
                return -EBUSY;
        scx200_wdt_enable();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int scx200_wdt_release(struct inode *inode, struct file *file)
@@ -135,9 +135,6 @@ static struct notifier_block scx200_wdt_notifier =
 static ssize_t scx200_wdt_write(struct file *file, const char __user *data,
                                     size_t len, loff_t *ppos)
 {
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* check for a magic close character */
        if (len)
        {
index e4c235d..3bc9272 100644 (file)
@@ -209,7 +209,7 @@ static int sh_wdt_open(struct inode *inode, struct file *file)
 
        sh_wdt_start();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
@@ -248,10 +248,6 @@ static int sh_wdt_close(struct inode *inode, struct file *file)
 static ssize_t sh_wdt_write(struct file *file, const char *buf,
                            size_t count, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
index 832590d..1179034 100644 (file)
@@ -141,7 +141,7 @@ static int softdog_open(struct inode *inode, struct file *file)
         *      Activate timer
         */
        softdog_keepalive();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int softdog_release(struct inode *inode, struct file *file)
@@ -163,10 +163,6 @@ static int softdog_release(struct inode *inode, struct file *file)
 
 static ssize_t softdog_write(struct file *file, const char __user *data, size_t len, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /*
         *      Refresh the timer.
         */
index 0a21962..813c970 100644 (file)
@@ -144,10 +144,6 @@ wdt_set_heartbeat(int t)
 static ssize_t
 wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
@@ -241,7 +237,7 @@ wdt_open(struct inode *inode, struct file *file)
         */
 
        wdt_ping();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index 21270da..bccbd4d 100644 (file)
@@ -190,10 +190,6 @@ static void wdt_keepalive(void)
 
 static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
 {
-       /* We can't seek */
-       if(ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if(count)
        {
@@ -230,7 +226,7 @@ static int fop_open(struct inode * inode, struct file * file)
 
        /* Good, fire up the show */
        wdt_startup();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int fop_close(struct inode * inode, struct file * file)
index 26e232b..abb0bea 100644 (file)
@@ -97,10 +97,6 @@ wafwdt_stop(void)
 
 static ssize_t wafwdt_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        /* See if we got the magic character 'V' and reload the timer */
        if (count) {
                if (!nowayout) {
@@ -197,7 +193,7 @@ static int wafwdt_open(struct inode *inode, struct file *file)
         *      Activate
         */
        wafwdt_start();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index 407690b..5684aa3 100644 (file)
@@ -288,10 +288,6 @@ static irqreturn_t wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
 static ssize_t wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if(count) {
                if (!nowayout) {
                        size_t i;
@@ -397,7 +393,7 @@ static int wdt_open(struct inode *inode, struct file *file)
         *      Activate
         */
        wdt_start();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
@@ -441,10 +437,6 @@ static ssize_t wdt_temp_read(struct file *file, char __user *buf, size_t count,
 {
        int temperature;
 
-       /*  Can't seek (pread) on this device  */
-       if (ptr != &file->f_pos)
-               return -ESPIPE;
-
        if (wdt_get_temperature(&temperature))
                return -EFAULT;
 
@@ -464,7 +456,7 @@ static ssize_t wdt_temp_read(struct file *file, char __user *buf, size_t count,
 
 static int wdt_temp_open(struct inode *inode, struct file *file)
 {
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
index c63d17f..9d5b5f4 100644 (file)
@@ -333,10 +333,6 @@ static irqreturn_t wdtpci_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
 static ssize_t wdtpci_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       /*  Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                if (!nowayout) {
                        size_t i;
@@ -446,7 +442,7 @@ static int wdtpci_open(struct inode *inode, struct file *file)
         *      Activate
         */
        wdtpci_start();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
@@ -490,10 +486,6 @@ static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, size_t coun
 {
        int temperature;
 
-       /*  Can't seek (pread) on this device  */
-       if (ptr != &file->f_pos)
-               return -ESPIPE;
-
        if (wdtpci_get_temperature(&temperature))
                return -EFAULT;
 
@@ -513,7 +505,7 @@ static ssize_t wdtpci_temp_read(struct file *file, char __user *buf, size_t coun
 
 static int wdtpci_temp_open(struct inode *inode, struct file *file)
 {
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /**
index 5102144..161e8a2 100644 (file)
@@ -151,13 +151,13 @@ EXPORT_SYMBOL_GPL(cpufreq_setmax);
 /*********************** cpufreq_sysctl interface ********************/
 static int
 cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
-               void __user *buffer, size_t *lenp)
+               void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        char buf[16], *p;
        int cpu = (long) ctl->extra1;
        unsigned int len, left = *lenp;
 
-       if (!left || (filp->f_pos && !write) || !cpu_online(cpu)) {
+       if (!left || (*ppos && !write) || !cpu_online(cpu)) {
                *lenp = 0;
                return 0;
        }
@@ -183,7 +183,7 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
        }
 
        *lenp = len;
-       filp->f_pos += len;
+       *ppos += len;
        return 0;
 }
 
index f79974d..9497b1b 100644 (file)
@@ -50,9 +50,8 @@ rpx_iic_init(struct i2c_algo_8xx_data *data)
        /* Allocate space for two transmit and two receive buffer
         * descriptors in the DP ram.
         */
-       data->dp_addr = m8xx_cpm_dpram_offset(m8xx_cpm_dpalloc(sizeof(cbd_t)
-                               * 4));
-
+       data->dp_addr = cpm_dpalloc(sizeof(cbd_t) * 4, 8);
+               
        /* ptr to i2c area */
        data->i2c = (i2c8xx_t *)&(((immap_t *)IMAP_ADDR)->im_i2c);
 }
index a06cab5..af8d273 100644 (file)
@@ -193,7 +193,7 @@ config SENSORS_MAX1619
 
 config SENSORS_VIA686A
        tristate "VIA686A"
-       depends on I2C && EXPERIMENTAL
+       depends on I2C && PCI && EXPERIMENTAL
        select I2C_SENSOR
        select I2C_ISA
        help
index fc96b0d..f28496b 100644 (file)
@@ -753,7 +753,7 @@ endif
 
 config BLK_DEV_IDE_PMAC
        bool "Builtin PowerMac IDE support"
-       depends on PPC_PMAC
+       depends on PPC_PMAC && IDE=y
        help
          This driver provides support for the built-in IDE controller on
          most of the recent Apple Power Macintoshes and PowerBooks.
index 0bb2482..c3d6286 100644 (file)
@@ -785,14 +785,6 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
                                do_end_request = 1;
                } else if (sense_key == ILLEGAL_REQUEST ||
                           sense_key == DATA_PROTECT) {
-                       /*
-                        * check if this was a write protected media
-                        */
-                       if (rq_data_dir(rq) == WRITE) {
-                               printk("ide-cd: media marked write protected\n");
-                               set_disk_ro(drive->disk, 1);
-                       }
-
                        /* No point in retrying after an illegal
                           request or data protect error.*/
                        ide_dump_status (drive, "command error", stat);
@@ -1967,13 +1959,17 @@ static ide_startstop_t cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
         * sg request
         */
        if (rq->bio) {
-               if (rq->data_len & 3) {
-                       printk("%s: block pc not aligned, len=%d\n", drive->name, rq->data_len);
-                       cdrom_end_request(drive, 0);
-                       return ide_stopped;
-               }
-               info->dma = drive->using_dma;
+               int mask = drive->queue->dma_alignment;
+               unsigned long addr = (unsigned long) page_address(bio_page(rq->bio));
+
                info->cmd = rq_data_dir(rq);
+               info->dma = drive->using_dma;
+
+               /*
+                * check if dma is safe
+                */
+               if ((rq->data_len & mask) || (addr & mask))
+                       info->dma = 0;
        }
 
        /* Start sending the command to the drive. */
@@ -3141,7 +3137,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
        int nslots;
 
        blk_queue_prep_rq(drive->queue, ide_cdrom_prep_fn);
-       blk_queue_dma_alignment(drive->queue, 3);
+       blk_queue_dma_alignment(drive->queue, 31);
        drive->queue->unplug_delay = (1 * HZ) / 1000;
        if (!drive->queue->unplug_delay)
                drive->queue->unplug_delay = 1;
@@ -3248,9 +3244,8 @@ int ide_cdrom_setup (ide_drive_t *drive)
        nslots = ide_cdrom_probe_capabilities (drive);
 
        /*
-        * set correct block size and read-only for non-ram media
+        * set correct block size
         */
-       set_disk_ro(drive->disk, !CDROM_CONFIG_FLAGS(drive)->ram);
        blk_queue_hardsect_size(drive->queue, CD_FRAMESIZE);
 
 #if 0
@@ -3400,10 +3395,10 @@ static int idecd_ioctl (struct inode *inode, struct file *file,
 {
        struct block_device *bdev = inode->i_bdev;
        ide_drive_t *drive = bdev->bd_disk->private_data;
-       int err = generic_ide_ioctl(bdev, cmd, arg);
+       int err = generic_ide_ioctl(file, bdev, cmd, arg);
        if (err == -EINVAL) {
                struct cdrom_info *info = drive->driver_data;
-               err = cdrom_ioctl(&info->devinfo, inode, cmd, arg);
+               err = cdrom_ioctl(file, &info->devinfo, inode, cmd, arg);
        }
        return err;
 }
index 8b6be30..7b3bf05 100644 (file)
@@ -1668,7 +1668,7 @@ static int idedisk_ioctl(struct inode *inode, struct file *file,
                        unsigned int cmd, unsigned long arg)
 {
        struct block_device *bdev = inode->i_bdev;
-       return generic_ide_ioctl(bdev, cmd, arg);
+       return generic_ide_ioctl(file, bdev, cmd, arg);
 }
 
 static int idedisk_media_changed(struct gendisk *disk)
index 480426f..d19ee54 100644 (file)
@@ -3755,10 +3755,6 @@ static ssize_t idetape_chrdev_read (struct file *file, char __user *buf,
        idetape_tape_t *tape = drive->driver_data;
        ssize_t bytes_read,temp, actually_read = 0, rc;
 
-       if (ppos != &file->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               return -ENXIO;
-       }
 #if IDETAPE_DEBUG_LOG
        if (tape->debug_level >= 3)
                printk(KERN_INFO "ide-tape: Reached idetape_chrdev_read, count %Zd\n", count);
@@ -3818,11 +3814,6 @@ static ssize_t idetape_chrdev_write (struct file *file, const char __user *buf,
        idetape_tape_t *tape = drive->driver_data;
        ssize_t retval, actually_written = 0;
 
-       if (ppos != &file->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               return -ENXIO;
-       }
-
        /* The drive is write protected. */
        if (tape->write_prot)
                return -EACCES;
@@ -4187,6 +4178,7 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
        idetape_pc_t pc;
        int retval;
 
+       nonseekable_open(inode, filp);
 #if IDETAPE_DEBUG_LOG
        printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
 #endif /* IDETAPE_DEBUG_LOG */
@@ -4815,7 +4807,7 @@ static int idetape_ioctl(struct inode *inode, struct file *file,
 {
        struct block_device *bdev = inode->i_bdev;
        ide_drive_t *drive = bdev->bd_disk->private_data;
-       int err = generic_ide_ioctl(bdev, cmd, arg);
+       int err = generic_ide_ioctl(file, bdev, cmd, arg);
        if (err == -EINVAL)
                err = idetape_blkdev_ioctl(drive, cmd, arg);
        return err;
index 2bdb860..e99d9ec 100644 (file)
@@ -1453,8 +1453,8 @@ static int generic_ide_resume(struct device *dev)
        return ide_do_drive_cmd(drive, &rq, ide_head_wait);
 }
 
-int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
-                       unsigned long arg)
+int generic_ide_ioctl(struct file *file, struct block_device *bdev,
+                       unsigned int cmd, unsigned long arg)
 {
        ide_drive_t *drive = bdev->bd_disk->private_data;
        ide_settings_t *setting;
@@ -1605,7 +1605,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
 
                case CDROMEJECT:
                case CDROMCLOSETRAY:
-                       return scsi_cmd_ioctl(bdev->bd_disk, cmd, p);
+                       return scsi_cmd_ioctl(file, bdev->bd_disk, cmd, p);
 
                case HDIO_GET_BUSSTATE:
                        if (!capable(CAP_SYS_ADMIN))
index 6c25d34..5f5bc3b 100644 (file)
@@ -1,8 +1,9 @@
 /*
- * linux/drivers/ide/pci/hpt366.c              Version 0.34    Sept 17, 2002
+ * linux/drivers/ide/pci/hpt366.c              Version 0.36    April 25, 2003
  *
  * Copyright (C) 1999-2003             Andre Hedrick <andre@linux-ide.org>
  * Portions Copyright (C) 2001         Sun Microsystems, Inc.
+ * Portions Copyright (C) 2003         Red Hat Inc
  *
  * Thanks to HighPoint Technologies for their assistance, and hardware.
  * Special Thanks to Jon Burchmore in SanDiego for the deep pockets, his
  * Reset the hpt366 on error, reset on dma
  * Fix disabling Fast Interrupt hpt366.
  *     Mike Waychison <crlf@sun.com>
+ *
+ * Added support for 372N clocking and clock switching. The 372N needs
+ * different clocks on read/write. This requires overloading rw_disk and
+ * other deeply crazy things. Thanks to <http://www.hoerstreich.de> for
+ * keeping me sane. 
+ *             Alan Cox <alan@redhat.com>
+ *
  */
 
 
@@ -168,6 +176,9 @@ static u32 hpt_revision (struct pci_dev *dev)
        class_rev &= 0xff;
 
        switch(dev->device) {
+               /* Remap new 372N onto 372 */
+               case PCI_DEVICE_ID_TTI_HPT372N:
+                       class_rev = PCI_DEVICE_ID_TTI_HPT372; break;
                case PCI_DEVICE_ID_TTI_HPT374:
                        class_rev = PCI_DEVICE_ID_TTI_HPT374; break;
                case PCI_DEVICE_ID_TTI_HPT371:
@@ -217,6 +228,11 @@ static u8 hpt3xx_ratemask (ide_drive_t *drive)
        return mode;
 }
 
+/*
+ *     Note for the future; the SATA hpt37x we must set
+ *     either PIO or UDMA modes 0,4,5
+ */
 static u8 hpt3xx_ratefilter (ide_drive_t *drive, u8 speed)
 {
        struct pci_dev *dev     = HWIF(drive)->pci_dev;
@@ -672,6 +688,69 @@ static int hpt374_ide_dma_end (ide_drive_t *drive)
        return __ide_dma_end(drive);
 }
 
+/**
+ *     hpt372n_set_clock       -       perform clock switching dance
+ *     @drive: Drive to switch
+ *     @mode: Switching mode (0x21 for write, 0x23 otherwise)
+ *
+ *     Switch the DPLL clock on the HPT372N devices. This is a
+ *     right mess.
+ */
+static void hpt372n_set_clock(ide_drive_t *drive, int mode)
+{
+       ide_hwif_t *hwif        = HWIF(drive);
+       
+       /* FIXME: should we check for DMA active and BUG() */
+       /* Tristate the bus */
+       outb(0x80, hwif->dma_base+0x73);
+       outb(0x80, hwif->dma_base+0x77);
+       
+       /* Switch clock and reset channels */
+       outb(mode, hwif->dma_base+0x7B);
+       outb(0xC0, hwif->dma_base+0x79);
+       
+       /* Reset state machines */
+       outb(0x37, hwif->dma_base+0x70);
+       outb(0x37, hwif->dma_base+0x74);
+       
+       /* Complete reset */
+       outb(0x00, hwif->dma_base+0x79);
+       
+       /* Reconnect channels to bus */
+       outb(0x00, hwif->dma_base+0x73);
+       outb(0x00, hwif->dma_base+0x77);
+}
+
+/**
+ *     hpt372n_rw_disk         -       wrapper for I/O
+ *     @drive: drive for command
+ *     @rq: block request structure
+ *     @block: block number
+ *
+ *     This is called when a disk I/O is issued to the 372N instead
+ *     of the default functionality. We need it because of the clock
+ *     switching
+ *
+ */
+static ide_startstop_t hpt372n_rw_disk(ide_drive_t *drive, struct request *rq, sector_t block)
+{
+       int wantclock;
+       
+       if(rq_data_dir(rq) == READ)
+               wantclock = 0x21;
+       else
+               wantclock = 0x23;
+               
+       if(HWIF(drive)->config_data != wantclock)
+       {
+               hpt372n_set_clock(drive, wantclock);
+               HWIF(drive)->config_data = wantclock;
+       }
+       return __ide_do_rw_disk(drive, rq, block);
+}
+
 /*
  * Since SUN Cobalt is attempting to do this operation, I should disclose
  * this has been a long time ago Thu Jul 27 16:40:57 2000 was the patch date
@@ -793,13 +872,23 @@ static int __devinit init_hpt37x(struct pci_dev *dev)
        u16 freq;
        u32 pll;
        u8 reg5bh;
-
-#if 1
        u8 reg5ah = 0;
+       unsigned long dmabase = pci_resource_start(dev, 4);
+       u8 did, rid;    
+       int is_372n = 0;
+       
        pci_read_config_byte(dev, 0x5a, &reg5ah);
        /* interrupt force enable */
        pci_write_config_byte(dev, 0x5a, (reg5ah & ~0x10));
-#endif
+
+       if(dmabase)
+       {
+               did = inb(dmabase + 0x22);
+               rid = inb(dmabase + 0x28);
+       
+               if((did == 4 && rid == 6) || (did == 5 && rid > 1))
+                       is_372n = 1;
+       }
 
        /*
         * default to pci clock. make sure MA15/16 are set to output
@@ -810,47 +899,86 @@ static int __devinit init_hpt37x(struct pci_dev *dev)
        /*
         * set up the PLL. we need to adjust it so that it's stable. 
         * freq = Tpll * 192 / Tpci
+        *
+        * Todo. For non x86 should probably check the dword is
+        * set to 0xABCDExxx indicating the BIOS saved f_CNT
         */
        pci_read_config_word(dev, 0x78, &freq);
        freq &= 0x1FF;
-       if (freq < 0xa0) {
-               pll = F_LOW_PCI_33;
-               if (hpt_minimum_revision(dev,8))
-                       pci_set_drvdata(dev, (void *) thirty_three_base_hpt374);
-               else if (hpt_minimum_revision(dev,5))
-                       pci_set_drvdata(dev, (void *) thirty_three_base_hpt372);
-               else if (hpt_minimum_revision(dev,4))
-                       pci_set_drvdata(dev, (void *) thirty_three_base_hpt370a);
+       
+       /*
+        * The 372N uses different PCI clock information and has
+        * some other complications
+        *      On PCI33 timing we must clock switch
+        *      On PCI66 timing we must NOT use the PCI clock
+        *
+        * Currently we always set up the PLL for the 372N
+        */
+        
+       pci_set_drvdata(dev, NULL);
+       
+       if(is_372n)
+       {
+               printk(KERN_INFO "hpt: HPT372N detected, using 372N timing.\n");
+               if(freq < 0x55)
+                       pll = F_LOW_PCI_33;
+               else if(freq < 0x70)
+                       pll = F_LOW_PCI_40;
+               else if(freq < 0x7F)
+                       pll = F_LOW_PCI_50;
                else
-                       pci_set_drvdata(dev, (void *) thirty_three_base_hpt370);
-               printk("HPT37X: using 33MHz PCI clock\n");
-       } else if (freq < 0xb0) {
-               pll = F_LOW_PCI_40;
-       } else if (freq < 0xc8) {
-               pll = F_LOW_PCI_50;
-               if (hpt_minimum_revision(dev,8))
-                       pci_set_drvdata(dev, NULL);
-               else if (hpt_minimum_revision(dev,5))
-                       pci_set_drvdata(dev, (void *) fifty_base_hpt372);
-               else if (hpt_minimum_revision(dev,4))
-                       pci_set_drvdata(dev, (void *) fifty_base_hpt370a);
+                       pll = F_LOW_PCI_66;
+                       
+               printk(KERN_INFO "FREQ: %d PLL: %d\n", freq, pll);
+                       
+               /* We always use the pll not the PCI clock on 372N */
+       }
+       else
+       {
+               if(freq < 0x9C)
+                       pll = F_LOW_PCI_33;
+               else if(freq < 0xb0)
+                       pll = F_LOW_PCI_40;
+               else if(freq <0xc8)
+                       pll = F_LOW_PCI_50;
                else
-                       pci_set_drvdata(dev, (void *) fifty_base_hpt370a);
-               printk("HPT37X: using 50MHz PCI clock\n");
-       } else {
-               pll = F_LOW_PCI_66;
-               if (hpt_minimum_revision(dev,8))
-               {
-                       printk(KERN_ERR "HPT37x: 66MHz timings are not supported.\n");
-                       pci_set_drvdata(dev, NULL);
+                       pll = F_LOW_PCI_66;
+       
+               if (pll == F_LOW_PCI_33) {
+                       if (hpt_minimum_revision(dev,8))
+                               pci_set_drvdata(dev, (void *) thirty_three_base_hpt374);
+                       else if (hpt_minimum_revision(dev,5))
+                               pci_set_drvdata(dev, (void *) thirty_three_base_hpt372);
+                       else if (hpt_minimum_revision(dev,4))
+                               pci_set_drvdata(dev, (void *) thirty_three_base_hpt370a);
+                       else
+                               pci_set_drvdata(dev, (void *) thirty_three_base_hpt370);
+                       printk("HPT37X: using 33MHz PCI clock\n");
+               } else if (pll == F_LOW_PCI_40) {
+                       /* Unsupported */
+               } else if (pll == F_LOW_PCI_50) {
+                       if (hpt_minimum_revision(dev,8))
+                               pci_set_drvdata(dev, NULL);
+                       else if (hpt_minimum_revision(dev,5))
+                               pci_set_drvdata(dev, (void *) fifty_base_hpt372);
+                       else if (hpt_minimum_revision(dev,4))
+                               pci_set_drvdata(dev, (void *) fifty_base_hpt370a);
+                       else
+                               pci_set_drvdata(dev, (void *) fifty_base_hpt370a);
+                       printk("HPT37X: using 50MHz PCI clock\n");
+               } else {
+                       if (hpt_minimum_revision(dev,8))
+                       {
+                               printk(KERN_ERR "HPT37x: 66MHz timings are not supported.\n");
+                       }
+                       else if (hpt_minimum_revision(dev,5))
+                               pci_set_drvdata(dev, (void *) sixty_six_base_hpt372);
+                       else if (hpt_minimum_revision(dev,4))
+                               pci_set_drvdata(dev, (void *) sixty_six_base_hpt370a);
+                       else
+                               pci_set_drvdata(dev, (void *) sixty_six_base_hpt370);
+                       printk("HPT37X: using 66MHz PCI clock\n");
                }
-               else if (hpt_minimum_revision(dev,5))
-                       pci_set_drvdata(dev, (void *) sixty_six_base_hpt372);
-               else if (hpt_minimum_revision(dev,4))
-                       pci_set_drvdata(dev, (void *) sixty_six_base_hpt370a);
-               else
-                       pci_set_drvdata(dev, (void *) sixty_six_base_hpt370);
-               printk("HPT37X: using 66MHz PCI clock\n");
        }
        
        /*
@@ -863,6 +991,11 @@ static int __devinit init_hpt37x(struct pci_dev *dev)
        if (pci_get_drvdata(dev)) 
                goto init_hpt37X_done;
        
+       if (hpt_minimum_revision(dev,8))
+       {
+               printk(KERN_ERR "HPT374: Only 33MHz PCI timings are supported.\n");
+               return -EOPNOTSUPP;
+       }
        /*
         * adjust PLL based upon PCI clock, enable it, and wait for
         * stabilization.
@@ -1000,12 +1133,27 @@ static void __devinit init_hwif_hpt366(ide_hwif_t *hwif)
 {
        struct pci_dev *dev             = hwif->pci_dev;
        u8 ata66 = 0, regmask           = (hwif->channel) ? 0x01 : 0x02;
-
+       u8 did, rid;
+       unsigned long dmabase           = hwif->dma_base;
+       int is_372n = 0;
+       
+       if(dmabase)
+       {
+               did = inb(dmabase + 0x22);
+               rid = inb(dmabase + 0x28);
+       
+               if((did == 4 && rid == 6) || (did == 5 && rid > 1))
+                       is_372n = 1;
+       }
+               
        hwif->tuneproc                  = &hpt3xx_tune_drive;
        hwif->speedproc                 = &hpt3xx_tune_chipset;
        hwif->quirkproc                 = &hpt3xx_quirkproc;
        hwif->intrproc                  = &hpt3xx_intrproc;
        hwif->maskproc                  = &hpt3xx_maskproc;
+       
+       if(is_372n)
+               hwif->rw_disk = &hpt372n_rw_disk;
 
        /*
         * The HPT37x uses the CBLID pins as outputs for MA15/MA16
@@ -1179,7 +1327,8 @@ static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d
        u8 pin1 = 0, pin2 = 0;
        unsigned int class_rev;
        char *chipset_names[] = {"HPT366", "HPT366",  "HPT368",
-                                "HPT370", "HPT370A", "HPT372"};
+                                "HPT370", "HPT370A", "HPT372",
+                                "HPT372N" };
 
        if (PCI_FUNC(dev->devfn) & 1)
                return;
@@ -1187,9 +1336,14 @@ static void __devinit init_setup_hpt366(struct pci_dev *dev, ide_pci_device_t *d
        pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
        class_rev &= 0xff;
 
-       strcpy(d->name, chipset_names[class_rev]);
+       if(dev->device == PCI_DEVICE_ID_TTI_HPT372N)
+               class_rev = 6;
+               
+       if(class_rev <= 6)
+               d->name = chipset_names[class_rev];
 
        switch(class_rev) {
+               case 6:
                case 5:
                case 4:
                case 3: ide_setup_pci_device(dev, d);
@@ -1243,6 +1397,7 @@ static struct pci_device_id hpt366_pci_tbl[] = {
        { PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT302, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},
        { PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 3},
        { PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT374, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 4},
+       { PCI_VENDOR_ID_TTI, PCI_DEVICE_ID_TTI_HPT372N, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5},
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, hpt366_pci_tbl);
index 7b3d8b4..388d6ae 100644 (file)
@@ -470,6 +470,15 @@ static ide_pci_device_t hpt366_chipsets[] __devinitdata = {
                .channels       = 2,    /* 4 */
                .autodma        = AUTODMA,
                .bootable       = OFF_BOARD,
+       },{     /* 5 */
+               .name           = "HPT372N",
+               .init_setup     = init_setup_hpt37x,
+               .init_chipset   = init_chipset_hpt366,
+               .init_hwif      = init_hwif_hpt366,
+               .init_dma       = init_dma_hpt366,
+               .channels       = 2,    /* 4 */
+               .autodma        = AUTODMA,
+               .bootable       = OFF_BOARD,
        }
 };
 
index 626298d..ecf6830 100644 (file)
@@ -1322,7 +1322,7 @@ static unsigned int dv1394_poll(struct file *file, struct poll_table_struct *wai
 static int dv1394_fasync(int fd, struct file *file, int on)
 {
        /* I just copied this code verbatim from Alan Cox's mouse driver example
-          (linux/Documentation/DocBook/) */
+          (Documentation/DocBook/) */
 
        struct video_card *video = file_to_video_card(file);
 
@@ -2518,7 +2518,7 @@ static int handle_dv1394_init(unsigned int fd, unsigned int cmd, unsigned long a
        if (file->f_op->ioctl != dv1394_ioctl)
                return -EFAULT;
 
-       if (copy_from_user(&dv32, (void *)arg, sizeof(dv32)))
+       if (copy_from_user(&dv32, (void __user *)arg, sizeof(dv32)))
                return -EFAULT;
 
        dv.api_version = dv32.api_version;
@@ -2568,7 +2568,7 @@ static int handle_dv1394_get_status(unsigned int fd, unsigned int cmd, unsigned
                dv32.n_clear_frames = dv.n_clear_frames;
                dv32.dropped_frames = dv.dropped_frames;
 
-               if (copy_to_user((struct dv1394_status32 *)arg, &dv32, sizeof(dv32)))
+               if (copy_to_user((struct dv1394_status32 __user *)arg, &dv32, sizeof(dv32)))
                        ret = -EFAULT;
        }
 
index 95ccc69..a9709b8 100644 (file)
@@ -290,6 +290,20 @@ static int ether1394_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
+static inline void purge_partial_datagram(struct list_head *old)
+{
+       struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
+       struct list_head *lh, *n;
+
+       list_for_each_safe(lh, n, &pd->frag_info) {
+               struct fragment_info *fi = list_entry(lh, struct fragment_info, list);
+               list_del(lh);
+               kfree(fi);
+       }
+       list_del(old);
+       kfree_skb(pd->skb);
+       kfree(pd);
+}
 
 /******************************************
  * 1394 bus activity functions
@@ -1081,21 +1095,6 @@ static inline int update_partial_datagram(struct list_head *pdgl, struct list_he
        return 0;
 }
 
-static inline void purge_partial_datagram(struct list_head *old)
-{
-       struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
-       struct list_head *lh, *n;
-
-       list_for_each_safe(lh, n, &pd->frag_info) {
-               struct fragment_info *fi = list_entry(lh, struct fragment_info, list);
-               list_del(lh);
-               kfree(fi);
-       }
-       list_del(old);
-       kfree_skb(pd->skb);
-       kfree(pd);
-}
-
 static inline int is_datagram_complete(struct list_head *lh, int dg_size)
 {
        struct partial_datagram *pd = list_entry(lh, struct partial_datagram, list);
index 35a9056..d57a000 100644 (file)
 #include "raw1394.h"
 #include "raw1394-private.h"
 
-#if BITS_PER_LONG == 64
-#define int2ptr(x) ((void __user *)x)
+#define int2ptr(x) ((void __user *)(unsigned long)x)
 #define ptr2int(x) ((u64)(unsigned long)(void __user *)x)
-#else
-#define int2ptr(x) ((void __user *)(u32)x)
-#define ptr2int(x) ((u64)(unsigned long)(void __user *)x)
-#endif
 
 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
 #define RAW1394_DEBUG
@@ -1629,7 +1624,7 @@ static int arm_register(struct file_info *fi, struct pending_request *req)
         if (another_host) {
                 DBGMSG("another hosts entry is valid -> SUCCESS");
                 if (copy_to_user(int2ptr(req->req.recvb),
-                        int2ptr(&addr->start),sizeof(u64))) {
+                        &addr->start,sizeof(u64))) {
                         printk(KERN_ERR "raw1394: arm_register failed "
                               " address-range-entry is invalid -> EFAULT !!!\n");
                         vfree(addr->addr_space_buffer);
index e954d08..fd40358 100644 (file)
@@ -1003,11 +1003,9 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
        case VIDEO1394_IOC_TALK_QUEUE_BUFFER:
        {
                struct video1394_wait v;
-               struct video1394_queue_variable qv;
+               unsigned int *psizes = NULL;
                struct dma_iso_ctx *d;
 
-               qv.packet_sizes = NULL;
-
                if (copy_from_user(&v, argp, sizeof(v)))
                        return -EFAULT;
 
@@ -1021,22 +1019,21 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
                }
 
                if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
-                       unsigned int *psizes;
                        int buf_size = d->nb_cmd * sizeof(unsigned int);
+                       struct video1394_queue_variable __user *p = argp;
+                       unsigned int __user *qv;
 
-                       if (copy_from_user(&qv, argp, sizeof(qv)))
+                       if (get_user(qv, &p->packet_sizes))
                                return -EFAULT;
 
                        psizes = kmalloc(buf_size, GFP_KERNEL);
                        if (!psizes)
                                return -ENOMEM;
 
-                       if (copy_from_user(psizes, qv.packet_sizes, buf_size)) {
+                       if (copy_from_user(psizes, qv, buf_size)) {
                                kfree(psizes);
                                return -EFAULT;
                        }
-
-                       qv.packet_sizes = psizes;
                }
 
                spin_lock_irqsave(&d->lock,flags);
@@ -1045,14 +1042,14 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
                        PRINT(KERN_ERR, ohci->host->id,
                              "Buffer %d is already used",v.buffer);
                        spin_unlock_irqrestore(&d->lock,flags);
-                       if (qv.packet_sizes)
-                               kfree(qv.packet_sizes);
+                       if (psizes)
+                               kfree(psizes);
                        return -EFAULT;
                }
 
                if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
                        initialize_dma_it_prg_var_packet_queue(
-                               d, v.buffer, qv.packet_sizes,
+                               d, v.buffer, psizes,
                                ohci);
                }
 
@@ -1101,8 +1098,8 @@ static int video1394_ioctl(struct inode *inode, struct file *file,
                        }
                }
 
-               if (qv.packet_sizes)
-                       kfree(qv.packet_sizes);
+               if (psizes)
+                       kfree(psizes);
 
                return 0;
 
@@ -1339,6 +1336,7 @@ struct video1394_wait32 {
 static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long arg,
                               struct file *file)
 {
+        struct video1394_wait32 __user *argp = (void __user *)arg;
         struct video1394_wait32 wait32;
         struct video1394_wait wait;
         mm_segment_t old_fs;
@@ -1347,7 +1345,7 @@ static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long
        if (file->f_op->ioctl != video1394_ioctl)
                return -EFAULT;
 
-        if (copy_from_user(&wait32, (void *)arg, sizeof(wait32)))
+        if (copy_from_user(&wait32, argp, sizeof(wait32)))
                 return -EFAULT;
 
         wait.channel = wait32.channel;
@@ -1373,7 +1371,7 @@ static int video1394_wr_wait32(unsigned int fd, unsigned int cmd, unsigned long
                 wait32.filltime.tv_sec = (int)wait.filltime.tv_sec;
                 wait32.filltime.tv_usec = (int)wait.filltime.tv_usec;
 
-                if (copy_to_user((struct video1394_wait32 *)arg, &wait32, sizeof(wait32)))
+                if (copy_to_user(argp, &wait32, sizeof(wait32)))
                         ret = -EFAULT;
         }
 
@@ -1391,7 +1389,7 @@ static int video1394_w_wait32(unsigned int fd, unsigned int cmd, unsigned long a
        if (file->f_op->ioctl != video1394_ioctl)
                return -EFAULT;
 
-        if (copy_from_user(&wait32, (void *)arg, sizeof(wait32)))
+        if (copy_from_user(&wait32, (void __user *)arg, sizeof(wait32)))
                 return -EFAULT;
 
         wait.channel = wait32.channel;
index 3e83968..7e52f96 100644 (file)
@@ -158,11 +158,11 @@ static unsigned int get_time_pit(void)
 
         return count;
 }
-#elif __x86_64__
+#elif defined(__x86_64__)
 #define GET_TIME(x)    rdtscl(x)
 #define DELTA(x,y)     ((y)-(x))
 #define TIME_NAME      "TSC"
-#elif __alpha__
+#elif defined(__alpha__)
 #define GET_TIME(x)    do { x = get_cycles(); } while (0)
 #define DELTA(x,y)     ((y)-(x))
 #define TIME_NAME      "PCC"
index 42d7c6b..3429d57 100644 (file)
@@ -656,9 +656,6 @@ capi_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
        struct sk_buff *skb;
        size_t copied;
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (!cdev->ap.applid)
                return -ENODEV;
 
@@ -699,9 +696,6 @@ capi_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos
        struct sk_buff *skb;
        u16 mlen;
 
-        if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (!cdev->ap.applid)
                return -ENODEV;
 
@@ -965,7 +959,7 @@ capi_open(struct inode *inode, struct file *file)
        if ((file->private_data = capidev_alloc()) == 0)
                return -ENOMEM;
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index 1d66481..6b22a8a 100644 (file)
@@ -151,9 +151,6 @@ maint_read(struct file *file, char __user *buf, size_t count, loff_t * off)
        int str_length;
        int *str_msg;
 
-       if (off != &file->f_pos)
-               return -ESPIPE;
-
        if (!file->private_data) {
                for (;;) {
                        while (
@@ -306,7 +303,7 @@ static int maint_open(struct inode *ino, struct file *filep)
 
        filep->private_data = NULL;
 
-       return (0);
+       return nonseekable_open(ino, filep);
 }
 
 static int maint_close(struct inode *ino, struct file *filep)
index 192fae4..55e83d1 100644 (file)
@@ -63,8 +63,6 @@ divas_read(struct file *file, char __user *buf, size_t count, loff_t * off)
 
        if (*off)
                return 0;
-       if (off != &file->f_pos)
-               return -ESPIPE;
 
        divas_get_version(tmpbuf);
        if (copy_to_user(buf + len, &tmpbuf, strlen(tmpbuf)))
@@ -107,7 +105,7 @@ static unsigned int divas_poll(struct file *file, poll_table * wait)
 
 static int divas_open(struct inode *inode, struct file *file)
 {
-       return (0);
+       return nonseekable_open(inode, file);
 }
 
 static int divas_close(struct inode *inode, struct file *file)
index 68caa73..c7709db 100644 (file)
@@ -110,7 +110,7 @@ config HISAX_16_3
 
 config HISAX_TELESPCI
        bool "Teles PCI"
-       depends on PCI
+       depends on PCI && (BROKEN || !(SPARC64 || PPC))
        help
          This enables HiSax support for the Teles PCI.
          See <file:Documentation/isdn/README.HiSax> on how to configure it.
@@ -237,7 +237,7 @@ config HISAX_MIC
 
 config HISAX_NETJET
        bool "NETjet card"
-       depends on PCI
+       depends on PCI && (BROKEN || !(SPARC64 || PPC))
        help
          This enables HiSax support for the NetJet from Traverse
          Technologies.
@@ -248,7 +248,7 @@ config HISAX_NETJET
 
 config HISAX_NETJET_U
        bool "NETspider U card"
-       depends on PCI
+       depends on PCI && (BROKEN || !(SPARC64 || PPC))
        help
          This enables HiSax support for the Netspider U interface ISDN card
          from Traverse Technologies.
@@ -316,7 +316,7 @@ config HISAX_GAZEL
 
 config HISAX_HFC_PCI
        bool "HFC PCI-Bus cards"
-       depends on PCI
+       depends on PCI && (BROKEN || !(SPARC64 || PPC))
        help
          This enables HiSax support for the HFC-S PCI 2BDS0 based cards.
 
@@ -343,7 +343,7 @@ config HISAX_HFC_SX
 
 config HISAX_ENTERNOW_PCI
        bool "Formula-n enter:now PCI card"
-       depends on PCI
+       depends on PCI && (BROKEN || !(SPARC64 || PPC))
        help
          This enables HiSax support for the Formula-n enter:now PCI
          ISDN card.
@@ -413,7 +413,7 @@ config HISAX_HFCUSB
 
 config HISAX_FRITZ_PCIPNP
        tristate "AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)"
-       depends on EXPERIMENTAL
+       depends on PCI && EXPERIMENTAL
        help
          This enables the driver for the AVM Fritz!Card PCI,
          Fritz!Card PCI v2 and Fritz!Card PnP.
index 7a2d65a..26bb71d 100644 (file)
@@ -8,7 +8,7 @@
  * of the GNU General Public License, incorporated herein by reference.
  *
  * For changes and modifications please read
- * ../../../Documentation/isdn/HiSax.cert
+ * Documentation/isdn/HiSax.cert
  *
  * based on the teles driver from Jan den Ouden
  *
@@ -1878,6 +1878,7 @@ static void EChannel_proc_rcv(struct hisax_d_if *d_if)
        }
 }
 
+#ifdef CONFIG_PCI
 #include <linux/pci.h>
 
 static struct pci_device_id hisax_pci_tbl[] __initdata = {
@@ -1946,6 +1947,7 @@ static struct pci_device_id hisax_pci_tbl[] __initdata = {
 };
 
 MODULE_DEVICE_TABLE(pci, hisax_pci_tbl);
+#endif /* CONFIG_PCI */
 
 module_init(HiSax_init);
 module_exit(HiSax_exit);
index 843ed75..2b54e7d 100644 (file)
@@ -9,7 +9,7 @@
  * of the GNU General Public License, incorporated herein by reference.
  *
  * For changes and modifications please read
- * ../../../Documentation/isdn/HiSax.cert
+ * Documentation/isdn/HiSax.cert
  *
  * Thanks to Eicon Technology for documents and information
  *
index c8d7571..fe61d26 100644 (file)
@@ -701,8 +701,8 @@ static void write_raw(struct BCState *bcs, u_int *buf, int cnt) {
                }
                bcs->hw.tiger.s_tot += s_cnt;
                if (bcs->cs->debug & L1_DEB_HSCX)
-                       debugl1(bcs->cs,"tiger write_raw: c%d %x-%x %d/%d %d %x", bcs->channel,
-                               (u_int)buf, (u_int)p, s_cnt, cnt,
+                       debugl1(bcs->cs,"tiger write_raw: c%d %p-%p %d/%d %d %x", bcs->channel,
+                               buf, p, s_cnt, cnt,
                                bcs->hw.tiger.sendcnt, bcs->cs->hw.njet.irqstat0);
                if (bcs->cs->debug & L1_DEB_HSCX_FIFO)
                        printframe(bcs->cs, bcs->hw.tiger.sp, s_cnt, "snd");
@@ -931,8 +931,8 @@ inittiger(struct IsdnCardState *cs)
        cs->bcs[1].hw.tiger.s_end = cs->bcs[0].hw.tiger.s_end;
        
        memset(cs->bcs[0].hw.tiger.send, 0xff, NETJET_DMA_TXSIZE * sizeof(unsigned int));
-       debugl1(cs, "tiger: send buf %x - %x", (u_int)cs->bcs[0].hw.tiger.send,
-               (u_int)(cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1));
+       debugl1(cs, "tiger: send buf %p - %p", cs->bcs[0].hw.tiger.send,
+               cs->bcs[0].hw.tiger.send + NETJET_DMA_TXSIZE - 1);
        outl(virt_to_bus(cs->bcs[0].hw.tiger.send),
                cs->hw.njet.base + NETJET_DMA_READ_START);
        outl(virt_to_bus(cs->bcs[0].hw.tiger.s_irq),
@@ -945,8 +945,8 @@ inittiger(struct IsdnCardState *cs)
                       "HiSax: No memory for tiger.rec\n");
                return;
        }
-       debugl1(cs, "tiger: rec buf %x - %x", (u_int)cs->bcs[0].hw.tiger.rec,
-               (u_int)(cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1));
+       debugl1(cs, "tiger: rec buf %p - %p", cs->bcs[0].hw.tiger.rec,
+               cs->bcs[0].hw.tiger.rec + NETJET_DMA_RXSIZE - 1);
        cs->bcs[1].hw.tiger.rec = cs->bcs[0].hw.tiger.rec;
        memset(cs->bcs[0].hw.tiger.rec, 0xff, NETJET_DMA_RXSIZE * sizeof(unsigned int));
        outl(virt_to_bus(cs->bcs[0].hw.tiger.rec),
index 5ff7fdf..51d1202 100644 (file)
@@ -623,7 +623,7 @@ static void ph_connect(struct st5481_adapter *adapter)
        st5481_usb_device_ctrl_msg(adapter, FFMSK_D, 0xfc, NULL, NULL);
        st5481_in_mode(d_in, L1_MODE_HDLC);
 
-#if LOOPBACK
+#ifdef LOOPBACK
        // Turn loopback on (data sent on B and D looped back)
        st5481_usb_device_ctrl_msg(cs, LBB, 0x04, NULL, NULL);
 #endif
index 6056ac1..082726d 100644 (file)
@@ -8,7 +8,7 @@
  * of the GNU General Public License, incorporated herein by reference.
  *
  * For changes and modifications please read
- * ../../../Documentation/isdn/HiSax.cert
+ * Documentation/isdn/HiSax.cert
  *
  * Thanks to    Jan den Ouden
  *              Fritz Elfert
index eb71c80..4956e2e 100644 (file)
@@ -946,9 +946,6 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
        int retval;
        char *p;
 
-       if (off != &file->f_pos)
-               return -ESPIPE;
-
        lock_kernel();
        if (minor == ISDN_MINOR_STATUS) {
                if (!file->private_data) {
@@ -1051,9 +1048,6 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
        int chidx;
        int retval;
 
-       if (off != &file->f_pos)
-               return -ESPIPE;
-
        if (minor == ISDN_MINOR_STATUS)
                return -EPERM;
        if (!dev->drivers)
@@ -1659,6 +1653,7 @@ isdn_open(struct inode *ino, struct file *filep)
        }
 #endif
  out:
+       nonseekable_open(ino, filep);
        return retval;
 }
 
index 443cb25..69c6884 100644 (file)
@@ -1432,7 +1432,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
        unsigned long expires = 0;
        int tmp = 0;
        int period = lp->cisco_keepalive_period;
-       char debserint = lp->cisco_debserint;
+       s8 debserint = lp->cisco_debserint;
        int rc = 0;
 
        if (lp->p_encap != ISDN_NET_ENCAP_CISCOHDLCK)
index ee2071b..da1d2fb 100644 (file)
@@ -8,7 +8,7 @@
  * stuff needed to support the Linux X.25 PLP code on top of devices that
  * can provide a lab_b service using the concap_proto mechanism.
  * This module supports a network interface wich provides lapb_sematics
- * -- as defined in ../../Documentation/networking/x25-iface.txt -- to
+ * -- as defined in Documentation/networking/x25-iface.txt -- to
  * the upper layer and assumes that the lower layer provides a reliable
  * data link service by means of the concap_device_ops callbacks.
  *
@@ -270,7 +270,7 @@ int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
 }
 
 /* process a frame handed over to us from linux network layer. First byte
-   semantics as defined in ../../Documentation/networking/x25-iface.txt 
+   semantics as defined in Documentation/networking/x25-iface.txt
    */
 int isdn_x25iface_xmit(struct concap_proto *cprot, struct sk_buff *skb)
 {
index c1b6118..ae690b7 100644 (file)
@@ -30,7 +30,7 @@ void copy_to_pam_dword(tpam_card *card, const void *addr, u32 val) {
               card->bar0 + TPAM_PAGE_REGISTER);
 
        /* write the value */
-       writel(val, card->bar0 + (((u32)addr) & TPAM_PAGE_SIZE));
+       writel(val, card->bar0 + (((unsigned long)addr) & TPAM_PAGE_SIZE));
 }
 
 /*
index 80b5a82..f87ed85 100644 (file)
@@ -118,13 +118,6 @@ config PMAC_BACKLIGHT
          events; also, the PowerBook button device will be enabled so you can
          change the screen brightness.
 
-config MAC_FLOPPY
-       bool "Support for PowerMac floppy"
-       depends on PPC_PMAC && !PPC_PMAC64
-       help
-         If you have a SWIM-3 (Super Woz Integrated Machine 3; from Apple)
-         floppy controller, say Y here. Most commonly found in PowerMacs.
-
 config MAC_SERIAL
        tristate "Support for PowerMac serial ports (OBSOLETE DRIVER)"
        depends on PPC_PMAC && BROKEN
@@ -191,7 +184,7 @@ config THERM_PM72
          G5 machines. 
 
 config ANSLCD
-       bool "Support for ANS LCD display"
+       tristate "Support for ANS LCD display"
        depends on ADB_CUDA && PPC_PMAC
 
 endmenu
index 3d2357e..b7cc2da 100644 (file)
@@ -139,10 +139,9 @@ static void printADBreply(struct adb_request *req)
 static __inline__ void adb_wait_ms(unsigned int ms)
 {
        if (current->pid && adb_probe_task_pid &&
-         adb_probe_task_pid == current->pid) {
-               set_task_state(current, TASK_UNINTERRUPTIBLE);
-               schedule_timeout(1 + ms * HZ / 1000);
-       } else
+         adb_probe_task_pid == current->pid)
+               msleep(ms);
+       else
                mdelay(ms);
 }
 
@@ -561,7 +560,7 @@ adb_unregister(int index)
                        write_lock_irq(&adb_handler_lock);
                }
                ret = 0;
-               adb_handler[index].handler = 0;
+               adb_handler[index].handler = NULL;
        }
        write_unlock_irq(&adb_handler_lock);
        up(&adb_handler_sem);
index fb2e070..32333f2 100644 (file)
@@ -317,6 +317,20 @@ static int fan_write_reg(int reg, const unsigned char *ptr, int nb)
        return nw;
 }
 
+static int start_fcu(void)
+{
+       unsigned char buf = 0xff;
+       int rc;
+
+       rc = fan_write_reg(0xe, &buf, 1);
+       if (rc < 0)
+               return -EIO;
+       rc = fan_write_reg(0x2e, &buf, 1);
+       if (rc < 0)
+               return -EIO;
+       return 0;
+}
+
 static int set_rpm_fan(int fan, int rpm)
 {
        unsigned char buf[2];
@@ -1011,6 +1025,12 @@ static int main_control_loop(void *x)
 
        down(&driver_lock);
 
+       if (start_fcu() < 0) {
+               printk(KERN_ERR "kfand: failed to start FCU\n");
+               up(&driver_lock);
+               goto out;
+       }
+
        /* Set the PCI fan once for now */
        set_pwm_fan(SLOTS_FAN_PWM_ID, SLOTS_FAN_DEFAULT_PWM);
 
@@ -1057,6 +1077,7 @@ static int main_control_loop(void *x)
                        schedule_timeout(HZ - elapsed);
        }
 
+ out:
        DBG("main_control_loop ended\n");
 
        ctrl_task = 0;
index 3d87901..a9df710 100644 (file)
@@ -120,7 +120,7 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error)
 
        if (uptodate)
                multipath_end_bh_io(mp_bh, uptodate);
-       else {
+       else if ((bio->bi_rw & (1 << BIO_RW_AHEAD)) == 0) {
                /*
                 * oops, IO error:
                 */
@@ -130,7 +130,8 @@ int multipath_end_request(struct bio *bio, unsigned int bytes_done, int error)
                       bdevname(rdev->bdev,b), 
                       (unsigned long long)bio->bi_sector);
                multipath_reschedule_retry(mp_bh);
-       }
+       } else
+               multipath_end_bh_io(mp_bh, 0);
        rdev_dec_pending(rdev, conf->mddev);
        return 0;
 }
@@ -382,7 +383,11 @@ static void multipathd (mddev_t *mddev)
                                " to another IO path\n",
                                bdevname(bio->bi_bdev,b),
                                (unsigned long long)bio->bi_sector);
+                       *bio = *(mp_bh->master_bio);
                        bio->bi_bdev = conf->multipaths[mp_bh->path].rdev->bdev;
+                       bio->bi_rw |= (1 << BIO_RW_FAILFAST);
+                       bio->bi_end_io = multipath_end_request;
+                       bio->bi_private = mp_bh;
                        generic_make_request(bio);
                }
        }
index 773f9bf..b28f290 100644 (file)
@@ -55,7 +55,7 @@
  */
 #define RAID5_DEBUG    0
 #define RAID5_PARANOIA 1
-#if RAID5_PARANOIA && CONFIG_SMP
+#if RAID5_PARANOIA && defined(CONFIG_SMP)
 # define CHECK_DEVLOCK() if (!spin_is_locked(&conf->device_lock)) BUG()
 #else
 # define CHECK_DEVLOCK()
index 714dfb2..1ad99be 100644 (file)
@@ -61,7 +61,7 @@
 #define RAID6_DEBUG    0       /* Extremely verbose printk */
 #define RAID6_PARANOIA 1       /* Check spinlocks */
 #define RAID6_DUMPSTATE 0      /* Include stripe cache state in /proc/mdstat */
-#if RAID6_PARANOIA && CONFIG_SMP
+#if RAID6_PARANOIA && defined(CONFIG_SMP)
 # define CHECK_DEVLOCK() if (!spin_is_locked(&conf->device_lock)) BUG()
 #else
 # define CHECK_DEVLOCK()
index e350595..657d557 100644 (file)
@@ -179,7 +179,7 @@ static int dvb_dmx_swfilter_sectionfilter (struct dvb_demux_feed *feed,
                neq |= f->maskandnotmode[i] & xor;
        }
 
-       if (f->doneq & !neq)
+       if (f->doneq && !neq)
                return 0;
 
        return feed->cb.sec (feed->feed.sec.secbuf, feed->feed.sec.seclen, 
index 4559f7c..2a39b2e 100644 (file)
@@ -36,7 +36,11 @@ int dvb_usercopy(struct inode *inode, struct file *file,
         /*  Copy arguments into temp kernel buffer  */
         switch (_IOC_DIR(cmd)) {
         case _IOC_NONE:
-                parg = NULL;
+               /*
+                * For this command, the pointer is actually an integer
+                * argument.
+                */
+                parg = (void *) arg;
                 break;
         case _IOC_READ: /* some v4l ioctls are marked wrong ... */
         case _IOC_WRITE:
index a047976..dfa5be4 100644 (file)
@@ -43,7 +43,7 @@
 #include "dvb_functions.h"
 
 
-static inline __u32 iov_crc32( __u32 c, struct iovec *iov, unsigned int cnt )
+static inline __u32 iov_crc32( __u32 c, struct kvec *iov, unsigned int cnt )
 {
        unsigned int j;
        for (j = 0; j < cnt; j++)
@@ -481,7 +481,7 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
                        /* Check CRC32, we've got it in our skb already. */
                        unsigned short ulen = htons(priv->ule_sndu_len);
                        unsigned short utype = htons(priv->ule_sndu_type);
-                       struct iovec iov[4] = {
+                       struct kvec iov[4] = {
                                { &ulen, sizeof ulen },
                                { &utype, sizeof utype },
                                { NULL, 0 },
index 76a6027..28dc299 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 
-#define __KERNEL_SYSCALLS__
 #include <linux/kernel.h>
 #include <linux/vmalloc.h>
 #include <linux/module.h>
@@ -40,7 +39,6 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
-#include <linux/unistd.h>
 #include <linux/fcntl.h>
 #include <linux/errno.h>
 #include <linux/syscalls.h>
@@ -399,13 +397,13 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda
 
        // Load the firmware
        set_fs(get_ds());
-       fd = open(tda1004x_firmware, 0, 0);
+       fd = sys_open(tda1004x_firmware, 0, 0);
        if (fd < 0) {
                printk("%s: Unable to open firmware %s\n", __FUNCTION__,
                       tda1004x_firmware);
                return -EIO;
        }
-       filesize = lseek(fd, 0L, 2);
+       filesize = sys_lseek(fd, 0L, 2);
        if (filesize <= 0) {
                printk("%s: Firmware %s is empty\n", __FUNCTION__,
                       tda1004x_firmware);
@@ -436,8 +434,8 @@ static int tda1004x_fwupload(struct dvb_i2c_bus *i2c, struct tda1004x_state *tda
        }
 
        // read it!
-       lseek(fd, fw_offset, 0);
-       if (read(fd, firmware, fw_size) != fw_size) {
+       sys_lseek(fd, fw_offset, 0);
+       if (sys_read(fd, firmware, fw_size) != fw_size) {
                printk("%s: Failed to read firmware\n", __FUNCTION__);
                vfree(firmware);
                sys_close(fd);
index 18e4771..4fd5e32 100644 (file)
@@ -75,7 +75,7 @@ static int pcm20_getflags(struct pcm20_device *dev, __u32 *flags, __u16 *signal)
 
        if ((i=aci_rw_cmd(ACI_READ_TUNERSTATION, -1, -1))<0)
                return i;
-#if DEBUG
+#ifdef DEBUG
        printk("check_sig: 0x%x\n", i);
 #endif
        if (i & 0x80) {
@@ -107,7 +107,7 @@ static int pcm20_getflags(struct pcm20_device *dev, __u32 *flags, __u16 *signal)
 
        if ((i=aci_rds_cmd(RDS_RXVALUE, &buf, 1))<0)
                return i;
-#if DEBUG
+#ifdef DEBUG
        printk("rds-signal: %d\n", buf);
 #endif
        if (buf > 15) {
@@ -172,7 +172,7 @@ static int pcm20_do_ioctl(struct inode *inode, struct file *file,
                        unsigned long *freq = arg;
                        pcm20->freq = *freq;
                        i=pcm20_setfreq(pcm20, pcm20->freq);
-#if DEBUG
+#ifdef DEBUG
                        printk("First view (setfreq): 0x%x\n", i);
 #endif
                        return i;
index 48f130f..cf87dda 100644 (file)
@@ -324,7 +324,7 @@ int saa7134_buffer_queue(struct saa7134_dev *dev,
                         struct saa7134_buf *buf)
 {
        struct saa7134_buf *next = NULL;
-#if DEBUG_SPINLOCKS
+#ifdef DEBUG_SPINLOCKS
        BUG_ON(!spin_is_locked(&dev->slock));
 #endif
        
@@ -353,7 +353,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev,
                           struct saa7134_dmaqueue *q,
                           unsigned int state)
 {
-#if DEBUG_SPINLOCKS
+#ifdef DEBUG_SPINLOCKS
        BUG_ON(!spin_is_locked(&dev->slock));
 #endif
        dprintk("buffer_finish %p\n",q->curr);
@@ -370,7 +370,7 @@ void saa7134_buffer_next(struct saa7134_dev *dev,
 {
        struct saa7134_buf *buf,*next = NULL;
 
-#if DEBUG_SPINLOCKS
+#ifdef DEBUG_SPINLOCKS
        BUG_ON(!spin_is_locked(&dev->slock));
 #endif
        BUG_ON(NULL != q->curr);
@@ -427,7 +427,7 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)
        enum v4l2_field cap = V4L2_FIELD_ANY;
        enum v4l2_field ov  = V4L2_FIELD_ANY;
 
-#if DEBUG_SPINLOCKS
+#ifdef DEBUG_SPINLOCKS
        BUG_ON(!spin_is_locked(&dev->slock));
 #endif
 
index 7a70df4..f0d9b13 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/videodev.h>
 #include <linux/spinlock.h>
 #include <linux/sem.h>
+#include <linux/seq_file.h>
 
 #include <linux/ctype.h>
 #include <asm/io.h>
@@ -93,14 +94,6 @@ static const struct procfs_params_zr36067 zr67[] = {
        {NULL, 0, 0, 0},
 };
 
-struct procfs_io {
-       char *buffer;
-       char *end;
-       int neof;
-       int count;
-       int count_current;
-};
-
 static void
 setparam (struct zoran *zr,
          char         *name,
@@ -130,85 +123,34 @@ setparam (struct zoran *zr,
        }
 }
 
-static int
-print_procfs (struct procfs_io *io,
-             const char       *fmt,
-             ...)
-{
-       va_list args;
-       int i;
-
-       if (io->buffer >= io->end) {
-               io->neof++;
-               return 0;
-       }
-       if (io->count > io->count_current++)
-               return 0;
-       va_start(args, fmt);
-       i = vsprintf(io->buffer, fmt, args);
-       io->buffer += i;
-       va_end(args);
-       return i;
-}
-
-static void
-zoran_procfs_output (struct procfs_io *io,
-                    void             *data)
+static int zoran_show(struct seq_file *p, void *v)
 {
+       struct zoran *zr = p->private;
        int i;
-       struct zoran *zr;
-       zr = (struct zoran *) data;
 
-       print_procfs(io, "ZR36067 registers:");
-       for (i = 0; i < 0x130; i += 4) {
-               if (!(i % 16)) {
-                       print_procfs(io, "\n%03X", i);
-               };
-               print_procfs(io, " %08X ", btread(i));
-       };
-       print_procfs(io, "\n");
+       seq_printf(p, "ZR36067 registers:\n");
+       for (i = 0; i < 0x130; i += 16)
+               seq_printf(p, "%03X %08X  %08X  %08X  %08X \n", i,
+                          btread(i), btread(i+4), btread(i+8), btread(i+12));
+       return 0;
 }
 
-static int
-zoran_read_proc (char  *buffer,
-                char **start,
-                off_t  offset,
-                int    size,
-                int   *eof,
-                void  *data)
+static int zoran_open(struct inode *inode, struct file *file)
 {
-       struct procfs_io io;
-       int nbytes;
-
-       io.buffer = buffer;
-       io.end = buffer + size - 128;   // Just to make it a little bit safer
-       io.count = offset;
-       io.count_current = 0;
-       io.neof = 0;
-       zoran_procfs_output(&io, data);
-       *start = (char *) (io.count_current - io.count);
-       nbytes = (int) (io.buffer - buffer);
-       *eof = !io.neof;
-       return nbytes;
-
-       return 0;
+       struct zoran *data = PDE(inode)->data;
+       return single_open(file, zoran_show, data);
 }
 
-static int
-zoran_write_proc (struct file   *file,
-                 const char    __user *buffer,
-                 unsigned long  count,
-                 void          *data)
+static ssize_t zoran_write(struct file *file, const char __user *buffer,
+                       size_t count, loff_t *ppos)
 {
+       struct zoran *zr = PDE(file->f_dentry->d_inode)->data;
        char *string, *sp;
        char *line, *ldelim, *varname, *svar, *tdelim;
-       struct zoran *zr;
 
        if (count > 32768)      /* Stupidity filter */
                return -EINVAL;
 
-       zr = (struct zoran *) data;
-
        string = sp = vmalloc(count + 1);
        if (!string) {
                dprintk(1,
@@ -222,8 +164,8 @@ zoran_write_proc (struct file   *file,
                return -EFAULT;
        }
        string[count] = 0;
-       dprintk(4, KERN_INFO "%s: write_proc: name=%s count=%lu data=%x\n",
-               ZR_DEVNAME(zr), file->f_dentry->d_name.name, count, (int) data);
+       dprintk(4, KERN_INFO "%s: write_proc: name=%s count=%zu zr=%p\n",
+               ZR_DEVNAME(zr), file->f_dentry->d_name.name, count, zr);
        ldelim = " \t\n";
        tdelim = "=";
        line = strpbrk(sp, ldelim);
@@ -243,6 +185,14 @@ zoran_write_proc (struct file   *file,
 
        return count;
 }
+
+static struct file_operations zoran_operations = {
+       .open           = zoran_open,
+       .read           = seq_read,
+       .write          = zoran_write,
+       .llseek         = seq_lseek,
+       .release        = single_release,
+};
 #endif
 
 int
@@ -253,10 +203,9 @@ zoran_proc_init (struct zoran *zr)
 
        snprintf(name, 7, "zoran%d", zr->id);
        if ((zr->zoran_proc = create_proc_entry(name, 0, NULL))) {
-               zr->zoran_proc->read_proc = zoran_read_proc;
-               zr->zoran_proc->write_proc = zoran_write_proc;
                zr->zoran_proc->data = zr;
                zr->zoran_proc->owner = THIS_MODULE;
+               zr->zoran_proc->proc_fops = &zoran_operations;
                dprintk(2,
                        KERN_INFO
                        "%s: procfs entry /proc/%s allocated. data=%p\n",
@@ -277,9 +226,8 @@ zoran_proc_cleanup (struct zoran *zr)
        char name[8];
 
        snprintf(name, 7, "zoran%d", zr->id);
-       if (zr->zoran_proc) {
+       if (zr->zoran_proc)
                remove_proc_entry(name, NULL);
-       }
        zr->zoran_proc = NULL;
 #endif
 }
index 2839166..f0aaaa2 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Kconfig,v 1.5 2004/06/04 15:59:32 gleixner Exp $
+# $Id: Kconfig,v 1.6 2004/08/09 13:19:42 dwmw2 Exp $
 
 menu "Memory Technology Devices (MTD)"
 
@@ -28,7 +28,7 @@ config MTD_DEBUG_VERBOSE
          Determines the verbosity level of the MTD debugging messages.
 
 config MTD_PARTITIONS
-       tristate "MTD partitioning support"
+       bool "MTD partitioning support"
        depends on MTD
        help
          If you have a device which needs to divide its flash chip(s) up
index 85239c9..e4ad588 100644 (file)
@@ -1,12 +1,14 @@
 #
 # Makefile for the memory technology device drivers.
 #
-# $Id: Makefile.common,v 1.3 2004/07/12 16:07:30 dwmw2 Exp $
+# $Id: Makefile.common,v 1.5 2004/08/10 20:51:49 dwmw2 Exp $
 
 # Core functionality.
-obj-$(CONFIG_MTD)              += mtdcore.o
+mtd-y                          := mtdcore.o
+mtd-$(CONFIG_MTD_PARTITIONS)   += mtdpart.o
+obj-$(CONFIG_MTD)              += $(mtd-y)
+
 obj-$(CONFIG_MTD_CONCAT)       += mtdconcat.o
-obj-$(CONFIG_MTD_PARTITIONS)   += mtdpart.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
 obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
 obj-$(CONFIG_MTD_AFS_PARTS)    += afs.o
index 1247669..2d2b7d4 100644 (file)
@@ -1,5 +1,5 @@
 # drivers/mtd/chips/Kconfig
-# $Id: Kconfig,v 1.8 2004/07/13 22:32:02 dwmw2 Exp $
+# $Id: Kconfig,v 1.9 2004/07/16 15:32:14 dwmw2 Exp $
 
 menu "RAM/ROM/Flash chip drivers"
        depends on MTD!=n
@@ -233,6 +233,7 @@ config MTD_ABSENT
          with this driver will return -ENODEV upon access.
 
 config MTD_OBSOLETE_CHIPS
+       depends on MTD && BROKEN
        bool "Older (theoretically obsoleted now) drivers for non-CFI chips"
        help
          This option does not enable any code directly, but will allow you to
index ca710c7..1c1640e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Author: Jonas Holmberg <jonas.holmberg@axis.com>
  *
- * $Id: amd_flash.c,v 1.24 2004/07/12 13:34:30 dwmw2 Exp $
+ * $Id: amd_flash.c,v 1.25 2004/08/09 13:19:43 dwmw2 Exp $
  *
  * Copyright (c) 2001 Axis Communications AB
  *
@@ -1307,9 +1307,7 @@ static int amd_flash_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
                
        instr->state = MTD_ERASE_DONE;
-       if (instr->callback) {
-               instr->callback(instr);
-       }
+       mtd_erase_callback(instr);
        
        return 0;
 }
index a36168e..e71624e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * (C) 2000 Red Hat. GPL'd
  *
- * $Id: cfi_cmdset_0001.c,v 1.153 2004/07/12 21:52:20 dwmw2 Exp $
+ * $Id: cfi_cmdset_0001.c,v 1.154 2004/08/09 13:19:43 dwmw2 Exp $
  *
  * 
  * 10/10/2000  Nicolas Pitre <nico@cam.org>
@@ -1554,8 +1554,7 @@ int cfi_intelext_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
                return ret;
 
        instr->state = MTD_ERASE_DONE;
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
        
        return 0;
 }
index d7b54d8..5bd15f5 100644 (file)
@@ -13,7 +13,7 @@
  *
  * This code is GPL
  *
- * $Id: cfi_cmdset_0002.c,v 1.103 2004/07/14 16:24:03 dwmw2 Exp $
+ * $Id: cfi_cmdset_0002.c,v 1.106 2004/08/09 14:02:32 dwmw2 Exp $
  *
  */
 
@@ -1415,13 +1415,12 @@ int cfi_amdstd_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
        ofs = instr->addr;
        len = instr->len;
 
-       ret = cfi_amdstd_varsize_frob(mtd, do_erase_oneblock, ofs, len, 0);
+       ret = cfi_amdstd_varsize_frob(mtd, do_erase_oneblock, ofs, len, NULL);
        if (ret)
                return ret;
 
        instr->state = MTD_ERASE_DONE;
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
        
        return 0;
 }
@@ -1444,8 +1443,7 @@ static int cfi_amdstd_erase_chip(struct mtd_info *mtd, struct erase_info *instr)
                return ret;
 
        instr->state = MTD_ERASE_DONE;
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
        
        return 0;
 }
@@ -1681,7 +1679,7 @@ static int cfi_amdstd_lock_varsize(struct mtd_info *mtd,
        int ret;
 
        DEBUG(MTD_DEBUG_LEVEL3,
-             "%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
+             "%s: lock status before, ofs=0x%08llx, len=0x%08zX\n",
              __func__, ofs, len);
        debug_dump_locks(mtd, do_printlockstatus_oneblock, ofs, len, 0);
 
@@ -1705,7 +1703,7 @@ static int cfi_amdstd_unlock_varsize(struct mtd_info *mtd,
        int ret;
 
        DEBUG(MTD_DEBUG_LEVEL3,
-             "%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
+             "%s: lock status before, ofs=0x%08llx, len=0x%08zX\n",
              __func__, ofs, len);
        debug_dump_locks(mtd, do_printlockstatus_oneblock, ofs, len, 0);
 
index 98817c2..326eaf7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * (C) 2000 Red Hat. GPL'd
  *
- * $Id: cfi_cmdset_0020.c,v 1.13 2004/07/12 21:52:50 dwmw2 Exp $
+ * $Id: cfi_cmdset_0020.c,v 1.15 2004/08/09 13:19:43 dwmw2 Exp $
  * 
  * 10/10/2000  Nicolas Pitre <nico@cam.org>
  *     - completely revamped method functions so they are aware and
@@ -966,8 +966,7 @@ int cfi_staa_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
        }
                
        instr->state = MTD_ERASE_DONE;
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
        
        return 0;
 }
@@ -1400,11 +1399,6 @@ static void cfi_staa_destroy(struct mtd_info *mtd)
        kfree(cfi);
 }
 
-#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE)
-#define cfi_staa_init init_module
-#define cfi_staa_exit cleanup_module
-#endif
-
 static char im_name[]="cfi_cmdset_0020";
 
 int __init cfi_staa_init(void)
index 0b6e96f..2dfd53e 100644 (file)
@@ -11,7 +11,7 @@
  * not going to guess how to send commands to them, plus I expect they will
  * all speak CFI..
  *
- * $Id: jedec.c,v 1.20 2004/07/12 14:03:01 dwmw2 Exp $
+ * $Id: jedec.c,v 1.21 2004/08/09 13:19:43 dwmw2 Exp $
  */
 
 #include <linux/init.h>
@@ -780,8 +780,7 @@ static int flash_erase(struct mtd_info *mtd, struct erase_info *instr)
                    
    //printk("done\n");
    instr->state = MTD_ERASE_DONE;
-   if (instr->callback)
-       instr->callback(instr);
+   mtd_erase_callback(instr);
    return 0;
    
    #undef flread
index db6f6c4..283be02 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Common code to handle map devices which are simple RAM
  * (C) 2000 Red Hat. GPL'd.
- * $Id: map_ram.c,v 1.19 2004/07/12 21:58:44 dwmw2 Exp $
+ * $Id: map_ram.c,v 1.20 2004/08/09 13:19:43 dwmw2 Exp $
  */
 
 #include <linux/module.h>
@@ -114,8 +114,7 @@ static int mapram_erase (struct mtd_info *mtd, struct erase_info *instr)
 
        instr->state = MTD_ERASE_DONE;
 
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
 
        return 0;
 }
index 1313c70..c3cf0f6 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
  *           2000,2001 Lineo, Inc.
  *
- * $Id: sharp.c,v 1.13 2004/07/12 14:06:34 dwmw2 Exp $
+ * $Id: sharp.c,v 1.14 2004/08/09 13:19:43 dwmw2 Exp $
  *
  * Devices supported:
  *   LH28F016SCT Symmetrical block flash memory, 2Mx8
@@ -425,8 +425,7 @@ static int sharp_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
 
        instr->state = MTD_ERASE_DONE;
-       if(instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
 
        return 0;
 }
index 6ecd5ec..ec8cd5b 100644 (file)
@@ -1,5 +1,5 @@
 # drivers/mtd/maps/Kconfig
-# $Id: Kconfig,v 1.10 2004/07/15 00:34:49 dwmw2 Exp $
+# $Id: Kconfig,v 1.12 2004/08/10 13:12:18 dwmw2 Exp $
 
 menu "Self-contained MTD device drivers"
        depends on MTD!=n
@@ -128,7 +128,7 @@ config MTD_BLKMTD
 comment "Disk-On-Chip Device Drivers"
 
 config MTD_DOC2000
-       tristate "M-Systems Disk-On-Chip 2000 and Millennium"
+       tristate "M-Systems Disk-On-Chip 2000 and Millennium (DEPRECATED)"
        depends on MTD
        ---help---
          This provides an MTD device driver for the M-Systems DiskOnChip
@@ -144,8 +144,12 @@ config MTD_DOC2000
          emulate a block device by using a kind of file system on the flash
          chips.
 
+         NOTE: This driver is deprecated and will probably be removed soon.
+         Please try the new DiskOnChip driver under "NAND Flash Device
+         Drivers".
+
 config MTD_DOC2001
-       tristate "M-Systems Disk-On-Chip Millennium-only alternative driver (see help)"
+       tristate "M-Systems Disk-On-Chip Millennium-only alternative driver (DEPRECATED)"
        depends on MTD
        ---help---
          This provides an alternative MTD device driver for the M-Systems 
@@ -160,6 +164,10 @@ config MTD_DOC2001
          emulate a block device by using a kind of file system on the flash
          chips.
 
+         NOTE: This driver is deprecated and will probably be removed soon.
+         Please try the new DiskOnChip driver under "NAND Flash Device
+         Drivers".
+
 config MTD_DOC2001PLUS
        tristate "M-Systems Disk-On-Chip Millennium Plus"
        depends on MTD
@@ -172,19 +180,23 @@ config MTD_DOC2001PLUS
          to emulate a block device by using a kind of file system on the 
          flash chips.
 
+         NOTE: This driver will soon be replaced by the new DiskOnChip driver
+         under "NAND Flash Device Drivers" (currently that driver does not
+         support all Millennium Plus devices).
+
 config MTD_DOCPROBE
        tristate
        default m if MTD_DOC2001!=y && MTD_DOC2000!=y && MTD_DOC2001PLUS!=y && (MTD_DOC2001=m || MTD_DOC2000=m || MTD_DOC2001PLUS=m)
        default y if MTD_DOC2001=y || MTD_DOC2000=y || MTD_DOC2001PLUS=y
        help
-         This isn't a real config option, it's derived.
+         This isn't a real config option; it's derived.
 
 config MTD_DOCECC
        tristate
        default m if MTD_DOCPROBE!=y && MTD_NAND_DISKONCHIP!=y && (MTD_DOCPROBE=m || MTD_NAND_DISKONCHIP=m)
        default y if MTD_DOCPROBE=y || MTD_NAND_DISKONCHIP=y
        help
-         This isn't a real config option, it's derived.
+         This isn't a real config option; it's derived.
 
 config MTD_DOCPROBE_ADVANCED
        bool "Advanced detection options for DiskOnChip"
index a7e3a9e..a3eb97a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: blkmtd-25.c,v 1.6 2004/07/15 15:09:15 dwmw2 Exp $
+ * $Id: blkmtd.c,v 1.23 2004/08/09 14:03:19 dwmw2 Exp $
  *
  * blkmtd.c - use a block device as a fake MTD
  *
@@ -39,7 +39,7 @@
 
 /* Default erase size in K, always make it a multiple of PAGE_SIZE */
 #define CONFIG_MTD_BLKDEV_ERASESIZE (128 << 10)        /* 128KiB */
-#define VERSION "$Revision: 1.6 $"
+#define VERSION "$Revision: 1.23 $"
 
 /* Info for the block device */
 struct blkmtd_dev {
@@ -246,7 +246,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
        pagenr = to >> PAGE_SHIFT;
        offset = to & ~PAGE_MASK;
 
-       DEBUG(2, "blkmtd: write_pages: buf = %p to = %ld len = %d pagenr = %d offset = %d\n",
+       DEBUG(2, "blkmtd: write_pages: buf = %p to = %ld len = %zd pagenr = %d offset = %d\n",
              buf, (long)to, len, pagenr, offset);
 
        /* see if we have to do a partial write at the start */
@@ -270,21 +270,21 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
 
        down(&dev->wrbuf_mutex);
 
-       DEBUG(3, "blkmtd: write: start_len = %d len = %d end_len = %d pagecnt = %d\n",
+       DEBUG(3, "blkmtd: write: start_len = %zd len = %zd end_len = %zd pagecnt = %d\n",
              start_len, len, end_len, pagecnt);
 
        if(start_len) {
                /* do partial start region */
                struct page *page;
 
-               DEBUG(3, "blkmtd: write: doing partial start, page = %d len = %d offset = %d\n",
+               DEBUG(3, "blkmtd: write: doing partial start, page = %d len = %zd offset = %d\n",
                      pagenr, start_len, offset);
 
                BUG_ON(!buf);
                page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
                lock_page(page);
                if(PageDirty(page)) {
-                       err("to = %lld start_len = %d len = %d end_len = %d pagenr = %d\n",
+                       err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
                            to, start_len, len, end_len, pagenr);
                        BUG();
                }
@@ -346,13 +346,13 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
        if(end_len) {
                /* do the third region */
                struct page *page;
-               DEBUG(3, "blkmtd: write: doing partial end, page = %d len = %d\n",
+               DEBUG(3, "blkmtd: write: doing partial end, page = %d len = %zd\n",
                      pagenr, end_len);
                BUG_ON(!buf);
                page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
                lock_page(page);
                if(PageDirty(page)) {
-                       err("to = %lld start_len = %d len = %d end_len = %d pagenr = %d\n",
+                       err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
                            to, start_len, len, end_len, pagenr);
                        BUG();
                }
@@ -375,7 +375,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
        if(bio)
                blkmtd_write_out(bio);
 
-       DEBUG(2, "blkmtd: write: end, retlen = %d, err = %d\n", *retlen, err);
+       DEBUG(2, "blkmtd: write: end, retlen = %zd, err = %d\n", *retlen, err);
        up(&dev->wrbuf_mutex);
 
        if(retlen)
@@ -393,14 +393,14 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
        size_t from;
        u_long len;
        int err = -EIO;
-       int retlen;
+       size_t retlen;
 
        instr->state = MTD_ERASING;
        from = instr->addr;
        len = instr->len;
 
        /* check erase region has valid start and length */
-       DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%x len = 0x%lx\n",
+       DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%zx len = 0x%lx\n",
              mtd->name+9, from, len);
        while(numregions) {
                DEBUG(3, "blkmtd: checking erase region = 0x%08X size = 0x%X num = 0x%x\n",
@@ -417,14 +417,14 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
 
        if(!numregions) {
                /* Not a valid erase block */
-               err("erase: invalid erase request 0x%lX @ 0x%08X", len, from);
+               err("erase: invalid erase request 0x%lX @ 0x%08zX", len, from);
                instr->state = MTD_ERASE_FAILED;
                err = -EIO;
        }
 
        if(instr->state != MTD_ERASE_FAILED) {
                /* do the erase */
-               DEBUG(3, "Doing erase from = %d len = %ld\n", from, len);
+               DEBUG(3, "Doing erase from = %zd len = %ld\n", from, len);
                err = write_pages(dev, NULL, from, len, &retlen);
                if(err || retlen != len) {
                        err("erase failed err = %d", err);
@@ -435,9 +435,7 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
        }
 
        DEBUG(3, "blkmtd: erase: checking callback\n");
-       if (instr->callback) {
-               (*(instr->callback))(instr);
-       }
+       mtd_erase_callback(instr);
        DEBUG(2, "blkmtd: erase: finished (err = %d)\n", err);
        return err;
 }
@@ -453,8 +451,8 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
        int pagenr, pages;
        size_t thislen = 0;
 
-       DEBUG(2, "blkmtd: read: dev = `%s' from = %ld len = %d buf = %p\n",
-             mtd->name+9, (long int)from, len, buf);
+       DEBUG(2, "blkmtd: read: dev = `%s' from = %lld len = %zd buf = %p\n",
+             mtd->name+9, from, len, buf);
 
        if(from > mtd->size)
                return -EINVAL;
@@ -496,7 +494,7 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
  readerr:
        if(retlen)
                *retlen = thislen;
-       DEBUG(2, "blkmtd: end read: retlen = %d, err = %d\n", thislen, err);
+       DEBUG(2, "blkmtd: end read: retlen = %zd, err = %d\n", thislen, err);
        return err;
 }
 
@@ -511,8 +509,8 @@ static int blkmtd_write(struct mtd_info *mtd, loff_t to, size_t len,
        if(!len)
                return 0;
 
-       DEBUG(2, "blkmtd: write: dev = `%s' to = %ld len = %d buf = %p\n",
-             mtd->name+9, (long int)to, len, buf);
+       DEBUG(2, "blkmtd: write: dev = `%s' to = %lld len = %zd buf = %p\n",
+             mtd->name+9, to, len, buf);
 
        if(to >= mtd->size) {
                return -ENOSPC;
@@ -565,7 +563,7 @@ static struct mtd_erase_region_info *calc_erase_regions(
 {
        struct mtd_erase_region_info *info = NULL;
 
-       DEBUG(2, "calc_erase_regions, es = %d size = %d regions = %d\n",
+       DEBUG(2, "calc_erase_regions, es = %zd size = %zd regions = %d\n",
              erase_size, total_size, *regions);
        /* Make any user specified erasesize be a power of 2
           and at least PAGE_SIZE */
@@ -613,7 +611,7 @@ static struct mtd_erase_region_info *calc_erase_regions(
                                break;
                }
        } while(!(*regions));
-       DEBUG(2, "calc_erase_regions done, es = %d size = %d regions = %d\n",
+       DEBUG(2, "calc_erase_regions done, es = %zd size = %zd regions = %d\n",
              erase_size, total_size, *regions);
        return info;
 }
index 1a0c28e..fefbf5e 100644 (file)
@@ -4,7 +4,7 @@
  * (c) 1999 Machine Vision Holdings, Inc.
  * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
  *
- * $Id: doc2000.c,v 1.60 2004/04/07 08:30:04 gleixner Exp $
+ * $Id: doc2000.c,v 1.62 2004/08/09 14:04:02 dwmw2 Exp $
  */
 
 #include <linux/kernel.h>
@@ -58,7 +58,7 @@ static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
                        size_t *retlen, u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
 static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
                         size_t *retlen, const u_char *buf, u_char *eccbuf, struct nand_oobinfo *oobsel);
-static int doc_writev_ecc(struct mtd_info *mtd, const struct iovec *vecs, 
+static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 
                          unsigned long count, loff_t to, size_t *retlen,
                          u_char *eccbuf, struct nand_oobinfo *oobsel);
 static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
@@ -632,7 +632,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
                    size_t * retlen, u_char * buf)
 {
        /* Just a special case of doc_read_ecc */
-       return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0);
+       return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL);
 }
 
 static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
@@ -790,7 +790,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
                     size_t * retlen, const u_char * buf)
 {
        char eccbuf[6];
-       return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0);
+       return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL);
 }
 
 static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
@@ -979,7 +979,7 @@ static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
        return 0;
 }
 
-static int doc_writev_ecc(struct mtd_info *mtd, const struct iovec *vecs, 
+static int doc_writev_ecc(struct mtd_info *mtd, const struct kvec *vecs, 
                          unsigned long count, loff_t to, size_t *retlen,
                          u_char *eccbuf, struct nand_oobinfo *oobsel)
 {
@@ -1277,8 +1277,7 @@ static int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
        instr->state = MTD_ERASE_DONE;
 
  callback:
-       if (instr->callback)
-               instr->callback(instr);
+       mtd_erase_callback(instr);
 
        up(&this->lock);
        return 0;
index 77ed2c4..df588ac 100644 (file)
@@ -4,7 +4,7 @@
  * (c) 1999 Machine Vision Holdings, Inc.
  * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
  *
- * $Id: doc2001.c,v 1.42 2004/04/04 12:36:45 gleixner Exp $
+ * $Id: doc2001.c,v 1.44 2004/08/09 14:04:24 dwmw2 Exp $
  */
 
 #include <linux/kernel.h>
@@ -38,9 +38,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
 static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
                     size_t *retlen, const u_char *buf);
 static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
-                       size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel);
+                       size_t *retlen, u_char *buf, u_char *eccbuf,
+                       struct nand_oobinfo *oobsel);
 static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
-                        size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel);
+                        size_t *retlen, const u_char *buf, u_char *eccbuf,
+                        struct nand_oobinfo *oobsel);
 static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
                        size_t *retlen, u_char *buf);
 static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
@@ -404,11 +406,12 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
                     size_t *retlen, u_char *buf)
 {
        /* Just a special case of doc_read_ecc */
-       return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0);
+       return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL);
 }
 
 static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
-                        size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel)
+                        size_t *retlen, u_char *buf, u_char *eccbuf,
+                        struct nand_oobinfo *oobsel)
 {
        int i, ret;
        volatile char dummy;
@@ -530,11 +533,12 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len,
                      size_t *retlen, const u_char *buf)
 {
        char eccbuf[6];
-       return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0);
+       return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL);
 }
 
 static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
-                         size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel)
+                         size_t *retlen, const u_char *buf, u_char *eccbuf,
+                        struct nand_oobinfo *oobsel)
 {
        int i,ret = 0;
        volatile char dummy;
@@ -841,8 +845,7 @@ int doc_erase (struct mtd_info *mtd, struct erase_info *instr)
                instr->state = MTD_ERASE_DONE;
        dummy = ReadDOC(docptr, LastDataRead);
 
-       if (instr->callback) 
-               instr->callback(instr);
+       mtd_erase_callback(instr);
 
        return 0;
 }
index da4275c..d30ba11 100644 (file)
@@ -6,7 +6,7 @@
  * (c) 1999 Machine Vision Holdings, Inc.
  * (c) 1999, 2000 David Woodhouse <dwmw2@infradead.org>
  *
- * $Id: doc2001plus.c,v 1.8 2004/04/04 12:36:45 gleixner Exp $
+ * $Id: doc2001plus.c,v 1.9 2004/08/09 13:19:44 dwmw2 Exp $
  *
  * Released under GPL
  */
@@ -1111,8 +1111,7 @@ int doc_erase(struct mtd_info *mtd, struct erase_info *instr)
        /* Disable flash internally */
        WriteDOC(0, docptr, Mplus_FlashSelect);
 
-       if (instr->callback) 
-               instr->callback(instr);
+       mtd_erase_callback(instr);
 
        return 0;
 }
index d67ca4c..dfd335e 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * MTD driver for the 28F160F3 Flash Memory (non-CFI) on LART.
  *
- * $Id: lart.c,v 1.6 2004/07/14 17:21:38 dwmw2 Exp $
+ * $Id: lart.c,v 1.7 2004/08/09 13:19:44 dwmw2 Exp $
  *
  * Author: Abraham vd Merwe <abraham@2d3d.co.za>
  *
@@ -433,7 +433,7 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
         }
 
    instr->state = MTD_ERASE_DONE;
-   if (instr->callback) instr->callback (instr);
+   mtd_erase_callback(instr);
 
    return (0);
 }
index 3a331aa..42417b0 100644 (file)
@@ -6,7 +6,7 @@
  *     as published by the Free Software Foundation; either version
  *     2 of the License, or (at your option) any later version.
  *
- *     $Id: ms02-nv.c,v 1.6 2003/08/19 09:25:36 dwmw2 Exp $
+ *     $Id: ms02-nv.c,v 1.7 2004/07/29 14:16:45 macro Exp $
  */
 
 #include <linux/init.h>
@@ -31,7 +31,7 @@
 static char version[] __initdata =
        "ms02-nv.c: v.1.0.0  13 Aug 2001  Maciej W. Rozycki.\n";
 
-MODULE_AUTHOR("Maciej W. Rozycki <macro@ds2.pg.gda.pl>");
+MODULE_AUTHOR("Maciej W. Rozycki <macro@linux-mips.org>");
 MODULE_DESCRIPTION("DEC MS02-NV NVRAM module driver");
 MODULE_LICENSE("GPL");
 
index 80d4287..c2c2a3c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: pmc551.c,v 1.26 2004/07/14 17:25:07 dwmw2 Exp $
+ * $Id: pmc551.c,v 1.28 2004/08/09 13:19:44 dwmw2 Exp $
  *
  * PMC551 PCI Mezzanine Ram Device
  *
 #include <linux/mtd/pmc551.h>
 #include <linux/mtd/compatmac.h>
 
-#if LINUX_VERSION_CODE > 0x20300
-#define PCI_BASE_ADDRESS(dev) (dev->resource[0].start)
-#else
-#define PCI_BASE_ADDRESS(dev) (dev->base_address[0])
-#endif
-
 static struct mtd_info *pmc551list;
 
 static int pmc551_erase (struct mtd_info *mtd, struct erase_info *instr)
@@ -175,9 +169,7 @@ out:
        printk(KERN_DEBUG "pmc551_erase() done\n");
 #endif
 
-        if (instr->callback) {
-                (*(instr->callback))(instr);
-       }
+        mtd_erase_callback(instr);
         return 0;
 }
 
@@ -564,7 +556,7 @@ static u32 fixup_pmc551 (struct pci_dev *dev)
               (size<1024)?size:(size<1048576)?size>>10:size>>20,
                (size<1024)?'B':(size<1048576)?'K':'M',
               size, ((dcmd&(0x1<<3)) == 0)?"non-":"",
-               PCI_BASE_ADDRESS(dev)&PCI_BASE_ADDRESS_MEM_MASK );
+               (dev->resource[0].start)&PCI_BASE_ADDRESS_MEM_MASK );
 
         /*
          * Check to see the state of the memory
@@ -694,7 +686,7 @@ int __init init_pmc551(void)
                 }
 
                 printk(KERN_NOTICE "pmc551: Found PCI V370PDC at 0x%lX\n",
-                                   PCI_BASE_ADDRESS(PCI_Device));
+                                   PCI_Device->resource[0].start);
 
                 /*
                  * The PMC551 device acts VERY weird if you don't init it
@@ -748,7 +740,7 @@ int __init init_pmc551(void)
                        printk(KERN_NOTICE "pmc551: Using specified aperture size %dM\n", asize>>20);
                        priv->asize = asize;
                }
-                priv->start = ioremap((PCI_BASE_ADDRESS(PCI_Device)
+                priv->start = ioremap(((PCI_Device->resource[0].start)
                                        & PCI_BASE_ADDRESS_MEM_MASK),
                                       priv->asize);
                
index b9892ac..f298aee 100644 (file)
@@ -1,5 +1,5 @@
 /* This version ported to the Linux-MTD system by dwmw2@infradead.org
- * $Id: ftl.c,v 1.52 2003/08/11 09:00:44 dwmw2 Exp $
+ * $Id: ftl.c,v 1.53 2004/08/09 13:55:43 dwmw2 Exp $
  *
  * Fixes: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  * - fixes some leaks on failure in build_maps and ftl_notify_add, cleanups
@@ -167,7 +167,8 @@ static int scan_header(partition_t *part)
 {
     erase_unit_header_t header;
     loff_t offset, max_offset;
-    int ret;
+    size_t ret;
+    int err;
     part->header.FormattedSize = 0;
     max_offset = (0x100000<part->mbd.mtd->size)?0x100000:part->mbd.mtd->size;
     /* Search first megabyte for a valid FTL header */
@@ -175,11 +176,11 @@ static int scan_header(partition_t *part)
         (offset + sizeof(header)) < max_offset;
         offset += part->mbd.mtd->erasesize ? : 0x2000) {
 
-       ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret, 
+       err = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret, 
                              (unsigned char *)&header);
        
-       if (ret
-           return ret;
+       if (err
+           return err;
 
        if (strcmp(header.DataOrgTuple+3, "FTL100") == 0) break;
     }
@@ -958,7 +959,7 @@ static int ftl_write(partition_t *part, caddr_t buffer,
        if (ret) {
            printk(KERN_NOTICE "ftl_cs: block write failed!\n");
            printk(KERN_NOTICE "ftl_cs:   log_addr = 0x%x, virt_addr"
-                  " = 0x%x, Offset = 0x%x\n", log_addr, virt_addr,
+                  " = 0x%x, Offset = 0x%zx\n", log_addr, virt_addr,
                   offset);
            return -EIO;
        }
@@ -1093,7 +1094,7 @@ struct mtd_blktrans_ops ftl_tr = {
 
 int init_ftl(void)
 {
-       DEBUG(0, "$Id: ftl.c,v 1.52 2003/08/11 09:00:44 dwmw2 Exp $\n");
+       DEBUG(0, "$Id: ftl.c,v 1.53 2004/08/09 13:55:43 dwmw2 Exp $\n");
 
        return register_mtd_blktrans(&ftl_tr);
 }
index bc7e2bf..ea32c03 100644 (file)
@@ -7,7 +7,7 @@
  * (c) 1999 Machine Vision Holdings, Inc.
  * Author: David Woodhouse <dwmw2@infradead.org>
  *
- * $Id: inftlcore.c,v 1.16 2004/07/12 12:34:58 dwmw2 Exp $
+ * $Id: inftlcore.c,v 1.17 2004/08/09 13:56:48 dwmw2 Exp $
  *
  * 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
@@ -167,8 +167,8 @@ static u16 INFTL_findfreeblock(struct INFTLrecord *inftl, int desperate)
        u16 pot = inftl->LastFreeEUN;
        int silly = inftl->nb_blocks;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_findfreeblock(inftl=0x%x,"
-               "desperate=%d)\n", (int)inftl, desperate);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_findfreeblock(inftl=%p,"
+               "desperate=%d)\n", inftl, desperate);
 
        /*
         * Normally, we force a fold to happen before we run out of free
@@ -210,8 +210,8 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
        struct inftl_oob oob;
         size_t retlen;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_foldchain(inftl=0x%x,thisVUC=%d,"
-               "pending=%d)\n", (int)inftl, thisVUC, pendingblock);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_foldchain(inftl=%p,thisVUC=%d,"
+               "pending=%d)\n", inftl, thisVUC, pendingblock);
 
        memset(BlockMap, 0xff, sizeof(BlockMap));
        memset(BlockDeleted, 0, sizeof(BlockDeleted));
@@ -366,8 +366,8 @@ u16 INFTL_makefreeblock(struct INFTLrecord *inftl, unsigned pendingblock)
        u16 ChainLength = 0, thislen;
        u16 chain, EUN;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_makefreeblock(inftl=0x%x,"
-               "pending=%d)\n", (int)inftl, pendingblock);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_makefreeblock(inftl=%p,"
+               "pending=%d)\n", inftl, pendingblock);
 
        for (chain = 0; chain < inftl->nb_blocks; chain++) {
                EUN = inftl->VUtable[chain];
@@ -428,8 +428,8 @@ static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
        size_t retlen;
        int silly, silly2 = 3;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_findwriteunit(inftl=0x%x,"
-               "block=%d)\n", (int)inftl, block);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_findwriteunit(inftl=%p,"
+               "block=%d)\n", inftl, block);
 
        do {
                /*
@@ -590,8 +590,8 @@ static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC)
        struct inftl_bci bci;
        size_t retlen;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_trydeletechain(inftl=0x%x,"
-               "thisVUC=%d)\n", (int)inftl, thisVUC);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_trydeletechain(inftl=%p,"
+               "thisVUC=%d)\n", inftl, thisVUC);
 
        memset(BlockUsed, 0, sizeof(BlockUsed));
        memset(BlockDeleted, 0, sizeof(BlockDeleted));
@@ -709,8 +709,8 @@ static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
        size_t retlen;
        struct inftl_bci bci;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_deleteblock(inftl=0x%x,"
-               "block=%d)\n", (int)inftl, block);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_deleteblock(inftl=%p,"
+               "block=%d)\n", inftl, block);
 
        while (thisEUN < inftl->nb_blocks) {
                if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) +
@@ -768,8 +768,8 @@ static int inftl_writeblock(struct mtd_blktrans_dev *mbd, unsigned long block,
        struct inftl_oob oob;
        char *p, *pend;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: inftl_writeblock(inftl=0x%x,block=%ld,"
-               "buffer=0x%x)\n", (int)inftl, block, (int)buffer);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: inftl_writeblock(inftl=%p,block=%ld,"
+               "buffer=%p)\n", inftl, block, buffer);
 
        /* Is block all zero? */
        pend = buffer + SECTORSIZE;
@@ -816,8 +816,8 @@ static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
         struct inftl_bci bci;
        size_t retlen;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: inftl_readblock(inftl=0x%x,block=%ld,"
-               "buffer=0x%x)\n", (int)inftl, block, (int)buffer);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: inftl_readblock(inftl=%p,block=%ld,"
+               "buffer=%p)\n", inftl, block, buffer);
 
        while (thisEUN < inftl->nb_blocks) {
                if (MTD_READOOB(inftl->mbd.mtd, (thisEUN * inftl->EraseSize) +
@@ -893,7 +893,7 @@ extern char inftlmountrev[];
 
 int __init init_inftl(void)
 {
-       printk(KERN_INFO "INFTL: inftlcore.c $Revision: 1.16 $, "
+       printk(KERN_INFO "INFTL: inftlcore.c $Revision: 1.17 $, "
                "inftlmount.c %s\n", inftlmountrev);
 
        return register_mtd_blktrans(&inftl_tr);
index a7075c2..64cc97c 100644 (file)
@@ -8,7 +8,7 @@
  * Author: Fabrice Bellard (fabrice.bellard@netgem.com) 
  * Copyright (C) 2000 Netgem S.A.
  *
- * $Id: inftlmount.c,v 1.13 2004/06/28 16:06:36 dbrown Exp $
+ * $Id: inftlmount.c,v 1.14 2004/08/09 13:57:42 dwmw2 Exp $
  *
  * 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
@@ -41,7 +41,7 @@
 #include <linux/mtd/inftl.h>
 #include <linux/mtd/compatmac.h>
 
-char inftlmountrev[]="$Revision: 1.13 $";
+char inftlmountrev[]="$Revision: 1.14 $";
 
 /*
  * find_boot_record: Find the INFTL Media Header and its Spare copy which
@@ -58,10 +58,9 @@ static int find_boot_record(struct INFTLrecord *inftl)
        u8 buf[SECTORSIZE];
        struct INFTLMediaHeader *mh = &inftl->MediaHdr;
        struct INFTLPartition *ip;
-       int retlen;
+       size_t retlen;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: find_boot_record(inftl=0x%x)\n",
-               (int)inftl);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: find_boot_record(inftl=%p)\n", inftl);
 
         /*
         * Assume logical EraseSize == physical erasesize for starting the
@@ -288,7 +287,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
                inftl->PUtable = kmalloc(inftl->nb_blocks * sizeof(u16), GFP_KERNEL);
                if (!inftl->PUtable) {
                        printk(KERN_WARNING "INFTL: allocation of PUtable "
-                               "failed (%d bytes)\n",
+                               "failed (%zd bytes)\n",
                                inftl->nb_blocks * sizeof(u16));
                        return -ENOMEM;
                }
@@ -297,7 +296,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
                if (!inftl->VUtable) {
                        kfree(inftl->PUtable);
                        printk(KERN_WARNING "INFTL: allocation of VUtable "
-                               "failed (%d bytes)\n",
+                               "failed (%zd bytes)\n",
                                inftl->nb_blocks * sizeof(u16));
                        return -ENOMEM;
                }
@@ -348,11 +347,12 @@ static int memcmpb(void *a, int c, int n)
 static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
        int len, int check_oob)
 {
-       int i, retlen;
        u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
+       size_t retlen;
+       int i;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: check_free_sectors(inftl=0x%x,"
-               "address=0x%x,len=%d,check_oob=%d)\n", (int)inftl,
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: check_free_sectors(inftl=%p,"
+               "address=0x%x,len=%d,check_oob=%d)\n", inftl,
                address, len, check_oob);
 
        for (i = 0; i < len; i += SECTORSIZE) {
@@ -382,13 +382,13 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
  */
 int INFTL_formatblock(struct INFTLrecord *inftl, int block)
 {
-       int retlen;
+       size_t retlen;
        struct inftl_unittail uci;
        struct erase_info *instr = &inftl->instr;
        int physblock;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=0x%x,"
-               "block=%d)\n", (int)inftl, block);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_formatblock(inftl=%p,"
+               "block=%d)\n", inftl, block);
 
        memset(instr, 0, sizeof(struct erase_info));
 
@@ -551,10 +551,11 @@ int INFTL_mount(struct INFTLrecord *s)
        int chain_length, do_format_chain;
        struct inftl_unithead1 h0;
        struct inftl_unittail h1;
-       int i, retlen;
+       size_t retlen;
+       int i;
        u8 *ANACtable, ANAC;
 
-       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_mount(inftl=0x%x)\n", (int)s);
+       DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_mount(inftl=%p)\n", s);
 
        /* Search for INFTL MediaHeader and Spare INFTL Media Header */
        if (find_boot_record(s) < 0) {
index b1ad656..cdc5bbd 100644 (file)
@@ -1,5 +1,5 @@
 # drivers/mtd/maps/Kconfig
-# $Id: Kconfig,v 1.29 2004/07/15 15:29:17 dwmw2 Exp $
+# $Id: Kconfig,v 1.30 2004/07/21 00:16:14 jwboyer Exp $
 
 menu "Mapping drivers for chip access"
        depends on MTD!=n
@@ -19,7 +19,8 @@ config MTD_PHYSMAP
          command set driver code to communicate with flash chips which
          are mapped physically into the CPU's memory. You will need to
          configure the physical address and size of the flash chips on
-         your particular board as well as the bus width.
+         your particular board as well as the bus width, either statically
+         with config options or at run-time.
 
 config MTD_PHYSMAP_START
        hex "Physical start address of flash mapping"
@@ -30,6 +31,8 @@ config MTD_PHYSMAP_START
          are mapped on your particular target board. Refer to the
          memory map which should hopefully be in the documentation for
          your board.
+         Ignore this option if you use run-time physmap configuration
+         (i.e., run-time calling physmap_configure()).
 
 config MTD_PHYSMAP_LEN
        hex "Physical length of flash mapping"
@@ -42,9 +45,11 @@ config MTD_PHYSMAP_LEN
          than the total amount of flash present. Refer to the memory
          map which should hopefully be in the documentation for your
          board.
+         Ignore this option if you use run-time physmap configuration
+         (i.e., run-time calling physmap_configure()).
 
-config MTD_PHYSMAP_BUSWIDTH
-       int "Bus width in octets"
+config MTD_PHYSMAP_BANKWIDTH
+       int "Bank width in octets"
        depends on MTD_PHYSMAP
        default "2"
        help
@@ -52,6 +57,8 @@ config MTD_PHYSMAP_BUSWIDTH
          in octets. For example, if you have a data bus width of 32
          bits, you would set the bus width octect value to 4. This is
          used internally by the CFI drivers.
+         Ignore this option if you use run-time physmap configuration
+         (i.e., run-time calling physmap_configure()).
 
 config MTD_SUN_UFLASH
        tristate "Sun Microsystems userflash support"
index 8dfd0b2..5822ba9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: physmap.c,v 1.33 2004/07/12 14:37:24 dwmw2 Exp $
+ * $Id: physmap.c,v 1.34 2004/07/21 00:16:14 jwboyer Exp $
  *
  * Normal mappings of chips in physical memory
  *
 
 static struct mtd_info *mymtd;
 
-struct map_info physmap_map = {.name = "phys_mapped_flash"};
+struct map_info physmap_map = {
+       .name = "phys_mapped_flash",
+       .phys = CONFIG_MTD_PHYSMAP_START,
+       .size = CONFIG_MTD_PHYSMAP_LEN,
+       .bankwidth = CONFIG_MTD_PHYSMAP_BANKWIDTH,
+};
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition *mtd_parts;
index 02b93f9..3db73d8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mtdchar.c,v 1.62 2004/07/14 13:20:42 dwmw2 Exp $
+ * $Id: mtdchar.c,v 1.64 2004/08/09 13:59:46 dwmw2 Exp $
  *
  * Character-device access to raw MTD devices.
  *
@@ -262,7 +262,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
     IOCTL calls for getting device parameters.
 
 ======================================================================*/
-static void mtd_erase_callback (struct erase_info *instr)
+static void mtdchar_erase_callback (struct erase_info *instr)
 {
        wake_up((wait_queue_head_t *)instr->priv);
 }
@@ -336,7 +336,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
                                return -EFAULT;
                        }
                        erase->mtd = mtd;
-                       erase->callback = mtd_erase_callback;
+                       erase->callback = mtdchar_erase_callback;
                        erase->priv = (unsigned long)&waitq;
                        
                        /*
@@ -511,7 +511,6 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
        }
 
        default:
-               DEBUG(MTD_DEBUG_LEVEL0, "Invalid ioctl %x (MEMGETINFO = %x)\n", cmd, MEMGETINFO);
                ret = -ENOTTY;
        }
 
index 9c5af1d..842e741 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * $Id: mtdcore.c,v 1.42 2004/07/13 10:21:13 dwmw2 Exp $
+ * $Id: mtdcore.c,v 1.43 2004/07/23 15:20:46 dwmw2 Exp $
  *
  * Core registration and callback routines for MTD
  * drivers and users.
  *
  */
 
-#include <linux/version.h>
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
index f007d07..c3369e0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This code is GPL
  *
- * $Id: mtdpart.c,v 1.46 2004/07/12 13:28:07 dwmw2 Exp $
+ * $Id: mtdpart.c,v 1.50 2004/08/10 16:18:34 dwmw2 Exp $
  *
  *     02-21-2002      Thomas Gleixner <gleixner@autronix.de>
  *                     added support for read_oob, write_oob
@@ -246,11 +246,23 @@ static int part_erase (struct mtd_info *mtd, struct erase_info *instr)
                return -EINVAL;
        instr->addr += part->offset;
        ret = part->master->erase(part->master, instr);
-       if (instr->fail_addr != 0xffffffff)
-               instr->fail_addr -= part->offset;
        return ret;
 }
 
+void mtd_erase_callback(struct erase_info *instr)
+{
+       if (instr->mtd->erase == part_erase) {
+               struct mtd_part *part = PART(instr->mtd);
+
+               if (instr->fail_addr != 0xffffffff)
+                       instr->fail_addr -= part->offset;
+               instr->addr -= part->offset;
+       }
+       if (instr->callback)
+               instr->callback(instr);
+}
+EXPORT_SYMBOL_GPL(mtd_erase_callback);
+
 static int part_lock (struct mtd_info *mtd, loff_t ofs, size_t len)
 {
        struct mtd_part *part = PART(mtd);
index ddd2930..ed08529 100644 (file)
@@ -1,5 +1,5 @@
 # drivers/mtd/nand/Kconfig
-# $Id: Kconfig,v 1.14 2004/07/13 00:14:35 dbrown Exp $
+# $Id: Kconfig,v 1.17 2004/08/10 14:24:07 dwmw2 Exp $
 
 menu "NAND Flash Device Drivers"
        depends on MTD!=n
@@ -81,15 +81,51 @@ config MTD_NAND_PPCHAMELEONEVB
          This enables the NAND flash driver on the PPChameleon EVB Board.      
 
 config MTD_NAND_DISKONCHIP
-       tristate "DiskOnChip 2000 and Millennium (NAND reimplementation) (EXPERIMENTAL)"
+       tristate "DiskOnChip 2000, Millennium and Millennium Plus (NAND reimplementation) (EXPERIMENTAL)"
        depends on MTD_NAND && EXPERIMENTAL
        help
-         This is a reimplementation of M-Systems DiskOnChip 2000 and
-         Millennium as a standard NAND device driver, as opposed to the
-         earlier self-contained MTD device drivers.
+         This is a reimplementation of M-Systems DiskOnChip 2000,
+         Millennium and Millennium Plus as a standard NAND device driver,
+         as opposed to the earlier self-contained MTD device drivers.
          This should enable, among other things, proper JFFS2 operation on
          these devices.
 
+config MTD_NAND_DISKONCHIP_PROBE_ADVANCED
+        bool "Advanced detection options for DiskOnChip"
+        depends on MTD_NAND_DISKONCHIP
+        help
+          This option allows you to specify nonstandard address at which to
+          probe for a DiskOnChip, or to change the detection options.  You
+          are unlikely to need any of this unless you are using LinuxBIOS.
+          Say 'N'.
+
+config MTD_NAND_DISKONCHIP_PROBE_ADDRESS
+        hex "Physical address of DiskOnChip" if MTD_NAND_DISKONCHIP_PROBE_ADVANCED
+        depends on MTD_NAND_DISKONCHIP
+        default "0"
+        ---help---
+        By default, the probe for DiskOnChip devices will look for a
+        DiskOnChip at every multiple of 0x2000 between 0xC8000 and 0xEE000.
+        This option allows you to specify a single address at which to probe
+        for the device, which is useful if you have other devices in that
+        range which get upset when they are probed.
+
+        (Note that on PowerPC, the normal probe will only check at
+        0xE4000000.)
+
+        Normally, you should leave this set to zero, to allow the probe at
+        the normal addresses.
+
+config MTD_NAND_DISKONCHIP_PROBE_HIGH
+        bool "Probe high addresses"
+        depends on MTD_NAND_DISKONCHIP_PROBE_ADVANCED
+        help
+          By default, the probe for DiskOnChip devices will look for a
+          DiskOnChip at every multiple of 0x2000 between 0xC8000 and 0xEE000.
+          This option changes to make it probe between 0xFFFC8000 and
+          0xFFFEE000.  Unless you are using LinuxBIOS, this is unlikely to be
+          useful to you.  Say 'N'.
+
 config MTD_NAND_DISKONCHIP_BBTWRITE
        bool "Allow BBT writes on DiskOnChip Millennium and 2000TSOP"
        depends on MTD_NAND_DISKONCHIP
index 6d8ecf6..33779a8 100644 (file)
@@ -6,7 +6,7 @@
  *  Derived from drivers/mtd/spia.c
  *      Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
  * 
- * $Id: autcpu12.c,v 1.19 2004/07/12 15:02:15 dwmw2 Exp $
+ * $Id: autcpu12.c,v 1.20 2004/07/20 02:44:26 dwmw2 Exp $
  *
  * 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
  */
 static struct mtd_info *autcpu12_mtd = NULL;
 
-/*
- * Module stuff
- */
-#if LINUX_VERSION_CODE < 0x20212 && defined(MODULE)
-#define autcpu12_init init_module
-#define autcpu12_cleanup cleanup_module
-#endif
-
 static int autcpu12_io_base = CS89712_VIRT_BASE;
 static int autcpu12_fio_pbase = AUTCPU12_PHYS_SMC;
 static int autcpu12_fio_ctrl = AUTCPU12_SMC_SELECT_OFFSET;
index 626ad36..0212a7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: redboot.c,v 1.13 2004/04/01 10:17:40 gthomas Exp $
+ * $Id: redboot.c,v 1.15 2004/08/10 07:55:16 dwmw2 Exp $
  *
  * Parse RedBoot-style Flash Image System (FIS) tables and
  * produce a Linux partition array to match.
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/init.h>
+#include <linux/vmalloc.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -53,7 +54,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
        static char nullstring[] = "unallocated";
 #endif
 
-       buf = kmalloc(master->erasesize, GFP_KERNEL);
+       buf = vmalloc(master->erasesize);
 
        if (!buf)
                return -ENOMEM;
@@ -190,7 +191,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
                fl = fl->next;
                kfree(old);
        }
-       kfree(buf);
+       vfree(buf);
        return ret;
 }
 
index 51e04db..c835712 100644 (file)
@@ -619,7 +619,7 @@ static int init_i596_mem(struct net_device *dev)
 #endif
        unsigned long flags;
 
-       MPU_PORT(dev, PORT_RESET, 0);
+       MPU_PORT(dev, PORT_RESET, NULL);
 
        udelay(100);            /* Wait 100us - seems to help */
 
@@ -760,7 +760,7 @@ static int init_i596_mem(struct net_device *dev)
 
 failed:
        printk(KERN_CRIT "%s: Failed to initialise 82596\n", dev->name);
-       MPU_PORT(dev, PORT_RESET, 0);
+       MPU_PORT(dev, PORT_RESET, NULL);
        return -1;
 }
 
index d67975b..b124144 100644 (file)
@@ -234,7 +234,7 @@ config BMAC
 
 config OAKNET
        tristate "National DP83902AV (Oak ethernet) support"
-       depends on NET_ETHERNET && PPC
+       depends on NET_ETHERNET && PPC && BROKEN
        select CRC32
        help
          Say Y if your machine has this type of Ethernet network card.
@@ -1075,6 +1075,7 @@ config ETH16I
 
 config NE2000
        tristate "NE2000/NE1000 support"
+       depends on ISA || (Q40 && m)
        select CRC32
        ---help---
          If you have a network (Ethernet) card of this type, say Y and read
@@ -2130,17 +2131,6 @@ config TIGON3
          To compile this driver as a module, choose M here: the module
          will be called tg3.  This is recommended.
 
-config GIANFAR
-       tristate "Gianfar Ethernet"
-       depends on 85xx
-       help
-         This driver supports the Gigabit TSEC on the MPC85xx 
-         family of chips, and the FEC on the 8540
-
-config GFAR_NAPI
-       bool "NAPI Support"
-       depends on GIANFAR
-
 endmenu
 
 #
index 76d3af5..3a7b01d 100644 (file)
@@ -10,7 +10,6 @@ obj-$(CONFIG_E1000) += e1000/
 obj-$(CONFIG_IBM_EMAC) += ibm_emac/
 obj-$(CONFIG_IXGB) += ixgb/
 obj-$(CONFIG_BONDING) += bonding/
-obj-$(CONFIG_GIANFAR) += gianfar.o gianfar_ethtool.o gianfar_phy.o
 
 #
 # link order important here
index 9e049c0..a4977d2 100644 (file)
@@ -369,9 +369,9 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
  */
 #define ACE_MINI_SIZE          100
 
-#define ACE_MINI_BUFSIZE       (ACE_MINI_SIZE + 2 + 16)
-#define ACE_STD_BUFSIZE                (ACE_STD_MTU + ETH_HLEN + 2+4+16)
-#define ACE_JUMBO_BUFSIZE      (ACE_JUMBO_MTU + ETH_HLEN + 2+4+16)
+#define ACE_MINI_BUFSIZE       ACE_MINI_SIZE
+#define ACE_STD_BUFSIZE                (ACE_STD_MTU + ETH_HLEN + 4)
+#define ACE_JUMBO_BUFSIZE      (ACE_JUMBO_MTU + ETH_HLEN + 4)
 
 /*
  * There seems to be a magic difference in the effect between 995 and 996
@@ -678,7 +678,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                        ringp = &ap->skb->rx_std_skbuff[i];
                        mapping = pci_unmap_addr(ringp, mapping);
                        pci_unmap_page(ap->pdev, mapping,
-                                      ACE_STD_BUFSIZE - (2 + 16),
+                                      ACE_STD_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
 
                        ap->rx_std_ring[i].size = 0;
@@ -698,7 +698,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                                ringp = &ap->skb->rx_mini_skbuff[i];
                                mapping = pci_unmap_addr(ringp,mapping);
                                pci_unmap_page(ap->pdev, mapping,
-                                              ACE_MINI_BUFSIZE - (2 + 16),
+                                              ACE_MINI_BUFSIZE,
                                               PCI_DMA_FROMDEVICE);
 
                                ap->rx_mini_ring[i].size = 0;
@@ -717,7 +717,7 @@ static void __devexit acenic_remove_one(struct pci_dev *pdev)
                        ringp = &ap->skb->rx_jumbo_skbuff[i];
                        mapping = pci_unmap_addr(ringp, mapping);
                        pci_unmap_page(ap->pdev, mapping,
-                                      ACE_JUMBO_BUFSIZE - (2 + 16),
+                                      ACE_JUMBO_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
 
                        ap->rx_jumbo_ring[i].size = 0;
@@ -1257,7 +1257,7 @@ static int __init ace_init(struct net_device *dev)
        set_aceaddr(&info->stats2_ptr, (dma_addr_t) tmp_ptr);
 
        set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma);
-       info->rx_std_ctrl.max_len = ACE_STD_MTU + ETH_HLEN + 4;
+       info->rx_std_ctrl.max_len = ACE_STD_BUFSIZE;
        info->rx_std_ctrl.flags =
          RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG;
 
@@ -1700,17 +1700,14 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_STD_BUFSIZE, GFP_ATOMIC);
+               skb = alloc_skb(ACE_STD_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
                if (!skb)
                        break;
 
-               /*
-                * Make sure IP header starts on a fresh cache line.
-                */
-               skb_reserve(skb, 2 + 16);
+               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
-                                      ACE_STD_BUFSIZE - (2 + 16),
+                                      ACE_STD_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_std_skbuff[idx].skb = skb;
                pci_unmap_addr_set(&ap->skb->rx_std_skbuff[idx],
@@ -1718,7 +1715,7 @@ static void ace_load_std_rx_ring(struct ace_private *ap, int nr_bufs)
 
                rd = &ap->rx_std_ring[idx];
                set_aceaddr(&rd->addr, mapping);
-               rd->size = ACE_STD_MTU + ETH_HLEN + 4;
+               rd->size = ACE_STD_BUFSIZE;
                rd->idx = idx;
                idx = (idx + 1) % RX_STD_RING_ENTRIES;
        }
@@ -1766,17 +1763,14 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_MINI_BUFSIZE, GFP_ATOMIC);
+               skb = alloc_skb(ACE_MINI_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
                if (!skb)
                        break;
 
-               /*
-                * Make sure the IP header ends up on a fresh cache line
-                */
-               skb_reserve(skb, 2 + 16);
+               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
-                                      ACE_MINI_BUFSIZE - (2 + 16),
+                                      ACE_MINI_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_mini_skbuff[idx].skb = skb;
                pci_unmap_addr_set(&ap->skb->rx_mini_skbuff[idx],
@@ -1784,7 +1778,7 @@ static void ace_load_mini_rx_ring(struct ace_private *ap, int nr_bufs)
 
                rd = &ap->rx_mini_ring[idx];
                set_aceaddr(&rd->addr, mapping);
-               rd->size = ACE_MINI_SIZE;
+               rd->size = ACE_MINI_BUFSIZE;
                rd->idx = idx;
                idx = (idx + 1) % RX_MINI_RING_ENTRIES;
        }
@@ -1827,17 +1821,14 @@ static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
                struct rx_desc *rd;
                dma_addr_t mapping;
 
-               skb = alloc_skb(ACE_JUMBO_BUFSIZE, GFP_ATOMIC);
+               skb = alloc_skb(ACE_JUMBO_BUFSIZE + NET_IP_ALIGN, GFP_ATOMIC);
                if (!skb)
                        break;
 
-               /*
-                * Make sure the IP header ends up on a fresh cache line
-                */
-               skb_reserve(skb, 2 + 16);
+               skb_reserve(skb, NET_IP_ALIGN);
                mapping = pci_map_page(ap->pdev, virt_to_page(skb->data),
                                       offset_in_page(skb->data),
-                                      ACE_JUMBO_BUFSIZE - (2 + 16),
+                                      ACE_JUMBO_BUFSIZE,
                                       PCI_DMA_FROMDEVICE);
                ap->skb->rx_jumbo_skbuff[idx].skb = skb;
                pci_unmap_addr_set(&ap->skb->rx_jumbo_skbuff[idx],
@@ -1845,7 +1836,7 @@ static void ace_load_jumbo_rx_ring(struct ace_private *ap, int nr_bufs)
 
                rd = &ap->rx_jumbo_ring[idx];
                set_aceaddr(&rd->addr, mapping);
-               rd->size = ACE_JUMBO_MTU + ETH_HLEN + 4;
+               rd->size = ACE_JUMBO_BUFSIZE;
                rd->idx = idx;
                idx = (idx + 1) % RX_JUMBO_RING_ENTRIES;
        }
@@ -2027,19 +2018,19 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm)
                         */
                case 0:
                        rip = &ap->skb->rx_std_skbuff[skbidx];
-                       mapsize = ACE_STD_BUFSIZE - (2 + 16);
+                       mapsize = ACE_STD_BUFSIZE;
                        rxdesc = &ap->rx_std_ring[skbidx];
                        std_count++;
                        break;
                case BD_FLG_JUMBO:
                        rip = &ap->skb->rx_jumbo_skbuff[skbidx];
-                       mapsize = ACE_JUMBO_BUFSIZE - (2 + 16);
+                       mapsize = ACE_JUMBO_BUFSIZE;
                        rxdesc = &ap->rx_jumbo_ring[skbidx];
                        atomic_dec(&ap->cur_jumbo_bufs);
                        break;
                case BD_FLG_MINI:
                        rip = &ap->skb->rx_mini_skbuff[skbidx];
-                       mapsize = ACE_MINI_BUFSIZE - (2 + 16);
+                       mapsize = ACE_MINI_BUFSIZE;
                        rxdesc = &ap->rx_mini_ring[skbidx];
                        mini_count++; 
                        break;
index 7e616f7..b04bf5e 100644 (file)
@@ -1566,7 +1566,7 @@ static void release_dma_buff(struct net_local *lp)
 {
        if (lp->dma_buff) {
                free_pages((unsigned long)(lp->dma_buff), get_order(lp->dmasize * 1024));
-               lp->dma_buff = 0;
+               lp->dma_buff = NULL;
        }
 }
 #endif
index fc0a851..7e15c51 100644 (file)
@@ -57,13 +57,6 @@ static void set_multicast_list(struct net_device *dev)
 {
 }
 
-#ifdef CONFIG_NET_FASTROUTE
-static int dummy_accept_fastpath(struct net_device *dev, struct dst_entry *dst)
-{
-       return -1;
-}
-#endif
-
 static void __init dummy_setup(struct net_device *dev)
 {
        /* Initialize the device structure. */
@@ -71,9 +64,6 @@ static void __init dummy_setup(struct net_device *dev)
        dev->hard_start_xmit = dummy_xmit;
        dev->set_multicast_list = set_multicast_list;
        dev->set_mac_address = dummy_set_address;
-#ifdef CONFIG_NET_FASTROUTE
-       dev->accept_fastpath = dummy_accept_fastpath;
-#endif
 
        /* Fill in device structure with ethernet-generic values. */
        ether_setup(dev);
index bddc2d9..067bb09 100644 (file)
@@ -82,7 +82,7 @@ struct e1000_adapter;
 
 #include "e1000_hw.h"
 
-#if DBG
+#ifdef DBG
 #define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args)
 #else
 #define E1000_DBG(args...)
index 6af982b..36b5508 100644 (file)
@@ -1021,7 +1021,7 @@ speedo_open(struct net_device *dev)
        /* Set up the Tx queue early.. */
        sp->cur_tx = 0;
        sp->dirty_tx = 0;
-       sp->last_cmd = 0;
+       sp->last_cmd = NULL;
        sp->tx_full = 0;
        sp->in_interrupt = 0;
 
@@ -1355,7 +1355,7 @@ static void speedo_purge_tx(struct net_device *dev)
                                        le32_to_cpu(sp->tx_ring[entry].tx_buf_addr0),
                                        sp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(sp->tx_skbuff[entry]);
-                       sp->tx_skbuff[entry] = 0;
+                       sp->tx_skbuff[entry] = NULL;
                }
                sp->dirty_tx++;
        }
@@ -1559,7 +1559,7 @@ static void speedo_tx_buffer_gc(struct net_device *dev)
                                        le32_to_cpu(sp->tx_ring[entry].tx_buf_addr0),
                                        sp->tx_skbuff[entry]->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(sp->tx_skbuff[entry]);
-                       sp->tx_skbuff[entry] = 0;
+                       sp->tx_skbuff[entry] = NULL;
                }
                dirty_tx++;
        }
@@ -1932,7 +1932,7 @@ speedo_close(struct net_device *dev)
     /* Free all the skbuffs in the Rx and Tx queues. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                struct sk_buff *skb = sp->rx_skbuff[i];
-               sp->rx_skbuff[i] = 0;
+               sp->rx_skbuff[i] = NULL;
                /* Clear the Rx descriptors. */
                if (skb) {
                        pci_unmap_single(sp->pdev,
@@ -1944,7 +1944,7 @@ speedo_close(struct net_device *dev)
 
        for (i = 0; i < TX_RING_SIZE; i++) {
                struct sk_buff *skb = sp->tx_skbuff[i];
-               sp->tx_skbuff[i] = 0;
+               sp->tx_skbuff[i] = NULL;
                /* Clear the Tx descriptors. */
                if (skb) {
                        pci_unmap_single(sp->pdev,
@@ -2174,7 +2174,7 @@ static void set_rx_mode(struct net_device *dev)
                last_cmd = sp->last_cmd;
                sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry];
 
-               sp->tx_skbuff[entry] = 0;                       /* Redundant. */
+               sp->tx_skbuff[entry] = NULL;                    /* Redundant. */
                sp->tx_ring[entry].status = cpu_to_le32(CmdSuspend | CmdConfigure);
                sp->tx_ring[entry].link =
                        cpu_to_le32(TX_RING_ELEM_DMA(sp, (entry + 1) % TX_RING_SIZE));
@@ -2217,7 +2217,7 @@ static void set_rx_mode(struct net_device *dev)
                last_cmd = sp->last_cmd;
                sp->last_cmd = (struct descriptor *)&sp->tx_ring[entry];
 
-               sp->tx_skbuff[entry] = 0;
+               sp->tx_skbuff[entry] = NULL;
                sp->tx_ring[entry].status = cpu_to_le32(CmdSuspend | CmdMulticastList);
                sp->tx_ring[entry].link =
                        cpu_to_le32(TX_RING_ELEM_DMA(sp, (entry + 1) % TX_RING_SIZE));
@@ -2298,7 +2298,7 @@ static void set_rx_mode(struct net_device *dev)
                sp->last_cmd = mc_setup_frm;
 
                /* Change the command to a NoOp, pointing to the CmdMulti command. */
-               sp->tx_skbuff[entry] = 0;
+               sp->tx_skbuff[entry] = NULL;
                sp->tx_ring[entry].status = cpu_to_le32(CmdNOp);
                sp->tx_ring[entry].link = cpu_to_le32(mc_blk->frame_dma);
 
index ecf5b8a..771bfc6 100644 (file)
@@ -937,7 +937,7 @@ static void epic_init_ring(struct net_device *dev)
                ep->rx_ring[i].buflength = cpu_to_le32(ep->rx_buf_sz);
                ep->rx_ring[i].next = ep->rx_ring_dma + 
                                      (i+1)*sizeof(struct epic_rx_desc);
-               ep->rx_skbuff[i] = 0;
+               ep->rx_skbuff[i] = NULL;
        }
        /* Mark the last entry as wrapping the ring. */
        ep->rx_ring[i-1].next = ep->rx_ring_dma;
@@ -959,7 +959,7 @@ static void epic_init_ring(struct net_device *dev)
        /* The Tx buffer descriptor is filled in as needed, but we
           do need to clear the ownership bit. */
        for (i = 0; i < TX_RING_SIZE; i++) {
-               ep->tx_skbuff[i] = 0;
+               ep->tx_skbuff[i] = NULL;
                ep->tx_ring[i].txstatus = 0x0000;
                ep->tx_ring[i].next = ep->tx_ring_dma + 
                        (i+1)*sizeof(struct epic_tx_desc);
@@ -1093,7 +1093,7 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance, struct pt_regs *r
                                pci_unmap_single(ep->pci_dev, ep->tx_ring[entry].bufaddr, 
                                                 skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq(skb);
-                               ep->tx_skbuff[entry] = 0;
+                               ep->tx_skbuff[entry] = NULL;
                        }
 
 #ifndef final_version
@@ -1274,7 +1274,7 @@ static int epic_close(struct net_device *dev)
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                skb = ep->rx_skbuff[i];
-               ep->rx_skbuff[i] = 0;
+               ep->rx_skbuff[i] = NULL;
                ep->rx_ring[i].rxstatus = 0;            /* Not owned by Epic chip. */
                ep->rx_ring[i].buflength = 0;
                if (skb) {
@@ -1286,7 +1286,7 @@ static int epic_close(struct net_device *dev)
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                skb = ep->tx_skbuff[i];
-               ep->tx_skbuff[i] = 0;
+               ep->tx_skbuff[i] = NULL;
                if (!skb)
                        continue;
                pci_unmap_single(ep->pci_dev, ep->tx_ring[i].bufaddr, 
index 80ed8b5..a53574b 100644 (file)
@@ -389,7 +389,7 @@ static inline int eql_is_full(slave_queue_t *queue)
 static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
 {
        if (!eql_is_full(queue)) {
-               slave_t *duplicate_slave = 0;
+               slave_t *duplicate_slave = NULL;
 
                duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
                if (duplicate_slave != 0)
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
deleted file mode 100644 (file)
index 5005c1c..0000000
+++ /dev/null
@@ -1,1926 +0,0 @@
-/* 
- * drivers/net/gianfar.c
- *
- * Gianfar Ethernet Driver
- * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560
- * Based on 8260_io/fcc_enet.c
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
- *
- * Copyright 2004 Freescale Semiconductor, Inc
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- *  Gianfar:  AKA Lambda Draconis, "Dragon"
- *  RA 11 31 24.2
- *  Dec +69 19 52
- *  V 3.84
- *  B-V +1.62
- *
- *  Theory of operation
- *  This driver is designed for the Triple-speed Ethernet
- *  controllers on the Freescale 8540/8560 integrated processors,
- *  as well as the Fast Ethernet Controller on the 8540.  
- *  
- *  The driver is initialized through OCP.  Structures which
- *  define the configuration needed by the board are defined in a
- *  board structure in arch/ppc/platforms (though I do not
- *  discount the possibility that other architectures could one
- *  day be supported.  One assumption the driver currently makes
- *  is that the PHY is configured in such a way to advertise all
- *  capabilities.  This is a sensible default, and on certain
- *  PHYs, changing this default encounters substantial errata
- *  issues.  Future versions may remove this requirement, but for
- *  now, it is best for the firmware to ensure this is the case.
- *
- *  The Gianfar Ethernet Controller uses a ring of buffer
- *  descriptors.  The beginning is indicated by a register
- *  pointing to the physical address of the start of the ring. 
- *  The end is determined by a "wrap" bit being set in the 
- *  last descriptor of the ring.
- *
- *  When a packet is received, the RXF bit in the
- *  IEVENT register is set, triggering an interrupt when the 
- *  corresponding bit in the IMASK register is also set (if
- *  interrupt coalescing is active, then the interrupt may not
- *  happen immediately, but will wait until either a set number
- *  of frames or amount of time have passed.).  In NAPI, the
- *  interrupt handler will signal there is work to be done, and
- *  exit.  Without NAPI, the packet(s) will be handled
- *  immediately.  Both methods will start at the last known empty
- *  descriptor, and process every subsequent descriptor until there 
- *  are none left with data (NAPI will stop after a set number of
- *  packets to give time to other tasks, but will eventually
- *  process all the packets).  The data arrives inside a
- *  pre-allocated skb, and so after the skb is passed up to the
- *  stack, a new skb must be allocated, and the address field in
- *  the buffer descriptor must be updated to indicate this new
- *  skb.
- *
- *  When the kernel requests that a packet be transmitted, the
- *  driver starts where it left off last time, and points the
- *  descriptor at the buffer which was passed in.  The driver
- *  then informs the DMA engine that there are packets ready to
- *  be transmitted.  Once the controller is finished transmitting
- *  the packet, an interrupt may be triggered (under the same
- *  conditions as for reception, but depending on the TXF bit).
- *  The driver then cleans up the buffer.
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/dma-mapping.h>
-#include <linux/crc32.h>
-
-#include "gianfar.h"
-#include "gianfar_phy.h"
-#ifdef CONFIG_NET_FASTROUTE
-#include <linux/if_arp.h>
-#include <net/ip.h>
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41)
-#define irqreturn_t void
-#define IRQ_HANDLED 
-#endif
-
-#define TX_TIMEOUT      (1*HZ)
-#define SKB_ALLOC_TIMEOUT 1000000
-#undef BRIEF_GFAR_ERRORS
-#define VERBOSE_GFAR_ERRORS
-
-#ifdef CONFIG_GFAR_NAPI
-#define RECEIVE(x) netif_receive_skb(x)
-#else
-#define RECEIVE(x) netif_rx(x)
-#endif
-
-#define DEVICE_NAME "%s: Gianfar Ethernet Controller Version 1.0, "
-char gfar_driver_name[] = "Gianfar Ethernet";
-char gfar_driver_version[] = "1.0";
-
-int startup_gfar(struct net_device *dev);
-static int gfar_enet_open(struct net_device *dev);
-static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev);
-static void gfar_timeout(struct net_device *dev);
-static int gfar_close(struct net_device *dev);
-struct sk_buff *gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp);
-static struct net_device_stats *gfar_get_stats(struct net_device *dev);
-static int gfar_set_mac_address(struct net_device *dev);
-static int gfar_change_mtu(struct net_device *dev, int new_mtu);
-static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs);
-irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-static void gfar_phy_change(void *data);
-static void gfar_phy_timer(unsigned long data);
-static void adjust_link(struct net_device *dev);
-static void init_registers(struct net_device *dev);
-static int init_phy(struct net_device *dev);
-static int gfar_probe(struct ocp_device *ocpdev);
-static void gfar_remove(struct ocp_device *ocpdev);
-void free_skb_resources(struct gfar_private *priv);
-static void gfar_set_multi(struct net_device *dev);
-static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
-#ifdef CONFIG_GFAR_NAPI
-static int gfar_poll(struct net_device *dev, int *budget);
-#endif
-#ifdef CONFIG_NET_FASTROUTE
-static int gfar_accept_fastpath(struct net_device *dev, struct dst_entry *dst);
-#endif
-static inline int try_fastroute(struct sk_buff *skb, struct net_device *dev, int length);
-#ifdef CONFIG_GFAR_NAPI
-static int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
-#else
-static int gfar_clean_rx_ring(struct net_device *dev);
-#endif
-static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length);
-
-extern struct ethtool_ops gfar_ethtool_ops;
-extern void gfar_gstrings_normon(struct net_device *dev, u32 stringset, 
-               u8 * buf);
-extern void gfar_fill_stats_normon(struct net_device *dev, 
-               struct ethtool_stats *dummy, u64 * buf);
-extern int gfar_stats_count_normon(struct net_device *dev);
-
-
-MODULE_AUTHOR("Freescale Semiconductor, Inc");
-MODULE_DESCRIPTION("Gianfar Ethernet Driver");
-MODULE_LICENSE("GPL");
-
-/* Called by the ocp code to initialize device data structures
- * required for bringing up the device
- * returns 0 on success */
-static int gfar_probe(struct ocp_device *ocpdev)
-{
-       u32 tempval;
-       struct ocp_device *mdiodev;
-       struct net_device *dev = NULL;
-       struct gfar_private *priv = NULL;
-       struct ocp_gfar_data *einfo;
-       int idx;
-       int err = 0;
-       struct ethtool_ops *dev_ethtool_ops;
-
-       einfo = (struct ocp_gfar_data *) ocpdev->def->additions;
-
-       if (einfo == NULL) {
-               printk(KERN_ERR "gfar %d: Missing additional data!\n",
-                      ocpdev->def->index);
-
-               return -ENODEV;
-       }
-
-       /* get a pointer to the register memory which can
-        * configure the PHYs.  If it's different from this set,
-        * get the device which has those regs */
-       if ((einfo->phyregidx >= 0) && (einfo->phyregidx != ocpdev->def->index)) {
-               mdiodev = ocp_find_device(OCP_ANY_ID,
-                                         OCP_FUNC_GFAR, einfo->phyregidx);
-
-               /* If the device which holds the MDIO regs isn't
-                * up, wait for it to come up */
-               if (mdiodev == NULL)
-                       return -EAGAIN;
-       } else {
-               mdiodev = ocpdev;
-       }
-
-       /* Create an ethernet device instance */
-       dev = alloc_etherdev(sizeof (*priv));
-
-       if (dev == NULL)
-               return -ENOMEM;
-
-       priv = netdev_priv(dev);
-
-       /* Set the info in the priv to the current info */
-       priv->einfo = einfo;
-
-       /* get a pointer to the register memory */
-       priv->regs = (struct gfar *)
-           ioremap(ocpdev->def->paddr, sizeof (struct gfar));
-
-       if (priv->regs == NULL) {
-               err = -ENOMEM;
-               goto regs_fail;
-       }
-
-       /* Set the PHY base address */
-       priv->phyregs = (struct gfar *)
-           ioremap(mdiodev->def->paddr, sizeof (struct gfar));
-
-       if (priv->phyregs == NULL) {
-               err = -ENOMEM;
-               goto phy_regs_fail;
-       }
-
-       ocp_set_drvdata(ocpdev, dev);
-
-       /* Stop the DMA engine now, in case it was running before */
-       /* (The firmware could have used it, and left it running). */
-       /* To do this, we write Graceful Receive Stop and Graceful */
-       /* Transmit Stop, and then wait until the corresponding bits */
-       /* in IEVENT indicate the stops have completed. */
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval |= (DMACTRL_GRS | DMACTRL_GTS);
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       while (!(gfar_read(&priv->regs->ievent) & (IEVENT_GRSC | IEVENT_GTSC)))
-               cpu_relax();
-
-       /* Reset MAC layer */
-       gfar_write(&priv->regs->maccfg1, MACCFG1_SOFT_RESET);
-
-       tempval = (MACCFG1_TX_FLOW | MACCFG1_RX_FLOW);
-       gfar_write(&priv->regs->maccfg1, tempval);
-
-       /* Initialize MACCFG2. */
-       gfar_write(&priv->regs->maccfg2, MACCFG2_INIT_SETTINGS);
-
-       /* Initialize ECNTRL */
-       gfar_write(&priv->regs->ecntrl, ECNTRL_INIT_SETTINGS);
-
-       /* Copy the station address into the dev structure, */
-       /* and into the address registers MAC_STNADDR1,2. */
-       /* Backwards, because little endian MACs are dumb. */
-       /* Don't set the regs if the firmware already did */
-       memcpy(dev->dev_addr, einfo->mac_addr, MAC_ADDR_LEN);
-
-       /* Set the dev->base_addr to the gfar reg region */
-       dev->base_addr = (unsigned long) (priv->regs);
-
-       SET_MODULE_OWNER(dev);
-
-       /* Fill in the dev structure */
-       dev->open = gfar_enet_open;
-       dev->hard_start_xmit = gfar_start_xmit;
-       dev->tx_timeout = gfar_timeout;
-       dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_GFAR_NAPI
-       dev->poll = gfar_poll;
-       dev->weight = GFAR_DEV_WEIGHT;
-#endif
-       dev->stop = gfar_close;
-       dev->get_stats = gfar_get_stats;
-       dev->change_mtu = gfar_change_mtu;
-       dev->mtu = 1500;
-       dev->set_multicast_list = gfar_set_multi;
-       dev->flags |= IFF_MULTICAST;
-
-       dev_ethtool_ops = 
-               (struct ethtool_ops *)kmalloc(sizeof(struct ethtool_ops), 
-                                             GFP_KERNEL);
-
-       if(dev_ethtool_ops == NULL) {
-               err = -ENOMEM;
-               goto ethtool_fail;
-       }
-
-       memcpy(dev_ethtool_ops, &gfar_ethtool_ops, sizeof(gfar_ethtool_ops));
-
-       /* If there is no RMON support in this device, we don't
-        * want to expose non-existant statistics */
-       if((priv->einfo->flags & GFAR_HAS_RMON) == 0) {
-               dev_ethtool_ops->get_strings = gfar_gstrings_normon;
-               dev_ethtool_ops->get_stats_count = gfar_stats_count_normon;
-               dev_ethtool_ops->get_ethtool_stats = gfar_fill_stats_normon;
-       }
-
-       if((priv->einfo->flags & GFAR_HAS_COALESCE) == 0) {
-               dev_ethtool_ops->set_coalesce = NULL;
-               dev_ethtool_ops->get_coalesce = NULL;
-       }
-
-       dev->ethtool_ops = dev_ethtool_ops;
-
-#ifdef CONFIG_NET_FASTROUTE
-       dev->accept_fastpath = gfar_accept_fastpath;
-#endif
-
-       priv->rx_buffer_size = DEFAULT_RX_BUFFER_SIZE;
-#ifdef CONFIG_GFAR_BUFSTASH
-       priv->rx_stash_size = STASH_LENGTH;
-#endif
-       priv->tx_ring_size = DEFAULT_TX_RING_SIZE;
-       priv->rx_ring_size = DEFAULT_RX_RING_SIZE;
-
-       /* Initially, coalescing is disabled */
-       priv->txcoalescing = 0;
-       priv->txcount = 0;
-       priv->txtime = 0;
-       priv->rxcoalescing = 0;
-       priv->rxcount = 0;
-       priv->rxtime = 0;
-
-       err = register_netdev(dev);
-
-       if (err) {
-               printk(KERN_ERR "%s: Cannot register net device, aborting.\n",
-                      dev->name);
-               goto register_fail;
-       }
-
-       /* Print out the device info */
-       printk(DEVICE_NAME, dev->name);
-       for (idx = 0; idx < 6; idx++)
-               printk("%2.2x%c", dev->dev_addr[idx], idx == 5 ? ' ' : ':');
-       printk("\n");
-
-       /* Even more device info helps when determining which kernel */
-       /* provided which set of benchmarks.  Since this is global for all */
-       /* devices, we only print it once */
-#ifdef CONFIG_GFAR_NAPI
-       printk(KERN_INFO "%s: Running with NAPI enabled\n", dev->name);
-#else
-       printk(KERN_INFO "%s: Running with NAPI disabled\n", dev->name);
-#endif
-       printk(KERN_INFO "%s: %d/%d RX/TX BD ring size\n",
-              dev->name, priv->rx_ring_size, priv->tx_ring_size);
-
-       return 0;
-
-
-register_fail:
-       kfree(dev_ethtool_ops);
-ethtool_fail:
-       iounmap((void *) priv->phyregs);
-phy_regs_fail:
-       iounmap((void *) priv->regs);
-regs_fail:
-       free_netdev(dev);
-       return -ENOMEM;
-}
-
-static void gfar_remove(struct ocp_device *ocpdev)
-{
-       struct net_device *dev = ocp_get_drvdata(ocpdev);
-       struct gfar_private *priv = netdev_priv(dev);
-
-       ocp_set_drvdata(ocpdev, NULL);
-
-       kfree(dev->ethtool_ops);
-       iounmap((void *) priv->regs);
-       iounmap((void *) priv->phyregs);
-       free_netdev(dev);
-}
-
-/* Configure the PHY for dev.
- * returns 0 if success.  -1 if failure
- */
-static int init_phy(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       struct phy_info *curphy;
-
-       priv->link = 1;
-       priv->oldlink = 0;
-       priv->oldspeed = 0;
-       priv->olddplx = -1;
-
-       /* get info for this PHY */
-       curphy = get_phy_info(dev);
-
-       if (curphy == NULL) {
-               printk(KERN_ERR "%s: No PHY found\n", dev->name);
-               return -1;
-       }
-
-       priv->phyinfo = curphy;
-
-       /* Run the commands which configure the PHY */
-       phy_run_commands(dev, curphy->config);
-
-       return 0;
-}
-
-static void init_registers(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       /* Clear IEVENT */
-       gfar_write(&priv->regs->ievent, IEVENT_INIT_CLEAR);
-
-       /* Initialize IMASK */
-       gfar_write(&priv->regs->imask, IMASK_INIT_CLEAR);
-
-       /* Init hash registers to zero */
-       gfar_write(&priv->regs->iaddr0, 0);
-       gfar_write(&priv->regs->iaddr1, 0);
-       gfar_write(&priv->regs->iaddr2, 0);
-       gfar_write(&priv->regs->iaddr3, 0);
-       gfar_write(&priv->regs->iaddr4, 0);
-       gfar_write(&priv->regs->iaddr5, 0);
-       gfar_write(&priv->regs->iaddr6, 0);
-       gfar_write(&priv->regs->iaddr7, 0);
-
-       gfar_write(&priv->regs->gaddr0, 0);
-       gfar_write(&priv->regs->gaddr1, 0);
-       gfar_write(&priv->regs->gaddr2, 0);
-       gfar_write(&priv->regs->gaddr3, 0);
-       gfar_write(&priv->regs->gaddr4, 0);
-       gfar_write(&priv->regs->gaddr5, 0);
-       gfar_write(&priv->regs->gaddr6, 0);
-       gfar_write(&priv->regs->gaddr7, 0);
-
-       /* Zero out rctrl */
-       gfar_write(&priv->regs->rctrl, 0x00000000);
-
-       /* Zero out the rmon mib registers if it has them */
-       if (priv->einfo->flags & GFAR_HAS_RMON) {
-               memset((void *) &(priv->regs->rmon), 0,
-                      sizeof (struct rmon_mib));
-
-               /* Mask off the CAM interrupts */
-               gfar_write(&priv->regs->rmon.cam1, 0xffffffff);
-               gfar_write(&priv->regs->rmon.cam2, 0xffffffff);
-       }
-
-       /* Initialize the max receive buffer length */
-       gfar_write(&priv->regs->mrblr, priv->rx_buffer_size);
-
-#ifdef CONFIG_GFAR_BUFSTASH
-       /* If we are stashing buffers, we need to set the
-        * extraction length to the size of the buffer */
-       gfar_write(&priv->regs->attreli, priv->rx_stash_size << 16);
-#endif
-
-       /* Initialize the Minimum Frame Length Register */
-       gfar_write(&priv->regs->minflr, MINFLR_INIT_SETTINGS);
-
-       /* Setup Attributes so that snooping is on for rx */
-       gfar_write(&priv->regs->attr, ATTR_INIT_SETTINGS);
-       gfar_write(&priv->regs->attreli, ATTRELI_INIT_SETTINGS);
-
-       /* Assign the TBI an address which won't conflict with the PHYs */
-       gfar_write(&priv->regs->tbipa, TBIPA_VALUE);
-}
-
-void stop_gfar(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       struct gfar *regs = priv->regs;
-       unsigned long flags;
-       u32 tempval;
-
-       /* Lock it down */
-       spin_lock_irqsave(&priv->lock, flags);
-
-       /* Tell the kernel the link is down */
-       priv->link = 0;
-       adjust_link(dev);
-
-       /* Mask all interrupts */
-       gfar_write(&regs->imask, IMASK_INIT_CLEAR);
-
-       /* Clear all interrupts */
-       gfar_write(&regs->ievent, IEVENT_INIT_CLEAR);
-
-       /* Stop the DMA, and wait for it to stop */
-       tempval = gfar_read(&priv->regs->dmactrl);
-       if ((tempval & (DMACTRL_GRS | DMACTRL_GTS))
-           != (DMACTRL_GRS | DMACTRL_GTS)) {
-               tempval |= (DMACTRL_GRS | DMACTRL_GTS);
-               gfar_write(&priv->regs->dmactrl, tempval);
-
-               while (!(gfar_read(&priv->regs->ievent) &
-                        (IEVENT_GRSC | IEVENT_GTSC)))
-                       cpu_relax();
-       }
-
-       /* Disable Rx and Tx */
-       tempval = gfar_read(&regs->maccfg1);
-       tempval &= ~(MACCFG1_RX_EN | MACCFG1_TX_EN);
-       gfar_write(&regs->maccfg1, tempval);
-
-       if (priv->einfo->flags & GFAR_HAS_PHY_INTR) {
-               phy_run_commands(dev, priv->phyinfo->shutdown);
-       }
-
-       spin_unlock_irqrestore(&priv->lock, flags);
-
-       /* Free the IRQs */
-       if (priv->einfo->flags & GFAR_HAS_MULTI_INTR) {
-               free_irq(priv->einfo->interruptError, dev);
-               free_irq(priv->einfo->interruptTransmit, dev);
-               free_irq(priv->einfo->interruptReceive, dev);
-       } else {
-               free_irq(priv->einfo->interruptTransmit, dev);
-       }
-
-       if (priv->einfo->flags & GFAR_HAS_PHY_INTR) {
-               free_irq(priv->einfo->interruptPHY, dev);
-       } else {
-               del_timer_sync(&priv->phy_info_timer);
-       }
-
-       free_skb_resources(priv);
-
-       dma_unmap_single(NULL, gfar_read(&regs->tbase),
-                       sizeof(struct txbd)*priv->tx_ring_size,
-                       DMA_BIDIRECTIONAL);
-       dma_unmap_single(NULL, gfar_read(&regs->rbase),
-                       sizeof(struct rxbd)*priv->rx_ring_size,
-                       DMA_BIDIRECTIONAL);
-
-       /* Free the buffer descriptors */
-       kfree(priv->tx_bd_base);
-}
-
-/* If there are any tx skbs or rx skbs still around, free them.
- * Then free tx_skbuff and rx_skbuff */
-void free_skb_resources(struct gfar_private *priv)
-{
-       struct rxbd8 *rxbdp;
-       struct txbd8 *txbdp;
-       int i;
-
-       /* Go through all the buffer descriptors and free their data buffers */
-       txbdp = priv->tx_bd_base;
-
-       for (i = 0; i < priv->tx_ring_size; i++) {
-
-               if (priv->tx_skbuff[i]) {
-                       dma_unmap_single(NULL, txbdp->bufPtr,
-                                       txbdp->length,
-                                       DMA_TO_DEVICE);
-                       dev_kfree_skb_any(priv->tx_skbuff[i]);
-                       priv->tx_skbuff[i] = NULL;
-               }
-       }
-
-       kfree(priv->tx_skbuff);
-
-       rxbdp = priv->rx_bd_base;
-
-       /* rx_skbuff is not guaranteed to be allocated, so only
-        * free it and its contents if it is allocated */
-       if(priv->rx_skbuff != NULL) {
-               for (i = 0; i < priv->rx_ring_size; i++) {
-                       if (priv->rx_skbuff[i]) {
-                               dma_unmap_single(NULL, rxbdp->bufPtr,
-                                               priv->rx_buffer_size
-                                               + RXBUF_ALIGNMENT,
-                                               DMA_FROM_DEVICE);
-
-                               dev_kfree_skb_any(priv->rx_skbuff[i]);
-                               priv->rx_skbuff[i] = NULL;
-                       }
-
-                       rxbdp->status = 0;
-                       rxbdp->length = 0;
-                       rxbdp->bufPtr = 0;
-
-                       rxbdp++;
-               }
-
-               kfree(priv->rx_skbuff);
-       }
-}
-
-/* Bring the controller up and running */
-int startup_gfar(struct net_device *dev)
-{
-       struct txbd8 *txbdp;
-       struct rxbd8 *rxbdp;
-       unsigned long addr;
-       int i;
-       struct gfar_private *priv = netdev_priv(dev);
-       struct gfar *regs = priv->regs;
-       u32 tempval;
-       int err = 0;
-
-       gfar_write(&regs->imask, IMASK_INIT_CLEAR);
-
-       /* Allocate memory for the buffer descriptors */
-       addr =
-           (unsigned int) kmalloc(sizeof (struct txbd8) * priv->tx_ring_size +
-                                  sizeof (struct rxbd8) * priv->rx_ring_size,
-                                  GFP_KERNEL);
-
-       if (addr == 0) {
-               printk(KERN_ERR "%s: Could not allocate buffer descriptors!\n",
-                      dev->name);
-               return -ENOMEM;
-       }
-
-       priv->tx_bd_base = (struct txbd8 *) addr;
-
-       /* enet DMA only understands physical addresses */
-       gfar_write(&regs->tbase, 
-                       dma_map_single(NULL, (void *)addr, 
-                               sizeof(struct txbd8) * priv->tx_ring_size,
-                               DMA_BIDIRECTIONAL));
-
-       /* Start the rx descriptor ring where the tx ring leaves off */
-       addr = addr + sizeof (struct txbd8) * priv->tx_ring_size;
-       priv->rx_bd_base = (struct rxbd8 *) addr;
-       gfar_write(&regs->rbase, 
-                       dma_map_single(NULL, (void *)addr, 
-                               sizeof(struct rxbd8) * priv->rx_ring_size,
-                               DMA_BIDIRECTIONAL));
-
-       /* Setup the skbuff rings */
-       priv->tx_skbuff =
-           (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) *
-                                       priv->tx_ring_size, GFP_KERNEL);
-
-       if (priv->tx_skbuff == NULL) {
-               printk(KERN_ERR "%s: Could not allocate tx_skbuff\n",
-                      dev->name);
-               err = -ENOMEM;
-               goto tx_skb_fail;
-       }
-
-       for (i = 0; i < priv->tx_ring_size; i++)
-               priv->tx_skbuff[i] = NULL;
-
-       priv->rx_skbuff =
-           (struct sk_buff **) kmalloc(sizeof (struct sk_buff *) *
-                                       priv->rx_ring_size, GFP_KERNEL);
-
-       if (priv->rx_skbuff == NULL) {
-               printk(KERN_ERR "%s: Could not allocate rx_skbuff\n",
-                      dev->name);
-               err = -ENOMEM;
-               goto rx_skb_fail;
-       }
-
-       for (i = 0; i < priv->rx_ring_size; i++)
-               priv->rx_skbuff[i] = NULL;
-
-       /* Initialize some variables in our dev structure */
-       priv->dirty_tx = priv->cur_tx = priv->tx_bd_base;
-       priv->cur_rx = priv->rx_bd_base;
-       priv->skb_curtx = priv->skb_dirtytx = 0;
-       priv->skb_currx = 0;
-
-       /* Initialize Transmit Descriptor Ring */
-       txbdp = priv->tx_bd_base;
-       for (i = 0; i < priv->tx_ring_size; i++) {
-               txbdp->status = 0;
-               txbdp->length = 0;
-               txbdp->bufPtr = 0;
-               txbdp++;
-       }
-
-       /* Set the last descriptor in the ring to indicate wrap */
-       txbdp--;
-       txbdp->status |= TXBD_WRAP;
-
-       rxbdp = priv->rx_bd_base;
-       for (i = 0; i < priv->rx_ring_size; i++) {
-               struct sk_buff *skb = NULL;
-
-               rxbdp->status = 0;
-
-               skb = gfar_new_skb(dev, rxbdp);
-
-               priv->rx_skbuff[i] = skb;
-
-               rxbdp++;
-       }
-
-       /* Set the last descriptor in the ring to wrap */
-       rxbdp--;
-       rxbdp->status |= RXBD_WRAP;
-
-       /* If the device has multiple interrupts, register for
-        * them.  Otherwise, only register for the one */
-       if (priv->einfo->flags & GFAR_HAS_MULTI_INTR) {
-               /* Install our interrupt handlers for Error, 
-                * Transmit, and Receive */
-               if (request_irq(priv->einfo->interruptError, gfar_error,
-                               SA_SHIRQ, "enet_error", dev) < 0) {
-                       printk(KERN_ERR "%s: Can't get IRQ %d\n",
-                              dev->name, priv->einfo->interruptError);
-
-                       err = -1;
-                       goto err_irq_fail;
-               }
-
-               if (request_irq(priv->einfo->interruptTransmit, gfar_transmit,
-                               SA_SHIRQ, "enet_tx", dev) < 0) {
-                       printk(KERN_ERR "%s: Can't get IRQ %d\n",
-                              dev->name, priv->einfo->interruptTransmit);
-
-                       err = -1;
-
-                       goto tx_irq_fail;
-               }
-
-               if (request_irq(priv->einfo->interruptReceive, gfar_receive,
-                               SA_SHIRQ, "enet_rx", dev) < 0) {
-                       printk(KERN_ERR "%s: Can't get IRQ %d (receive0)\n",
-                              dev->name, priv->einfo->interruptReceive);
-
-                       err = -1;
-                       goto rx_irq_fail;
-               }
-       } else {
-               if (request_irq(priv->einfo->interruptTransmit, gfar_interrupt,
-                               SA_SHIRQ, "gfar_interrupt", dev) < 0) {
-                       printk(KERN_ERR "%s: Can't get IRQ %d\n",
-                              dev->name, priv->einfo->interruptError);
-
-                       err = -1;
-                       goto err_irq_fail;
-               }
-       }
-
-       /* Grab the PHY interrupt */
-       if (priv->einfo->flags & GFAR_HAS_PHY_INTR) {
-               if (request_irq(priv->einfo->interruptPHY, phy_interrupt,
-                               SA_SHIRQ, "phy_interrupt", dev) < 0) {
-                       printk(KERN_ERR "%s: Can't get IRQ %d (PHY)\n",
-                              dev->name, priv->einfo->interruptPHY);
-
-                       err = -1;
-
-                       if (priv->einfo->flags & GFAR_HAS_MULTI_INTR)
-                               goto phy_irq_fail;
-                       else
-                               goto tx_irq_fail;
-               }
-       } else {
-               init_timer(&priv->phy_info_timer);
-               priv->phy_info_timer.function = &gfar_phy_timer;
-               priv->phy_info_timer.data = (unsigned long) dev;
-               mod_timer(&priv->phy_info_timer, jiffies + 2 * HZ);
-       }
-
-       /* Set up the bottom half queue */
-       INIT_WORK(&priv->tq, (void (*)(void *))gfar_phy_change, dev);
-
-       /* Configure the PHY interrupt */
-       phy_run_commands(dev, priv->phyinfo->startup);
-
-       /* Tell the kernel the link is up, and determine the
-        * negotiated features (speed, duplex) */
-       adjust_link(dev);
-
-       if (priv->link == 0)
-               printk(KERN_INFO "%s: No link detected\n", dev->name);
-
-       /* Configure the coalescing support */
-       if (priv->txcoalescing)
-               gfar_write(&regs->txic,
-                          mk_ic_value(priv->txcount, priv->txtime));
-       else
-               gfar_write(&regs->txic, 0);
-
-       if (priv->rxcoalescing)
-               gfar_write(&regs->rxic,
-                          mk_ic_value(priv->rxcount, priv->rxtime));
-       else
-               gfar_write(&regs->rxic, 0);
-
-       init_waitqueue_head(&priv->rxcleanupq);
-
-       /* Enable Rx and Tx in MACCFG1 */
-       tempval = gfar_read(&regs->maccfg1);
-       tempval |= (MACCFG1_RX_EN | MACCFG1_TX_EN);
-       gfar_write(&regs->maccfg1, tempval);
-
-       /* Initialize DMACTRL to have WWR and WOP */
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval |= DMACTRL_INIT_SETTINGS;
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       /* Clear THLT, so that the DMA starts polling now */
-       gfar_write(&regs->tstat, TSTAT_CLEAR_THALT);
-
-       /* Make sure we aren't stopped */
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       /* Unmask the interrupts we look for */
-       gfar_write(&regs->imask, IMASK_DEFAULT);
-
-       return 0;
-
-phy_irq_fail:
-       free_irq(priv->einfo->interruptReceive, dev);
-rx_irq_fail:
-       free_irq(priv->einfo->interruptTransmit, dev);
-tx_irq_fail:
-       free_irq(priv->einfo->interruptError, dev);
-err_irq_fail:
-rx_skb_fail:
-       free_skb_resources(priv);
-tx_skb_fail:
-       kfree(priv->tx_bd_base);
-       return err;
-}
-
-/* Called when something needs to use the ethernet device */
-/* Returns 0 for success. */
-static int gfar_enet_open(struct net_device *dev)
-{
-       int err;
-
-       /* Initialize a bunch of registers */
-       init_registers(dev);
-
-       gfar_set_mac_address(dev);
-
-       err = init_phy(dev);
-
-       if (err)
-               return err;
-
-       err = startup_gfar(dev);
-
-       netif_start_queue(dev);
-
-       return err;
-}
-
-/* This is called by the kernel when a frame is ready for transmission. */
-/* It is pointed to by the dev->hard_start_xmit function pointer */
-static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       struct txbd8 *txbdp;
-
-       /* Update transmit stats */
-       priv->stats.tx_bytes += skb->len;
-
-       /* Lock priv now */
-       spin_lock_irq(&priv->lock);
-
-       /* Point at the first free tx descriptor */
-       txbdp = priv->cur_tx;
-
-       /* Clear all but the WRAP status flags */
-       txbdp->status &= TXBD_WRAP;
-
-       /* Set buffer length and pointer */
-       txbdp->length = skb->len;
-       txbdp->bufPtr = dma_map_single(NULL, skb->data, 
-                       skb->len, DMA_TO_DEVICE);
-
-       /* Save the skb pointer so we can free it later */
-       priv->tx_skbuff[priv->skb_curtx] = skb;
-
-       /* Update the current skb pointer (wrapping if this was the last) */
-       priv->skb_curtx =
-           (priv->skb_curtx + 1) & TX_RING_MOD_MASK(priv->tx_ring_size);
-
-       /* Flag the BD as interrupt-causing */
-       txbdp->status |= TXBD_INTERRUPT;
-
-       /* Flag the BD as ready to go, last in frame, and  */
-       /* in need of CRC */
-       txbdp->status |= (TXBD_READY | TXBD_LAST | TXBD_CRC);
-
-       dev->trans_start = jiffies;
-
-       /* If this was the last BD in the ring, the next one */
-       /* is at the beginning of the ring */
-       if (txbdp->status & TXBD_WRAP)
-               txbdp = priv->tx_bd_base;
-       else
-               txbdp++;
-
-       /* If the next BD still needs to be cleaned up, then the bds
-          are full.  We need to tell the kernel to stop sending us stuff. */
-       if (txbdp == priv->dirty_tx) {
-               netif_stop_queue(dev);
-
-               priv->stats.tx_fifo_errors++;
-       }
-
-       /* Update the current txbd to the next one */
-       priv->cur_tx = txbdp;
-
-       /* Tell the DMA to go go go */
-       gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
-
-       /* Unlock priv */
-       spin_unlock_irq(&priv->lock);
-
-       return 0;
-}
-
-/* Stops the kernel queue, and halts the controller */
-static int gfar_close(struct net_device *dev)
-{
-       stop_gfar(dev);
-
-       netif_stop_queue(dev);
-
-       return 0;
-}
-
-/* returns a net_device_stats structure pointer */
-static struct net_device_stats * gfar_get_stats(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       return &(priv->stats);
-}
-
-/* Changes the mac address if the controller is not running. */
-int gfar_set_mac_address(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       int i;
-       char tmpbuf[MAC_ADDR_LEN];
-       u32 tempval;
-
-       /* Now copy it into the mac registers backwards, cuz */
-       /* little endian is silly */
-       for (i = 0; i < MAC_ADDR_LEN; i++)
-               tmpbuf[MAC_ADDR_LEN - 1 - i] = dev->dev_addr[i];
-
-       gfar_write(&priv->regs->macstnaddr1, *((u32 *) (tmpbuf)));
-
-       tempval = *((u32 *) (tmpbuf + 4));
-
-       gfar_write(&priv->regs->macstnaddr2, tempval);
-
-       return 0;
-}
-
-/**********************************************************************
- * gfar_accept_fastpath
- *
- * Used to authenticate to the kernel that a fast path entry can be
- * added to device's routing table cache
- *
- * Input : pointer to ethernet interface network device structure and
- *         a pointer to the designated entry to be added to the cache.
- * Output : zero upon success, negative upon failure
- **********************************************************************/
-#ifdef CONFIG_NET_FASTROUTE
-static int gfar_accept_fastpath(struct net_device *dev, struct dst_entry *dst)
-{
-       struct net_device *odev = dst->dev;
-
-       if ((dst->ops->protocol != __constant_htons(ETH_P_IP))
-                       || (odev->type != ARPHRD_ETHER) 
-                       || (odev->accept_fastpath == NULL)) {
-               return -1;
-       }
-
-       return 0;
-}
-#endif
-
-/* try_fastroute() -- Checks the fastroute cache to see if a given packet
- *   can be routed immediately to another device.  If it can, we send it.
- *   If we used a fastroute, we return 1.  Otherwise, we return 0.
- *   Returns 0 if CONFIG_NET_FASTROUTE is not on
- */
-static inline int try_fastroute(struct sk_buff *skb, struct net_device *dev, int length)
-{
-#ifdef CONFIG_NET_FASTROUTE
-       struct ethhdr *eth;
-       struct iphdr *iph;
-       unsigned int hash;
-       struct rtable *rt;
-       struct net_device *odev;
-       struct gfar_private *priv = netdev_priv(dev);
-       unsigned int CPU_ID = smp_processor_id();
-
-       eth = (struct ethhdr *) (skb->data);
-
-       /* Only route ethernet IP packets */
-       if (eth->h_proto == __constant_htons(ETH_P_IP)) {
-               iph = (struct iphdr *) (skb->data + ETH_HLEN);
-
-               /* Generate the hash value */
-               hash = ((*(u8 *) &iph->daddr) ^ (*(u8 *) & iph->saddr)) & NETDEV_FASTROUTE_HMASK;
-
-               rt = (struct rtable *) (dev->fastpath[hash]);
-               if (rt != NULL 
-                               && ((*(u32 *) &iph->daddr) == (*(u32 *) &rt->key.dst))
-                               && ((*(u32 *) &iph->saddr) == (*(u32 *) &rt->key.src))
-                               && !(rt->u.dst.obsolete)) {
-                       odev = rt->u.dst.dev;
-                       netdev_rx_stat[CPU_ID].fastroute_hit++;
-
-                       /* Make sure the packet is:
-                        * 1) IPv4
-                        * 2) without any options (header length of 5)
-                        * 3) Not a multicast packet
-                        * 4) going to a valid destination
-                        * 5) Not out of time-to-live
-                        */
-                       if (iph->version == 4 
-                                       && iph->ihl == 5 
-                                       && (!(eth->h_dest[0] & 0x01)) 
-                                       && neigh_is_valid(rt->u.dst.neighbour) 
-                                       && iph->ttl > 1) {
-
-                               /* Fast Route Path: Taken if the outgoing device is ready to transmit the packet now */
-                               if ((!netif_queue_stopped(odev)) 
-                                               && (!spin_is_locked(odev->xmit_lock)) 
-                                               && (skb->len <= (odev->mtu + ETH_HLEN + 2 + 4))) {
-
-                                       skb->pkt_type = PACKET_FASTROUTE;
-                                       skb->protocol = __constant_htons(ETH_P_IP);
-                                       ip_decrease_ttl(iph);
-                                       memcpy(eth->h_source, odev->dev_addr, MAC_ADDR_LEN);
-                                       memcpy(eth->h_dest, rt->u.dst.neighbour->ha, MAC_ADDR_LEN);
-                                       skb->dev = odev;
-
-                                       /* Prep the skb for the packet */
-                                       skb_put(skb, length);
-
-                                       if (odev->hard_start_xmit(skb, odev) != 0) {
-                                               panic("%s: FastRoute path corrupted", dev->name);
-                                       }
-                                       netdev_rx_stat[CPU_ID].fastroute_success++;
-                               }
-
-                               /* Semi Fast Route Path: Mark the packet as needing fast routing, but let the
-                                * stack handle getting it to the device */
-                               else {
-                                       skb->pkt_type = PACKET_FASTROUTE;
-                                       skb->nh.raw = skb->data + ETH_HLEN;
-                                       skb->protocol = __constant_htons(ETH_P_IP);
-                                       netdev_rx_stat[CPU_ID].fastroute_defer++;
-
-                                       /* Prep the skb for the packet */
-                                       skb_put(skb, length);
-
-                                       if(RECEIVE(skb) == NET_RX_DROP) {
-                                               priv->extra_stats.kernel_dropped++;
-                                       }
-                               }
-
-                               return 1;
-                       }
-               }
-       }
-#endif /* CONFIG_NET_FASTROUTE */
-       return 0;
-}
-
-static int gfar_change_mtu(struct net_device *dev, int new_mtu)
-{
-       int tempsize, tempval;
-       struct gfar_private *priv = netdev_priv(dev);
-       int oldsize = priv->rx_buffer_size;
-       int frame_size = new_mtu + 18;
-
-       if ((frame_size < 64) || (frame_size > JUMBO_FRAME_SIZE)) {
-               printk(KERN_ERR "%s: Invalid MTU setting\n", dev->name);
-               return -EINVAL;
-       }
-
-       tempsize =
-           (frame_size & ~(INCREMENTAL_BUFFER_SIZE - 1)) +
-           INCREMENTAL_BUFFER_SIZE;
-
-       /* Only stop and start the controller if it isn't already
-        * stopped */
-       if ((oldsize != tempsize) && (dev->flags & IFF_UP))
-               stop_gfar(dev);
-
-       priv->rx_buffer_size = tempsize;
-
-       dev->mtu = new_mtu;
-
-       gfar_write(&priv->regs->mrblr, priv->rx_buffer_size);
-       gfar_write(&priv->regs->maxfrm, priv->rx_buffer_size);
-
-       /* If the mtu is larger than the max size for standard
-        * ethernet frames (ie, a jumbo frame), then set maccfg2
-        * to allow huge frames, and to check the length */
-       tempval = gfar_read(&priv->regs->maccfg2);
-
-       if (priv->rx_buffer_size > DEFAULT_RX_BUFFER_SIZE)
-               tempval |= (MACCFG2_HUGEFRAME | MACCFG2_LENGTHCHECK);
-       else
-               tempval &= ~(MACCFG2_HUGEFRAME | MACCFG2_LENGTHCHECK);
-
-       gfar_write(&priv->regs->maccfg2, tempval);
-
-       if ((oldsize != tempsize) && (dev->flags & IFF_UP))
-               startup_gfar(dev);
-
-       return 0;
-}
-
-/* gfar_timeout gets called when a packet has not been
- * transmitted after a set amount of time.
- * For now, assume that clearing out all the structures, and
- * starting over will fix the problem. */
-static void gfar_timeout(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       priv->stats.tx_errors++;
-
-       if (dev->flags & IFF_UP) {
-               stop_gfar(dev);
-               startup_gfar(dev);
-       }
-
-       if (!netif_queue_stopped(dev))
-               netif_schedule(dev);
-}
-
-/* Interrupt Handler for Transmit complete */
-static irqreturn_t gfar_transmit(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct net_device *dev = (struct net_device *) dev_id;
-       struct gfar_private *priv = netdev_priv(dev);
-       struct txbd8 *bdp;
-
-       /* Clear IEVENT */
-       gfar_write(&priv->regs->ievent, IEVENT_TX_MASK);
-
-       /* Lock priv */
-       spin_lock(&priv->lock);
-       bdp = priv->dirty_tx;
-       while ((bdp->status & TXBD_READY) == 0) {
-               /* If dirty_tx and cur_tx are the same, then either the */
-               /* ring is empty or full now (it could only be full in the beginning, */
-               /* obviously).  If it is empty, we are done. */
-               if ((bdp == priv->cur_tx) && (netif_queue_stopped(dev) == 0))
-                       break;
-
-               priv->stats.tx_packets++;
-
-               /* Deferred means some collisions occurred during transmit, */
-               /* but we eventually sent the packet. */
-               if (bdp->status & TXBD_DEF)
-                       priv->stats.collisions++;
-
-               /* Free the sk buffer associated with this TxBD */
-               dev_kfree_skb_irq(priv->tx_skbuff[priv->skb_dirtytx]);
-               priv->tx_skbuff[priv->skb_dirtytx] = NULL;
-               priv->skb_dirtytx =
-                   (priv->skb_dirtytx +
-                    1) & TX_RING_MOD_MASK(priv->tx_ring_size);
-
-               /* update bdp to point at next bd in the ring (wrapping if necessary) */
-               if (bdp->status & TXBD_WRAP)
-                       bdp = priv->tx_bd_base;
-               else
-                       bdp++;
-
-               /* Move dirty_tx to be the next bd */
-               priv->dirty_tx = bdp;
-
-               /* We freed a buffer, so now we can restart transmission */
-               if (netif_queue_stopped(dev))
-                       netif_wake_queue(dev);
-       } /* while ((bdp->status & TXBD_READY) == 0) */
-
-       /* If we are coalescing the interrupts, reset the timer */
-       /* Otherwise, clear it */
-       if (priv->txcoalescing)
-               gfar_write(&priv->regs->txic,
-                          mk_ic_value(priv->txcount, priv->txtime));
-       else
-               gfar_write(&priv->regs->txic, 0);
-
-       spin_unlock(&priv->lock);
-
-       return IRQ_HANDLED;
-}
-
-struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       struct sk_buff *skb = NULL;
-       unsigned int timeout = SKB_ALLOC_TIMEOUT;
-
-       /* We have to allocate the skb, so keep trying till we succeed */
-       while ((!skb) && timeout--)
-               skb = dev_alloc_skb(priv->rx_buffer_size + RXBUF_ALIGNMENT);
-
-       if (skb == NULL)
-               return NULL;
-
-       /* We need the data buffer to be aligned properly.  We will reserve
-        * as many bytes as needed to align the data properly
-        */
-       skb_reserve(skb,
-                   RXBUF_ALIGNMENT -
-                   (((unsigned) skb->data) & (RXBUF_ALIGNMENT - 1)));
-
-       skb->dev = dev;
-
-       bdp->bufPtr = dma_map_single(NULL, skb->data,
-                       priv->rx_buffer_size + RXBUF_ALIGNMENT, 
-                       DMA_FROM_DEVICE);
-
-       bdp->length = 0;
-
-       /* Mark the buffer empty */
-       bdp->status |= (RXBD_EMPTY | RXBD_INTERRUPT);
-
-       return skb;
-}
-
-static inline void count_errors(unsigned short status, struct gfar_private *priv)
-{
-       struct net_device_stats *stats = &priv->stats;
-       struct gfar_extra_stats *estats = &priv->extra_stats;
-
-       /* If the packet was truncated, none of the other errors
-        * matter */
-       if (status & RXBD_TRUNCATED) {
-               stats->rx_length_errors++;
-
-               estats->rx_trunc++;
-
-               return;
-       }
-       /* Count the errors, if there were any */
-       if (status & (RXBD_LARGE | RXBD_SHORT)) {
-               stats->rx_length_errors++;
-
-               if (status & RXBD_LARGE)
-                       estats->rx_large++;
-               else
-                       estats->rx_short++;
-       }
-       if (status & RXBD_NONOCTET) {
-               stats->rx_frame_errors++;
-               estats->rx_nonoctet++;
-       }
-       if (status & RXBD_CRCERR) {
-               estats->rx_crcerr++;
-               stats->rx_crc_errors++;
-       }
-       if (status & RXBD_OVERRUN) {
-               estats->rx_overrun++;
-               stats->rx_crc_errors++;
-       }
-}
-
-irqreturn_t gfar_receive(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct net_device *dev = (struct net_device *) dev_id;
-       struct gfar_private *priv = netdev_priv(dev);
-
-#ifdef CONFIG_GFAR_NAPI
-       u32 tempval;
-#endif
-
-       /* Clear IEVENT, so rx interrupt isn't called again
-        * because of this interrupt */
-       gfar_write(&priv->regs->ievent, IEVENT_RX_MASK);
-
-       /* support NAPI */
-#ifdef CONFIG_GFAR_NAPI
-       if (netif_rx_schedule_prep(dev)) {
-               tempval = gfar_read(&priv->regs->imask);
-               tempval &= IMASK_RX_DISABLED;
-               gfar_write(&priv->regs->imask, tempval);
-
-               __netif_rx_schedule(dev);
-       } else {
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: receive called twice (%x)[%x]\n",
-                      dev->name, gfar_read(priv->regs->ievent),
-                      gfar_read(priv->regs->imask));
-#endif
-       }
-#else
-
-       spin_lock(&priv->lock);
-       gfar_clean_rx_ring(dev);
-
-       /* If we are coalescing interrupts, update the timer */
-       /* Otherwise, clear it */
-       if (priv->rxcoalescing)
-               gfar_write(&priv->regs->rxic,
-                          mk_ic_value(priv->rxcount, priv->rxtime));
-       else
-               gfar_write(&priv->regs->rxic, 0);
-
-       /* Just in case we need to wake the ring param changer */
-       priv->rxclean = 1;
-
-       spin_unlock(&priv->lock);
-#endif
-
-       return IRQ_HANDLED;
-}
-
-
-/* gfar_process_frame() -- handle one incoming packet if skb
- * isn't NULL.  Try the fastroute before using the stack */
-static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
-               int length)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-
-       if (skb == NULL) {
-#ifdef BRIEF_GFAR_ERRORS
-               printk(KERN_WARNING "%s: Missing skb!!.\n",
-                               dev->name);
-#endif
-               priv->stats.rx_dropped++;
-               priv->extra_stats.rx_skbmissing++;
-       } else {
-               if(try_fastroute(skb, dev, length) == 0) {
-                       /* Prep the skb for the packet */
-                       skb_put(skb, length);
-
-                       /* Tell the skb what kind of packet this is */
-                       skb->protocol = eth_type_trans(skb, dev);
-
-                       /* Send the packet up the stack */
-                       if (RECEIVE(skb) == NET_RX_DROP) {
-                               priv->extra_stats.kernel_dropped++;
-                       }
-               }
-       }
-
-       return 0;
-}
-
-/* gfar_clean_rx_ring() -- Processes each frame in the rx ring
- *   until all are gone (or, in the case of NAPI, the budget/quota
- *   has been reached). Returns the number of frames handled
- */
-#ifdef CONFIG_GFAR_NAPI
-static int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
-#else
-static int gfar_clean_rx_ring(struct net_device *dev)
-#endif
-{
-       struct rxbd8 *bdp;
-       struct sk_buff *skb;
-       u16 pkt_len;
-       int howmany = 0;
-       struct gfar_private *priv = netdev_priv(dev);
-
-       /* Get the first full descriptor */
-       bdp = priv->cur_rx;
-
-#ifdef CONFIG_GFAR_NAPI
-#define GFAR_RXDONE() ((bdp->status & RXBD_EMPTY) || (--rx_work_limit < 0))
-#else
-#define GFAR_RXDONE() (bdp->status & RXBD_EMPTY)
-#endif
-       while (!GFAR_RXDONE()) {
-               skb = priv->rx_skbuff[priv->skb_currx];
-
-               if (!(bdp->status &
-                     (RXBD_LARGE | RXBD_SHORT | RXBD_NONOCTET
-                      | RXBD_CRCERR | RXBD_OVERRUN | RXBD_TRUNCATED))) {
-                       /* Increment the number of packets */
-                       priv->stats.rx_packets++;
-                       howmany++;
-
-                       /* Remove the FCS from the packet length */
-                       pkt_len = bdp->length - 4;
-
-                       gfar_process_frame(dev, skb, pkt_len);
-
-                       priv->stats.rx_bytes += pkt_len;
-
-               } else {
-                       count_errors(bdp->status, priv);
-
-                       if (skb)
-                               dev_kfree_skb_any(skb);
-
-                       priv->rx_skbuff[priv->skb_currx] = NULL;
-               }
-
-               dev->last_rx = jiffies;
-
-               /* Clear the status flags for this buffer */
-               bdp->status &= ~RXBD_STATS;
-
-               /* Add another skb for the future */
-               skb = gfar_new_skb(dev, bdp);
-               priv->rx_skbuff[priv->skb_currx] = skb;
-
-               /* Update to the next pointer */
-               if (bdp->status & RXBD_WRAP)
-                       bdp = priv->rx_bd_base;
-               else
-                       bdp++;
-
-               /* update to point at the next skb */
-               priv->skb_currx =
-                   (priv->skb_currx +
-                    1) & RX_RING_MOD_MASK(priv->rx_ring_size);
-
-       }
-
-       /* Update the current rxbd pointer to be the next one */
-       priv->cur_rx = bdp;
-
-       /* If no packets have arrived since the
-        * last one we processed, clear the IEVENT RX and
-        * BSY bits so that another interrupt won't be
-        * generated when we set IMASK */
-       if (bdp->status & RXBD_EMPTY)
-               gfar_write(&priv->regs->ievent, IEVENT_RX_MASK);
-
-       return howmany;
-}
-
-#ifdef CONFIG_GFAR_NAPI
-static int gfar_poll(struct net_device *dev, int *budget)
-{
-       int howmany;
-       struct gfar_private *priv = netdev_priv(dev);
-       int rx_work_limit = *budget;
-
-       if (rx_work_limit > dev->quota)
-               rx_work_limit = dev->quota;
-
-       spin_lock(&priv->lock);
-       howmany = gfar_clean_rx_ring(dev, rx_work_limit);
-
-       dev->quota -= howmany;
-       rx_work_limit -= howmany;
-       *budget -= howmany;
-
-       if (rx_work_limit >= 0) {
-               netif_rx_complete(dev);
-
-               /* Clear the halt bit in RSTAT */
-               gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
-
-               gfar_write(&priv->regs->imask, IMASK_DEFAULT);
-
-               /* If we are coalescing interrupts, update the timer */
-               /* Otherwise, clear it */
-               if (priv->rxcoalescing)
-                       gfar_write(&priv->regs->rxic,
-                                  mk_ic_value(priv->rxcount, priv->rxtime));
-               else
-                       gfar_write(&priv->regs->rxic, 0);
-
-               /* Signal to the ring size changer that it's safe to go */
-               priv->rxclean = 1;
-       }
-
-       spin_unlock(priv->lock);
-
-       return (rx_work_limit < 0) ? 1 : 0;
-}
-#endif
-
-/* The interrupt handler for devices with one interrupt */
-static irqreturn_t gfar_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct net_device *dev = dev_id;
-       struct gfar_private *priv = netdev_priv(dev);
-
-       /* Save ievent for future reference */
-       u32 events = gfar_read(&priv->regs->ievent);
-
-       /* Clear IEVENT */
-       gfar_write(&priv->regs->ievent, events);
-
-       /* Check for reception */
-       if ((events & IEVENT_RXF0) || (events & IEVENT_RXB0))
-               gfar_receive(irq, dev_id, regs);
-
-       /* Check for transmit completion */
-       if ((events & IEVENT_TXF) || (events & IEVENT_TXB))
-               gfar_transmit(irq, dev_id, regs);
-
-       /* Update error statistics */
-       if (events & IEVENT_TXE) {
-               priv->stats.tx_errors++;
-
-               if (events & IEVENT_LC)
-                       priv->stats.tx_window_errors++;
-               if (events & IEVENT_CRL)
-                       priv->stats.tx_aborted_errors++;
-               if (events & IEVENT_XFUN) {
-#ifdef VERBOSE_GFAR_ERRORS
-                       printk(KERN_WARNING "%s: tx underrun. dropped packet\n",
-                              dev->name);
-#endif
-                       priv->stats.tx_dropped++;
-                       priv->extra_stats.tx_underrun++;
-
-                       /* Reactivate the Tx Queues */
-                       gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
-               }
-       }
-       if (events & IEVENT_BSY) {
-               priv->stats.rx_errors++;
-               priv->extra_stats.rx_bsy++;
-
-               gfar_receive(irq, dev_id, regs);
-
-#ifndef CONFIG_GFAR_NAPI
-               /* Clear the halt bit in RSTAT */
-               gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
-#endif
-
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", dev->name,
-                      gfar_read(priv->regs->rstat));
-#endif
-       }
-       if (events & IEVENT_BABR) {
-               priv->stats.rx_errors++;
-               priv->extra_stats.rx_babr++;
-
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: babbling error\n", dev->name);
-#endif
-       }
-       if (events & IEVENT_EBERR) {
-               priv->extra_stats.eberr++;
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: EBERR\n", dev->name);
-#endif
-       }
-       if (events & IEVENT_RXC) {
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: control frame\n", dev->name);
-#endif
-       }
-
-       if (events & IEVENT_BABT) {
-               priv->extra_stats.tx_babt++;
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: babt error\n", dev->name);
-#endif
-       }
-
-       return IRQ_HANDLED;
-}
-
-static irqreturn_t phy_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct net_device *dev = (struct net_device *) dev_id;
-       struct gfar_private *priv = netdev_priv(dev);
-
-       /* Run the commands which acknowledge the interrupt */
-       phy_run_commands(dev, priv->phyinfo->ack_int);
-
-       /* Schedule the bottom half */
-       schedule_work(&priv->tq);
-
-       return IRQ_HANDLED;
-}
-
-/* Scheduled by the phy_interrupt/timer to handle PHY changes */
-static void gfar_phy_change(void *data)
-{
-       struct net_device *dev = (struct net_device *) data;
-       struct gfar_private *priv = netdev_priv(dev);
-       int timeout = HZ / 1000 + 1;
-
-       /* Delay to give the PHY a chance to change the
-        * register state */
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(timeout);
-
-       /* Run the commands which check the link state */
-       phy_run_commands(dev, priv->phyinfo->handle_int);
-
-       /* React to the change in state */
-       adjust_link(dev);
-}
-
-/* Called every so often on systems that don't interrupt
- * the core for PHY changes */
-static void gfar_phy_timer(unsigned long data)
-{
-       struct net_device *dev = (struct net_device *) data;
-       struct gfar_private *priv = netdev_priv(dev);
-
-       schedule_work(&priv->tq);
-
-       mod_timer(&priv->phy_info_timer, jiffies + 2 * HZ);
-}
-
-/* Called every time the controller might need to be made
- * aware of new link state.  The PHY code conveys this
- * information through variables in the priv structure, and this
- * function converts those variables into the appropriate
- * register values, and can bring down the device if needed.
- */
-static void adjust_link(struct net_device *dev)
-{
-       struct gfar_private *priv = netdev_priv(dev);
-       struct gfar *regs = priv->regs;
-       u32 tempval;
-
-       if (priv->link) {
-               /* Now we make sure that we can be in full duplex mode.
-                * If not, we operate in half-duplex mode. */
-               if (priv->duplexity != priv->olddplx) {
-                       if (!(priv->duplexity)) {
-                               tempval = gfar_read(&regs->maccfg2);
-                               tempval &= ~(MACCFG2_FULL_DUPLEX);
-                               gfar_write(&regs->maccfg2, tempval);
-
-                               printk(KERN_INFO "%s: Half Duplex\n",
-                                      dev->name);
-                       } else {
-                               tempval = gfar_read(&regs->maccfg2);
-                               tempval |= MACCFG2_FULL_DUPLEX;
-                               gfar_write(&regs->maccfg2, tempval);
-
-                               printk(KERN_INFO "%s: Full Duplex\n",
-                                      dev->name);
-                       }
-
-                       priv->olddplx = priv->duplexity;
-               }
-
-               if (priv->speed != priv->oldspeed) {
-                       switch (priv->speed) {
-                       case 1000:
-                               tempval = gfar_read(&regs->maccfg2);
-                               tempval =
-                                   ((tempval & ~(MACCFG2_IF)) | MACCFG2_GMII);
-                               gfar_write(&regs->maccfg2, tempval);
-                               break;
-                       case 100:
-                       case 10:
-                               tempval = gfar_read(&regs->maccfg2);
-                               tempval =
-                                   ((tempval & ~(MACCFG2_IF)) | MACCFG2_MII);
-                               gfar_write(&regs->maccfg2, tempval);
-                               break;
-                       default:
-                               printk(KERN_WARNING
-                                      "%s: Ack!  Speed (%d) is not 10/100/1000!\n",
-                                      dev->name, priv->speed);
-                               break;
-                       }
-
-                       printk(KERN_INFO "%s: Speed %dBT\n", dev->name,
-                              priv->speed);
-
-                       priv->oldspeed = priv->speed;
-               }
-
-               if (!priv->oldlink) {
-                       printk(KERN_INFO "%s: Link is up\n", dev->name);
-                       priv->oldlink = 1;
-                       netif_carrier_on(dev);
-                       netif_schedule(dev);
-               }
-       } else {
-               if (priv->oldlink) {
-                       printk(KERN_INFO "%s: Link is down\n", dev->name);
-                       priv->oldlink = 0;
-                       priv->oldspeed = 0;
-                       priv->olddplx = -1;
-                       netif_carrier_off(dev);
-               }
-       }
-
-#ifdef VERBOSE_GFAR_ERRORS
-       printk(KERN_INFO "%s: Link now %s; %dBT %s-duplex\n",
-              dev->name, priv->link ? "up" : "down", priv->speed, priv->duplexity ? "full" : "half");
-#endif
-}
-
-
-/* Update the hash table based on the current list of multicast
- * addresses we subscribe to.  Also, change the promiscuity of
- * the device based on the flags (this function is called
- * whenever dev->flags is changed */
-static void gfar_set_multi(struct net_device *dev)
-{
-       struct dev_mc_list *mc_ptr;
-       struct gfar_private *priv = netdev_priv(dev);
-       struct gfar *regs = priv->regs;
-       u32 tempval;
-
-       if(dev->flags & IFF_PROMISC) {
-               printk(KERN_INFO "%s: Entering promiscuous mode.\n",
-                               dev->name);
-               /* Set RCTRL to PROM */
-               tempval = gfar_read(&regs->rctrl);
-               tempval |= RCTRL_PROM;
-               gfar_write(&regs->rctrl, tempval);
-       } else {
-               /* Set RCTRL to not PROM */
-               tempval = gfar_read(&regs->rctrl);
-               tempval &= ~(RCTRL_PROM);
-               gfar_write(&regs->rctrl, tempval);
-       }
-       
-       if(dev->flags & IFF_ALLMULTI) {
-               /* Set the hash to rx all multicast frames */
-               gfar_write(&regs->gaddr0, 0xffffffff);
-               gfar_write(&regs->gaddr1, 0xffffffff);
-               gfar_write(&regs->gaddr2, 0xffffffff);
-               gfar_write(&regs->gaddr3, 0xffffffff);
-               gfar_write(&regs->gaddr4, 0xffffffff);
-               gfar_write(&regs->gaddr5, 0xffffffff);
-               gfar_write(&regs->gaddr6, 0xffffffff);
-               gfar_write(&regs->gaddr7, 0xffffffff);
-       } else {
-               /* zero out the hash */
-               gfar_write(&regs->gaddr0, 0x0);
-               gfar_write(&regs->gaddr1, 0x0);
-               gfar_write(&regs->gaddr2, 0x0);
-               gfar_write(&regs->gaddr3, 0x0);
-               gfar_write(&regs->gaddr4, 0x0);
-               gfar_write(&regs->gaddr5, 0x0);
-               gfar_write(&regs->gaddr6, 0x0);
-               gfar_write(&regs->gaddr7, 0x0);
-
-               if(dev->mc_count == 0)
-                       return;
-
-               /* Parse the list, and set the appropriate bits */
-               for(mc_ptr = dev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) {
-                       gfar_set_hash_for_addr(dev, mc_ptr->dmi_addr);
-               }
-       }
-
-       return;
-}
-
-/* Set the appropriate hash bit for the given addr */
-/* The algorithm works like so:
- * 1) Take the Destination Address (ie the multicast address), and
- * do a CRC on it (little endian), and reverse the bits of the
- * result.
- * 2) Use the 8 most significant bits as a hash into a 256-entry
- * table.  The table is controlled through 8 32-bit registers:
- * gaddr0-7.  gaddr0's MSB is entry 0, and gaddr7's LSB is
- * gaddr7.  This means that the 3 most significant bits in the
- * hash index which gaddr register to use, and the 5 other bits
- * indicate which bit (assuming an IBM numbering scheme, which
- * for PowerPC (tm) is usually the case) in the register holds
- * the entry. */
-static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr)
-{
-       u32 tempval;
-       struct gfar_private *priv = netdev_priv(dev);
-       struct gfar *regs = priv->regs;
-       u32 *hash = &regs->gaddr0;
-       u32 result = ether_crc(MAC_ADDR_LEN, addr);
-       u8 whichreg = ((result >> 29) & 0x7);
-       u8 whichbit = ((result >> 24) & 0x1f);
-       u32 value = (1 << (31-whichbit));
-
-       tempval = gfar_read(&hash[whichreg]);
-       tempval |= value;
-       gfar_write(&hash[whichreg], tempval);
-
-       return;
-}
-
-/* GFAR error interrupt handler */
-static irqreturn_t gfar_error(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct net_device *dev = dev_id;
-       struct gfar_private *priv = netdev_priv(dev);
-
-       /* Save ievent for future reference */
-       u32 events = gfar_read(&priv->regs->ievent);
-
-       /* Clear IEVENT */
-       gfar_write(&priv->regs->ievent, IEVENT_ERR_MASK);
-
-       /* Hmm... */
-#if defined (BRIEF_GFAR_ERRORS) || defined (VERBOSE_GFAR_ERRORS)
-       printk(KERN_DEBUG "%s: error interrupt (ievent=0x%08x imask=0x%08x)\n",
-              dev->name, events, gfar_read(priv->regs->imask));
-#endif
-
-       /* Update the error counters */
-       if (events & IEVENT_TXE) {
-               priv->stats.tx_errors++;
-
-               if (events & IEVENT_LC)
-                       priv->stats.tx_window_errors++;
-               if (events & IEVENT_CRL)
-                       priv->stats.tx_aborted_errors++;
-               if (events & IEVENT_XFUN) {
-#ifdef VERBOSE_GFAR_ERRORS
-                       printk(KERN_DEBUG "%s: underrun.  packet dropped.\n",
-                              dev->name);
-#endif
-                       priv->stats.tx_dropped++;
-                       priv->extra_stats.tx_underrun++;
-
-                       /* Reactivate the Tx Queues */
-                       gfar_write(&priv->regs->tstat, TSTAT_CLEAR_THALT);
-               }
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: Transmit Error\n", dev->name);
-#endif
-       }
-       if (events & IEVENT_BSY) {
-               priv->stats.rx_errors++;
-               priv->extra_stats.rx_bsy++;
-
-               gfar_receive(irq, dev_id, regs);
-
-#ifndef CONFIG_GFAR_NAPI
-               /* Clear the halt bit in RSTAT */
-               gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
-#endif
-
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: busy error (rhalt: %x)\n", dev->name,
-                      gfar_read(priv->regs->rstat));
-#endif
-       }
-       if (events & IEVENT_BABR) {
-               priv->stats.rx_errors++;
-               priv->extra_stats.rx_babr++;
-
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: babbling error\n", dev->name);
-#endif
-       }
-       if (events & IEVENT_EBERR) {
-               priv->extra_stats.eberr++;
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: EBERR\n", dev->name);
-#endif
-       }
-       if (events & IEVENT_RXC)
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: control frame\n", dev->name);
-#endif
-
-       if (events & IEVENT_BABT) {
-               priv->extra_stats.tx_babt++;
-#ifdef VERBOSE_GFAR_ERRORS
-               printk(KERN_DEBUG "%s: babt error\n", dev->name);
-#endif
-       }
-       return IRQ_HANDLED;
-}
-
-/* Structure for a device driver */
-static struct ocp_device_id gfar_ids[] = {
-       {.vendor = OCP_ANY_ID,.function = OCP_FUNC_GFAR},
-       {.vendor = OCP_VENDOR_INVALID}
-};
-
-static struct ocp_driver gfar_driver = {
-       .name = "gianfar",
-       .id_table = gfar_ids,
-
-       .probe = gfar_probe,
-       .remove = gfar_remove,
-};
-
-static int __init gfar_init(void)
-{
-       int rc;
-
-       rc = ocp_register_driver(&gfar_driver);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
-       if (rc != 0) {
-#else
-       if (rc == 0) {
-#endif
-               ocp_unregister_driver(&gfar_driver);
-               return -ENODEV;
-       }
-
-       return 0;
-}
-
-static void __exit gfar_exit(void)
-{
-       ocp_unregister_driver(&gfar_driver);
-}
-
-module_init(gfar_init);
-module_exit(gfar_exit);
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
deleted file mode 100644 (file)
index f7af346..0000000
+++ /dev/null
@@ -1,537 +0,0 @@
-/* 
- * drivers/net/gianfar.h
- *
- * Gianfar Ethernet Driver
- * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560
- * Based on 8260_io/fcc_enet.c
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
- *
- * Copyright 2004 Freescale Semiconductor, Inc
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- *  Still left to do:
- *      -Add support for module parameters
- */
-#ifndef __GIANFAR_H
-#define __GIANFAR_H
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/crc32.h>
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,41)
-#include <linux/workqueue.h>
-#else
-#include <linux/tqueue.h>
-#define work_struct tq_struct
-#define schedule_work schedule_task
-#endif
-
-#include <linux/ethtool.h>
-#include <linux/netdevice.h>
-#include <asm/ocp.h>
-#include "gianfar_phy.h"
-
-/* The maximum number of packets to be handled in one call of gfar_poll */
-#define GFAR_DEV_WEIGHT 64
-
-/* Number of bytes to align the rx bufs to */
-#define RXBUF_ALIGNMENT 64
-
-/* The number of bytes which composes a unit for the purpose of
- * allocating data buffers.  ie-for any given MTU, the data buffer
- * will be the next highest multiple of 512 bytes. */
-#define INCREMENTAL_BUFFER_SIZE 512
-
-
-#define MAC_ADDR_LEN 6
-
-extern char gfar_driver_name[];
-extern char gfar_driver_version[];
-
-/* These need to be powers of 2 for this driver */
-#ifdef CONFIG_GFAR_NAPI
-#define DEFAULT_TX_RING_SIZE   256
-#define DEFAULT_RX_RING_SIZE   256
-#else
-#define DEFAULT_TX_RING_SIZE    64
-#define DEFAULT_RX_RING_SIZE    64
-#endif
-
-#define GFAR_RX_MAX_RING_SIZE   256
-#define GFAR_TX_MAX_RING_SIZE   256
-
-#define DEFAULT_RX_BUFFER_SIZE  1536
-#define TX_RING_MOD_MASK(size) (size-1)
-#define RX_RING_MOD_MASK(size) (size-1)
-#define JUMBO_BUFFER_SIZE 9728
-#define JUMBO_FRAME_SIZE 9600
-
-/* Latency of interface clock in nanoseconds */
-/* Interface clock latency , in this case, means the 
- * time described by a value of 1 in the interrupt
- * coalescing registers' time fields.  Since those fields
- * refer to the time it takes for 64 clocks to pass, the
- * latencies are as such:
- * GBIT = 125MHz => 8ns/clock => 8*64 ns / tick
- * 100 = 25 MHz => 40ns/clock => 40*64 ns / tick
- * 10 = 2.5 MHz => 400ns/clock => 400*64 ns / tick
- */
-#define GFAR_GBIT_TIME  512
-#define GFAR_100_TIME   2560
-#define GFAR_10_TIME    25600
-
-#define DEFAULT_TXCOUNT        16
-#define DEFAULT_TXTIME 32768
-
-#define DEFAULT_RXCOUNT        16
-#define DEFAULT_RXTIME 32768
-
-#define TBIPA_VALUE            0x1f
-#define MIIMCFG_INIT_VALUE     0x00000007
-#define MIIMCFG_RESET           0x80000000
-#define MIIMIND_BUSY            0x00000001
-
-/* MAC register bits */
-#define MACCFG1_SOFT_RESET     0x80000000
-#define MACCFG1_RESET_RX_MC    0x00080000
-#define MACCFG1_RESET_TX_MC    0x00040000
-#define MACCFG1_RESET_RX_FUN   0x00020000
-#define        MACCFG1_RESET_TX_FUN    0x00010000
-#define MACCFG1_LOOPBACK       0x00000100
-#define MACCFG1_RX_FLOW                0x00000020
-#define MACCFG1_TX_FLOW                0x00000010
-#define MACCFG1_SYNCD_RX_EN    0x00000008
-#define MACCFG1_RX_EN          0x00000004
-#define MACCFG1_SYNCD_TX_EN    0x00000002
-#define MACCFG1_TX_EN          0x00000001
-
-#define MACCFG2_INIT_SETTINGS  0x00007205
-#define MACCFG2_FULL_DUPLEX    0x00000001
-#define MACCFG2_IF              0x00000300
-#define MACCFG2_MII             0x00000100
-#define MACCFG2_GMII            0x00000200
-#define MACCFG2_HUGEFRAME      0x00000020
-#define MACCFG2_LENGTHCHECK    0x00000010
-
-#define ECNTRL_INIT_SETTINGS   0x00001000
-#define ECNTRL_TBI_MODE         0x00000020
-
-#define MRBLR_INIT_SETTINGS    DEFAULT_RX_BUFFER_SIZE
-
-#define MINFLR_INIT_SETTINGS   0x00000040
-
-/* Init to do tx snooping for buffers and descriptors */
-#define DMACTRL_INIT_SETTINGS   0x000000c3
-#define DMACTRL_GRS             0x00000010
-#define DMACTRL_GTS             0x00000008
-
-#define TSTAT_CLEAR_THALT       0x80000000
-
-/* Interrupt coalescing macros */
-#define IC_ICEN                        0x80000000
-#define IC_ICFT_MASK           0x1fe00000
-#define IC_ICFT_SHIFT          21
-#define mk_ic_icft(x)          \
-       (((unsigned int)x << IC_ICFT_SHIFT)&IC_ICFT_MASK)
-#define IC_ICTT_MASK           0x0000ffff
-#define mk_ic_ictt(x)          (x&IC_ICTT_MASK)
-
-#define mk_ic_value(count, time) (IC_ICEN | \
-                               mk_ic_icft(count) | \
-                               mk_ic_ictt(time))
-
-#define RCTRL_PROM             0x00000008
-#define RSTAT_CLEAR_RHALT       0x00800000
-
-#define IEVENT_INIT_CLEAR      0xffffffff
-#define IEVENT_BABR            0x80000000
-#define IEVENT_RXC             0x40000000
-#define IEVENT_BSY             0x20000000
-#define IEVENT_EBERR           0x10000000
-#define IEVENT_MSRO            0x04000000
-#define IEVENT_GTSC            0x02000000
-#define IEVENT_BABT            0x01000000
-#define IEVENT_TXC             0x00800000
-#define IEVENT_TXE             0x00400000
-#define IEVENT_TXB             0x00200000
-#define IEVENT_TXF             0x00100000
-#define IEVENT_LC              0x00040000
-#define IEVENT_CRL             0x00020000
-#define IEVENT_XFUN            0x00010000
-#define IEVENT_RXB0            0x00008000
-#define IEVENT_GRSC            0x00000100
-#define IEVENT_RXF0            0x00000080
-#define IEVENT_RX_MASK          (IEVENT_RXB0 | IEVENT_RXF0)
-#define IEVENT_TX_MASK          (IEVENT_TXB | IEVENT_TXF)
-#define IEVENT_ERR_MASK         \
-(IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \
- IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \
- | IEVENT_CRL | IEVENT_XFUN)
-
-#define IMASK_INIT_CLEAR       0x00000000
-#define IMASK_BABR              0x80000000
-#define IMASK_RXC               0x40000000
-#define IMASK_BSY               0x20000000
-#define IMASK_EBERR             0x10000000
-#define IMASK_MSRO             0x04000000
-#define IMASK_GRSC              0x02000000
-#define IMASK_BABT             0x01000000
-#define IMASK_TXC               0x00800000
-#define IMASK_TXEEN            0x00400000
-#define IMASK_TXBEN            0x00200000
-#define IMASK_TXFEN             0x00100000
-#define IMASK_LC               0x00040000
-#define IMASK_CRL              0x00020000
-#define IMASK_XFUN             0x00010000
-#define IMASK_RXB0              0x00008000
-#define IMASK_GTSC              0x00000100
-#define IMASK_RXFEN0           0x00000080
-#define IMASK_RX_DISABLED ~(IMASK_RXFEN0 | IMASK_BSY)
-#define IMASK_DEFAULT  (IMASK_TXEEN | IMASK_TXFEN | IMASK_TXBEN | \
-               IMASK_RXFEN0 | IMASK_BSY | IMASK_EBERR | IMASK_BABR | \
-               IMASK_XFUN | IMASK_RXC | IMASK_BABT)
-
-
-/* Attribute fields */
-
-/* This enables rx snooping for buffers and descriptors */
-#ifdef CONFIG_GFAR_BDSTASH
-#define ATTR_BDSTASH           0x00000800
-#else
-#define ATTR_BDSTASH           0x00000000
-#endif
-
-#ifdef CONFIG_GFAR_BUFSTASH
-#define ATTR_BUFSTASH          0x00004000
-#define STASH_LENGTH           64
-#else
-#define ATTR_BUFSTASH          0x00000000
-#endif
-
-#define ATTR_SNOOPING          0x000000c0
-#define ATTR_INIT_SETTINGS      (ATTR_SNOOPING \
-               | ATTR_BDSTASH | ATTR_BUFSTASH)
-
-#define ATTRELI_INIT_SETTINGS   0x0
-
-
-/* TxBD status field bits */
-#define TXBD_READY             0x8000
-#define TXBD_PADCRC            0x4000
-#define TXBD_WRAP              0x2000
-#define TXBD_INTERRUPT         0x1000
-#define TXBD_LAST              0x0800
-#define TXBD_CRC               0x0400
-#define TXBD_DEF               0x0200
-#define TXBD_HUGEFRAME         0x0080
-#define TXBD_LATECOLLISION     0x0080
-#define TXBD_RETRYLIMIT                0x0040
-#define        TXBD_RETRYCOUNTMASK     0x003c
-#define TXBD_UNDERRUN          0x0002
-
-/* RxBD status field bits */
-#define RXBD_EMPTY             0x8000
-#define RXBD_RO1               0x4000
-#define RXBD_WRAP              0x2000
-#define RXBD_INTERRUPT         0x1000
-#define RXBD_LAST              0x0800
-#define RXBD_FIRST             0x0400
-#define RXBD_MISS              0x0100
-#define RXBD_BROADCAST         0x0080
-#define RXBD_MULTICAST         0x0040
-#define RXBD_LARGE             0x0020
-#define RXBD_NONOCTET          0x0010
-#define RXBD_SHORT             0x0008
-#define RXBD_CRCERR            0x0004
-#define RXBD_OVERRUN           0x0002
-#define RXBD_TRUNCATED         0x0001
-#define RXBD_STATS             0x01ff
-
-struct txbd8
-{
-       u16     status; /* Status Fields */
-       u16     length; /* Buffer length */
-       u32     bufPtr; /* Buffer Pointer */
-};
-
-struct rxbd8
-{
-       u16     status; /* Status Fields */
-       u16     length; /* Buffer Length */
-       u32     bufPtr; /* Buffer Pointer */
-};
-
-struct rmon_mib
-{
-       u32     tr64;   /* 0x.680 - Transmit and Receive 64-byte Frame Counter */
-       u32     tr127;  /* 0x.684 - Transmit and Receive 65-127 byte Frame Counter */
-       u32     tr255;  /* 0x.688 - Transmit and Receive 128-255 byte Frame Counter */
-       u32     tr511;  /* 0x.68c - Transmit and Receive 256-511 byte Frame Counter */
-       u32     tr1k;   /* 0x.690 - Transmit and Receive 512-1023 byte Frame Counter */
-       u32     trmax;  /* 0x.694 - Transmit and Receive 1024-1518 byte Frame Counter */
-       u32     trmgv;  /* 0x.698 - Transmit and Receive 1519-1522 byte Good VLAN Frame */
-       u32     rbyt;   /* 0x.69c - Receive Byte Counter */
-       u32     rpkt;   /* 0x.6a0 - Receive Packet Counter */
-       u32     rfcs;   /* 0x.6a4 - Receive FCS Error Counter */
-       u32     rmca;   /* 0x.6a8 - Receive Multicast Packet Counter */
-       u32     rbca;   /* 0x.6ac - Receive Broadcast Packet Counter */
-       u32     rxcf;   /* 0x.6b0 - Receive Control Frame Packet Counter */
-       u32     rxpf;   /* 0x.6b4 - Receive Pause Frame Packet Counter */
-       u32     rxuo;   /* 0x.6b8 - Receive Unknown OP Code Counter */
-       u32     raln;   /* 0x.6bc - Receive Alignment Error Counter */
-       u32     rflr;   /* 0x.6c0 - Receive Frame Length Error Counter */
-       u32     rcde;   /* 0x.6c4 - Receive Code Error Counter */
-       u32     rcse;   /* 0x.6c8 - Receive Carrier Sense Error Counter */
-       u32     rund;   /* 0x.6cc - Receive Undersize Packet Counter */
-       u32     rovr;   /* 0x.6d0 - Receive Oversize Packet Counter */
-       u32     rfrg;   /* 0x.6d4 - Receive Fragments Counter */
-       u32     rjbr;   /* 0x.6d8 - Receive Jabber Counter */
-       u32     rdrp;   /* 0x.6dc - Receive Drop Counter */
-       u32     tbyt;   /* 0x.6e0 - Transmit Byte Counter Counter */
-       u32     tpkt;   /* 0x.6e4 - Transmit Packet Counter */
-       u32     tmca;   /* 0x.6e8 - Transmit Multicast Packet Counter */
-       u32     tbca;   /* 0x.6ec - Transmit Broadcast Packet Counter */
-       u32     txpf;   /* 0x.6f0 - Transmit Pause Control Frame Counter */
-       u32     tdfr;   /* 0x.6f4 - Transmit Deferral Packet Counter */
-       u32     tedf;   /* 0x.6f8 - Transmit Excessive Deferral Packet Counter */
-       u32     tscl;   /* 0x.6fc - Transmit Single Collision Packet Counter */
-       u32     tmcl;   /* 0x.700 - Transmit Multiple Collision Packet Counter */
-       u32     tlcl;   /* 0x.704 - Transmit Late Collision Packet Counter */
-       u32     txcl;   /* 0x.708 - Transmit Excessive Collision Packet Counter */
-       u32     tncl;   /* 0x.70c - Transmit Total Collision Counter */
-       u8      res1[4];
-       u32     tdrp;   /* 0x.714 - Transmit Drop Frame Counter */
-       u32     tjbr;   /* 0x.718 - Transmit Jabber Frame Counter */
-       u32     tfcs;   /* 0x.71c - Transmit FCS Error Counter */
-       u32     txcf;   /* 0x.720 - Transmit Control Frame Counter */
-       u32     tovr;   /* 0x.724 - Transmit Oversize Frame Counter */
-       u32     tund;   /* 0x.728 - Transmit Undersize Frame Counter */
-       u32     tfrg;   /* 0x.72c - Transmit Fragments Frame Counter */
-       u32     car1;   /* 0x.730 - Carry Register One */
-       u32     car2;   /* 0x.734 - Carry Register Two */
-       u32     cam1;   /* 0x.738 - Carry Mask Register One */
-       u32     cam2;   /* 0x.73c - Carry Mask Register Two */
-};
-
-struct gfar_extra_stats {
-       u64 kernel_dropped;
-       u64 rx_large;
-       u64 rx_short;
-       u64 rx_nonoctet;
-       u64 rx_crcerr;
-       u64 rx_overrun;
-       u64 rx_bsy;
-       u64 rx_babr;
-       u64 rx_trunc;
-       u64 eberr;
-       u64 tx_babt;
-       u64 tx_underrun;
-       u64 rx_skbmissing;
-       u64 tx_timeout;
-};
-
-#define GFAR_RMON_LEN ((sizeof(struct rmon_mib) - 16)/sizeof(u32))
-#define GFAR_EXTRA_STATS_LEN (sizeof(struct gfar_extra_stats)/sizeof(u64))
-
-/* Number of stats in the stats structure (ignore car and cam regs)*/
-#define GFAR_STATS_LEN (GFAR_RMON_LEN + GFAR_EXTRA_STATS_LEN)
-
-#define GFAR_INFOSTR_LEN 32
-
-struct gfar_stats {
-       u64 extra[GFAR_EXTRA_STATS_LEN];
-       u64 rmon[GFAR_RMON_LEN];
-};
-
-
-struct gfar {
-       u8      res1[16];
-       u32     ievent;                 /* 0x.010 - Interrupt Event Register */
-       u32     imask;                  /* 0x.014 - Interrupt Mask Register */
-       u32     edis;                   /* 0x.018 - Error Disabled Register */
-       u8      res2[4];
-       u32     ecntrl;                 /* 0x.020 - Ethernet Control Register */
-       u32     minflr;                 /* 0x.024 - Minimum Frame Length Register */
-       u32     ptv;                    /* 0x.028 - Pause Time Value Register */
-       u32     dmactrl;                /* 0x.02c - DMA Control Register */
-       u32     tbipa;                  /* 0x.030 - TBI PHY Address Register */
-       u8      res3[88];
-       u32     fifo_tx_thr;            /* 0x.08c - FIFO transmit threshold register */
-       u8      res4[8];
-       u32     fifo_tx_starve;         /* 0x.098 - FIFO transmit starve register */
-       u32     fifo_tx_starve_shutoff; /* 0x.09c - FIFO transmit starve shutoff register */
-       u8      res5[96];
-       u32     tctrl;                  /* 0x.100 - Transmit Control Register */
-       u32     tstat;                  /* 0x.104 - Transmit Status Register */
-       u8      res6[4];
-       u32     tbdlen;                 /* 0x.10c - Transmit Buffer Descriptor Data Length Register */
-       u32     txic;                   /* 0x.110 - Transmit Interrupt Coalescing Configuration Register */
-       u8      res7[16];
-       u32     ctbptr;                 /* 0x.124 - Current Transmit Buffer Descriptor Pointer Register */
-       u8      res8[92];
-       u32     tbptr;                  /* 0x.184 - Transmit Buffer Descriptor Pointer Low Register */
-       u8      res9[124];
-       u32     tbase;                  /* 0x.204 - Transmit Descriptor Base Address Register */
-       u8      res10[168];
-       u32     ostbd;                  /* 0x.2b0 - Out-of-Sequence Transmit Buffer Descriptor Register */
-       u32     ostbdp;                 /* 0x.2b4 - Out-of-Sequence Transmit Data Buffer Pointer Register */
-       u8      res11[72];
-       u32     rctrl;                  /* 0x.300 - Receive Control Register */
-       u32     rstat;                  /* 0x.304 - Receive Status Register */
-       u8      res12[4];
-       u32     rbdlen;                 /* 0x.30c - RxBD Data Length Register */
-       u32     rxic;                   /* 0x.310 - Receive Interrupt Coalescing Configuration Register */
-       u8      res13[16];
-       u32     crbptr;                 /* 0x.324 - Current Receive Buffer Descriptor Pointer */
-       u8      res14[24];
-       u32     mrblr;                  /* 0x.340 - Maximum Receive Buffer Length Register */
-       u8      res15[64];
-       u32     rbptr;                  /* 0x.384 - Receive Buffer Descriptor Pointer */
-       u8      res16[124];
-       u32     rbase;                  /* 0x.404 - Receive Descriptor Base Address */
-       u8      res17[248];
-       u32     maccfg1;                /* 0x.500 - MAC Configuration 1 Register */
-       u32     maccfg2;                /* 0x.504 - MAC Configuration 2 Register */
-       u32     ipgifg;                 /* 0x.508 - Inter Packet Gap/Inter Frame Gap Register */
-       u32     hafdup;                 /* 0x.50c - Half Duplex Register */
-       u32     maxfrm;                 /* 0x.510 - Maximum Frame Length Register */
-       u8      res18[12];
-       u32     miimcfg;                /* 0x.520 - MII Management Configuration Register */
-       u32     miimcom;                /* 0x.524 - MII Management Command Register */
-       u32     miimadd;                /* 0x.528 - MII Management Address Register */
-       u32     miimcon;                /* 0x.52c - MII Management Control Register */
-       u32     miimstat;               /* 0x.530 - MII Management Status Register */
-       u32     miimind;                /* 0x.534 - MII Management Indicator Register */
-       u8      res19[4];
-       u32     ifstat;                 /* 0x.53c - Interface Status Register */
-       u32     macstnaddr1;            /* 0x.540 - Station Address Part 1 Register */
-       u32     macstnaddr2;            /* 0x.544 - Station Address Part 2 Register */
-       u8      res20[312];
-       struct rmon_mib rmon;
-       u8      res21[192];
-       u32     iaddr0;                 /* 0x.800 - Indivdual address register 0 */
-       u32     iaddr1;                 /* 0x.804 - Indivdual address register 1 */
-       u32     iaddr2;                 /* 0x.808 - Indivdual address register 2 */
-       u32     iaddr3;                 /* 0x.80c - Indivdual address register 3 */
-       u32     iaddr4;                 /* 0x.810 - Indivdual address register 4 */
-       u32     iaddr5;                 /* 0x.814 - Indivdual address register 5 */
-       u32     iaddr6;                 /* 0x.818 - Indivdual address register 6 */
-       u32     iaddr7;                 /* 0x.81c - Indivdual address register 7 */
-       u8      res22[96];
-       u32     gaddr0;                 /* 0x.880 - Global address register 0 */
-       u32     gaddr1;                 /* 0x.884 - Global address register 1 */
-       u32     gaddr2;                 /* 0x.888 - Global address register 2 */
-       u32     gaddr3;                 /* 0x.88c - Global address register 3 */
-       u32     gaddr4;                 /* 0x.890 - Global address register 4 */
-       u32     gaddr5;                 /* 0x.894 - Global address register 5 */
-       u32     gaddr6;                 /* 0x.898 - Global address register 6 */
-       u32     gaddr7;                 /* 0x.89c - Global address register 7 */
-       u8      res23[856];
-       u32     attr;                   /* 0x.bf8 - Attributes Register */
-       u32     attreli;                /* 0x.bfc - Attributes Extract Length and Extract Index Register */
-       u8      res24[1024];
-
-};
-
-/* Struct stolen almost completely (and shamelessly) from the FCC enet source
- * (Ok, that's not so true anymore, but there is a family resemblence)
- * The GFAR buffer descriptors track the ring buffers.  The rx_bd_base
- * and tx_bd_base always point to the currently available buffer.
- * The dirty_tx tracks the current buffer that is being sent by the
- * controller.  The cur_tx and dirty_tx are equal under both completely
- * empty and completely full conditions.  The empty/ready indicator in
- * the buffer descriptor determines the actual condition.
- */
-struct gfar_private
-{
-       /* pointers to arrays of skbuffs for tx and rx */
-       struct sk_buff ** tx_skbuff;
-       struct sk_buff ** rx_skbuff;
-
-       /* indices pointing to the next free sbk in skb arrays */
-       u16 skb_curtx;
-       u16 skb_currx;
-
-       /* index of the first skb which hasn't been transmitted
-        * yet. */
-       u16 skb_dirtytx;
-
-       /* Configuration info for the coalescing features */
-       unsigned char txcoalescing;
-       unsigned short txcount;
-       unsigned short txtime;
-       unsigned char rxcoalescing;
-       unsigned short rxcount;
-       unsigned short rxtime;
-
-       /* GFAR addresses */
-       struct rxbd8 *rx_bd_base;       /* Base addresses of Rx and Tx Buffers */
-       struct txbd8 *tx_bd_base;
-       struct rxbd8 *cur_rx;           /* Next free rx ring entry */
-       struct txbd8 *cur_tx;           /* Next free ring entry */
-       struct txbd8 *dirty_tx;         /* The Ring entry to be freed. */
-       struct gfar *regs;      /* Pointer to the GFAR memory mapped Registers */
-       struct phy_info *phyinfo;
-       struct gfar *phyregs;
-       struct work_struct tq;
-       struct timer_list phy_info_timer;
-       struct net_device_stats stats; /* linux network statistics */
-       struct gfar_extra_stats extra_stats;
-       spinlock_t lock;
-       unsigned int rx_buffer_size;
-       unsigned int rx_stash_size;
-       unsigned int tx_ring_size;
-       unsigned int rx_ring_size;
-       wait_queue_head_t rxcleanupq;
-       unsigned int rxclean;
-       int link;       /* current link state */
-       int oldlink;
-       int duplexity; /* Indicates negotiated duplex state */
-       int olddplx;
-       int speed;      /* Indicates negotiated speed */
-       int oldspeed;
-       
-       /* Info structure initialized by board setup code */
-       struct ocp_gfar_data *einfo;
-};
-
-extern inline u32 gfar_read(volatile unsigned *addr)
-{
-       u32 val;
-       val = in_be32(addr);
-       return val;
-}
-
-extern inline void gfar_write(volatile unsigned *addr, u32 val)
-{
-       out_be32(addr, val);
-}
-
-
-
-#endif /* __GIANFAR_H */
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
deleted file mode 100644 (file)
index 4ccb5af..0000000
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * drivers/net/gianfar_ethtool.c
- *
- * Gianfar Ethernet Driver
- * Ethtool support for Gianfar Enet
- * Based on e1000 ethtool support
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
- *
- * Copyright 2004 Freescale Semiconductor, Inc
- *
- * This software may be used and distributed according to 
- * the terms of the GNU Public License, Version 2, incorporated herein 
- * by reference.
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/crc32.h>
-#include <asm/types.h>
-#include <asm/uaccess.h>
-#include <linux/ethtool.h>
-
-#include "gianfar.h"
-
-#define is_power_of_2(x)        ((x) != 0 && (((x) & ((x) - 1)) == 0))
-
-extern int startup_gfar(struct net_device *dev);
-extern void stop_gfar(struct net_device *dev);
-extern void gfar_receive(int irq, void *dev_id, struct pt_regs *regs);
-
-void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
-                    u64 * buf);
-void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf);
-int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
-int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals);
-void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
-int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals);
-void gfar_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo);
-
-static char stat_gstrings[][ETH_GSTRING_LEN] = {
-       "RX Dropped by Kernel",
-       "RX Large Frame Errors",
-       "RX Short Frame Errors",
-       "RX Non-Octet Errors",
-       "RX CRC Errors",
-       "RX Overrun Errors",
-       "RX Busy Errors",
-       "RX Babbling Errors",
-       "RX Truncated Frames",
-       "Ethernet Bus Error",
-       "TX Babbling Errors",
-       "TX Underrun Errors",
-       "RX SKB Missing Errors",
-       "TX Timeout Errors",
-       "tx&rx 64B frames",
-       "tx&rx 65-127B frames",
-       "tx&rx 128-255B frames",
-       "tx&rx 256-511B frames",
-       "tx&rx 512-1023B frames",
-       "tx&rx 1024-1518B frames",
-       "tx&rx 1519-1522B Good VLAN",
-       "RX bytes",
-       "RX Packets",
-       "RX FCS Errors",
-       "Receive Multicast Packet",
-       "Receive Broadcast Packet",
-       "RX Control Frame Packets",
-       "RX Pause Frame Packets",
-       "RX Unknown OP Code",
-       "RX Alignment Error",
-       "RX Frame Length Error",
-       "RX Code Error",
-       "RX Carrier Sense Error",
-       "RX Undersize Packets",
-       "RX Oversize Packets",
-       "RX Fragmented Frames",
-       "RX Jabber Frames",
-       "RX Dropped Frames",
-       "TX Byte Counter",
-       "TX Packets",
-       "TX Multicast Packets",
-       "TX Broadcast Packets",
-       "TX Pause Control Frames",
-       "TX Deferral Packets",
-       "TX Excessive Deferral Packets",
-       "TX Single Collision Packets",
-       "TX Multiple Collision Packets",
-       "TX Late Collision Packets",
-       "TX Excessive Collision Packets",
-       "TX Total Collision",
-       "RESERVED",
-       "TX Dropped Frames",
-       "TX Jabber Frames",
-       "TX FCS Errors",
-       "TX Control Frames",
-       "TX Oversize Frames",
-       "TX Undersize Frames",
-       "TX Fragmented Frames",
-};
-
-/* Fill in an array of 64-bit statistics from various sources.
- * This array will be appended to the end of the ethtool_stats
- * structure, and returned to user space
- */
-void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy, u64 * buf)
-{
-       int i;
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       u32 *rmon = (u32 *) & priv->regs->rmon;
-       u64 *extra = (u64 *) & priv->extra_stats;
-       struct gfar_stats *stats = (struct gfar_stats *) buf;
-
-       for (i = 0; i < GFAR_RMON_LEN; i++) {
-               stats->rmon[i] = (u64) (rmon[i]);
-       }
-
-       for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) {
-               stats->extra[i] = extra[i];
-       }
-}
-
-/* Returns the number of stats (and their corresponding strings) */
-int gfar_stats_count(struct net_device *dev)
-{
-       return GFAR_STATS_LEN;
-}
-
-void gfar_gstrings_normon(struct net_device *dev, u32 stringset, u8 * buf)
-{
-       memcpy(buf, stat_gstrings, GFAR_EXTRA_STATS_LEN * ETH_GSTRING_LEN);
-}
-
-void gfar_fill_stats_normon(struct net_device *dev, 
-               struct ethtool_stats *dummy, u64 * buf)
-{
-       int i;
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       u64 *extra = (u64 *) & priv->extra_stats;
-
-       for (i = 0; i < GFAR_EXTRA_STATS_LEN; i++) {
-               buf[i] = extra[i];
-       }
-}
-
-
-int gfar_stats_count_normon(struct net_device *dev)
-{
-       return GFAR_EXTRA_STATS_LEN;
-}
-/* Fills in the drvinfo structure with some basic info */
-void gfar_gdrvinfo(struct net_device *dev, struct
-             ethtool_drvinfo *drvinfo)
-{
-       strncpy(drvinfo->driver, gfar_driver_name, GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN);
-       strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN);
-       drvinfo->n_stats = GFAR_STATS_LEN;
-       drvinfo->testinfo_len = 0;
-       drvinfo->regdump_len = 0;
-       drvinfo->eedump_len = 0;
-}
-
-/* Return the current settings in the ethtool_cmd structure */
-int gfar_gsettings(struct net_device *dev, struct ethtool_cmd *cmd)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       uint gigabit_support = 
-               priv->einfo->flags & GFAR_HAS_GIGABIT ? SUPPORTED_1000baseT_Full : 0;
-       uint gigabit_advert = 
-               priv->einfo->flags & GFAR_HAS_GIGABIT ? ADVERTISED_1000baseT_Full: 0;
-
-       cmd->supported = (SUPPORTED_10baseT_Half
-                         | SUPPORTED_100baseT_Half
-                         | SUPPORTED_100baseT_Full
-                         | gigabit_support | SUPPORTED_Autoneg);
-
-       /* For now, we always advertise everything */
-       cmd->advertising = (ADVERTISED_10baseT_Half
-                           | ADVERTISED_100baseT_Half
-                           | ADVERTISED_100baseT_Full
-                           | gigabit_advert | ADVERTISED_Autoneg);
-
-       cmd->speed = priv->speed;
-       cmd->duplex = priv->duplexity;
-       cmd->port = PORT_MII;
-       cmd->phy_address = priv->einfo->phyid;
-       cmd->transceiver = XCVR_EXTERNAL;
-       cmd->autoneg = AUTONEG_ENABLE;
-       cmd->maxtxpkt = priv->txcount;
-       cmd->maxrxpkt = priv->rxcount;
-
-       return 0;
-}
-
-/* Return the length of the register structure */
-int gfar_reglen(struct net_device *dev)
-{
-       return sizeof (struct gfar);
-}
-
-/* Return a dump of the GFAR register space */
-void gfar_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *regbuf)
-{
-       int i;
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       u32 *theregs = (u32 *) priv->regs;
-       u32 *buf = (u32 *) regbuf;
-
-       for (i = 0; i < sizeof (struct gfar) / sizeof (u32); i++)
-               buf[i] = theregs[i];
-}
-
-/* Return the link state 1 is up, 0 is down */
-u32 gfar_get_link(struct net_device *dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       return (u32) priv->link;
-}
-
-/* Fill in a buffer with the strings which correspond to the
- * stats */
-void gfar_gstrings(struct net_device *dev, u32 stringset, u8 * buf)
-{
-       memcpy(buf, stat_gstrings, GFAR_STATS_LEN * ETH_GSTRING_LEN);
-}
-
-/* Convert microseconds to ethernet clock ticks, which changes
- * depending on what speed the controller is running at */
-static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int usecs)
-{
-       unsigned int count;
-
-       /* The timer is different, depending on the interface speed */
-       switch (priv->speed) {
-       case 1000:
-               count = GFAR_GBIT_TIME;
-               break;
-       case 100:
-               count = GFAR_100_TIME;
-               break;
-       case 10:
-       default:
-               count = GFAR_10_TIME;
-               break;
-       }
-
-       /* Make sure we return a number greater than 0
-        * if usecs > 0 */
-       return ((usecs * 1000 + count - 1) / count);
-}
-
-/* Convert ethernet clock ticks to microseconds */
-static unsigned int gfar_ticks2usecs(struct gfar_private *priv, unsigned int ticks)
-{
-       unsigned int count;
-
-       /* The timer is different, depending on the interface speed */
-       switch (priv->speed) {
-       case 1000:
-               count = GFAR_GBIT_TIME;
-               break;
-       case 100:
-               count = GFAR_100_TIME;
-               break;
-       case 10:
-       default:
-               count = GFAR_10_TIME;
-               break;
-       }
-
-       /* Make sure we return a number greater than 0 */
-       /* if ticks is > 0 */
-       return ((ticks * count) / 1000);
-}
-
-/* Get the coalescing parameters, and put them in the cvals
- * structure.  */
-int gfar_gcoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       cvals->rx_coalesce_usecs = gfar_ticks2usecs(priv, priv->rxtime);
-       cvals->rx_max_coalesced_frames = priv->rxcount;
-
-       cvals->tx_coalesce_usecs = gfar_ticks2usecs(priv, priv->txtime);
-       cvals->tx_max_coalesced_frames = priv->txcount;
-
-       cvals->use_adaptive_rx_coalesce = 0;
-       cvals->use_adaptive_tx_coalesce = 0;
-
-       cvals->pkt_rate_low = 0;
-       cvals->rx_coalesce_usecs_low = 0;
-       cvals->rx_max_coalesced_frames_low = 0;
-       cvals->tx_coalesce_usecs_low = 0;
-       cvals->tx_max_coalesced_frames_low = 0;
-
-       /* When the packet rate is below pkt_rate_high but above
-        * pkt_rate_low (both measured in packets per second) the
-        * normal {rx,tx}_* coalescing parameters are used.
-        */
-
-       /* When the packet rate is (measured in packets per second)
-        * is above pkt_rate_high, the {rx,tx}_*_high parameters are
-        * used.
-        */
-       cvals->pkt_rate_high = 0;
-       cvals->rx_coalesce_usecs_high = 0;
-       cvals->rx_max_coalesced_frames_high = 0;
-       cvals->tx_coalesce_usecs_high = 0;
-       cvals->tx_max_coalesced_frames_high = 0;
-
-       /* How often to do adaptive coalescing packet rate sampling,
-        * measured in seconds.  Must not be zero.
-        */
-       cvals->rate_sample_interval = 0;
-
-       return 0;
-}
-
-/* Change the coalescing values.
- * Both cvals->*_usecs and cvals->*_frames have to be > 0
- * in order for coalescing to be active
- */
-int gfar_scoalesce(struct net_device *dev, struct ethtool_coalesce *cvals)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       /* Set up rx coalescing */
-       if ((cvals->rx_coalesce_usecs == 0) ||
-           (cvals->rx_max_coalesced_frames == 0))
-               priv->rxcoalescing = 0;
-       else
-               priv->rxcoalescing = 1;
-
-       priv->rxtime = gfar_usecs2ticks(priv, cvals->rx_coalesce_usecs);
-       priv->rxcount = cvals->rx_max_coalesced_frames;
-
-       /* Set up tx coalescing */
-       if ((cvals->tx_coalesce_usecs == 0) ||
-           (cvals->tx_max_coalesced_frames == 0))
-               priv->txcoalescing = 0;
-       else
-               priv->txcoalescing = 1;
-
-       priv->txtime = gfar_usecs2ticks(priv, cvals->tx_coalesce_usecs);
-       priv->txcount = cvals->tx_max_coalesced_frames;
-
-       if (priv->rxcoalescing)
-               gfar_write(&priv->regs->rxic,
-                          mk_ic_value(priv->rxcount, priv->rxtime));
-       else
-               gfar_write(&priv->regs->rxic, 0);
-
-       if (priv->txcoalescing)
-               gfar_write(&priv->regs->txic,
-                          mk_ic_value(priv->txcount, priv->txtime));
-       else
-               gfar_write(&priv->regs->txic, 0);
-
-       return 0;
-}
-
-/* Fills in rvals with the current ring parameters.  Currently,
- * rx, rx_mini, and rx_jumbo rings are the same size, as mini and
- * jumbo are ignored by the driver */
-void gfar_gringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       rvals->rx_max_pending = GFAR_RX_MAX_RING_SIZE;
-       rvals->rx_mini_max_pending = GFAR_RX_MAX_RING_SIZE;
-       rvals->rx_jumbo_max_pending = GFAR_RX_MAX_RING_SIZE;
-       rvals->tx_max_pending = GFAR_TX_MAX_RING_SIZE;
-
-       /* Values changeable by the user.  The valid values are
-        * in the range 1 to the "*_max_pending" counterpart above.
-        */
-       rvals->rx_pending = priv->rx_ring_size;
-       rvals->rx_mini_pending = priv->rx_ring_size;
-       rvals->rx_jumbo_pending = priv->rx_ring_size;
-       rvals->tx_pending = priv->tx_ring_size;
-}
-
-/* Change the current ring parameters, stopping the controller if
- * necessary so that we don't mess things up while we're in
- * motion.  We wait for the ring to be clean before reallocating
- * the rings. */
-int gfar_sringparam(struct net_device *dev, struct ethtool_ringparam *rvals)
-{
-       u32 tempval;
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       int err = 0;
-
-       if (rvals->rx_pending > GFAR_RX_MAX_RING_SIZE)
-               return -EINVAL;
-
-       if (!is_power_of_2(rvals->rx_pending)) {
-               printk("%s: Ring sizes must be a power of 2\n",
-                               dev->name);
-               return -EINVAL;
-       }
-
-       if (rvals->tx_pending > GFAR_TX_MAX_RING_SIZE)
-               return -EINVAL;
-
-       if (!is_power_of_2(rvals->tx_pending)) {
-               printk("%s: Ring sizes must be a power of 2\n",
-                               dev->name);
-               return -EINVAL;
-       }
-
-       /* Stop the controller so we don't rx any more frames */
-       /* But first, make sure we clear the bits */
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval &= ~(DMACTRL_GRS | DMACTRL_GTS);
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       tempval = gfar_read(&priv->regs->dmactrl);
-       tempval |= (DMACTRL_GRS | DMACTRL_GTS);
-       gfar_write(&priv->regs->dmactrl, tempval);
-
-       while (!(gfar_read(&priv->regs->ievent) & (IEVENT_GRSC | IEVENT_GTSC)))
-               cpu_relax();
-
-       /* Note that rx is not clean right now */
-       priv->rxclean = 0;
-
-       if (dev->flags & IFF_UP) {
-               /* Tell the driver to process the rest of the frames */
-               gfar_receive(0, (void *) dev, NULL);
-
-               /* Now wait for it to be done */
-               wait_event_interruptible(priv->rxcleanupq, priv->rxclean);
-
-               /* Ok, all packets have been handled.  Now we bring it down,
-                * change the ring size, and bring it up */
-
-               stop_gfar(dev);
-       }
-
-       priv->rx_ring_size = rvals->rx_pending;
-       priv->tx_ring_size = rvals->tx_pending;
-
-       if (dev->flags & IFF_UP)
-               err = startup_gfar(dev);
-
-       return err;
-}
-
-struct ethtool_ops gfar_ethtool_ops = {
-       .get_settings = gfar_gsettings,
-       .get_drvinfo = gfar_gdrvinfo,
-       .get_regs_len = gfar_reglen,
-       .get_regs = gfar_get_regs,
-       .get_link = gfar_get_link,
-       .get_coalesce = gfar_gcoalesce,
-       .set_coalesce = gfar_scoalesce,
-       .get_ringparam = gfar_gringparam,
-       .set_ringparam = gfar_sringparam,
-       .get_strings = gfar_gstrings,
-       .get_stats_count = gfar_stats_count,
-       .get_ethtool_stats = gfar_fill_stats,
-};
diff --git a/drivers/net/gianfar_phy.c b/drivers/net/gianfar_phy.c
deleted file mode 100644 (file)
index ea02e5d..0000000
+++ /dev/null
@@ -1,622 +0,0 @@
-/* 
- * drivers/net/gianfar_phy.c
- *
- * Gianfar Ethernet Driver -- PHY handling
- * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560
- * Based on 8260_io/fcc_enet.c
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
- *
- * Copyright 2004 Freescale Semiconductor, Inc
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include <linux/config.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-#include <linux/mii.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/crc32.h>
-
-#include "gianfar.h"
-#include "gianfar_phy.h"
-
-/* Write value to the PHY for this device to the register at regnum, */
-/* waiting until the write is done before it returns.  All PHY */
-/* configuration has to be done through the TSEC1 MIIM regs */
-void write_phy_reg(struct net_device *dev, u16 regnum, u16 value)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       struct gfar *regbase = priv->phyregs;
-       struct ocp_gfar_data *einfo = priv->einfo;
-
-       /* Set the PHY address and the register address we want to write */
-       gfar_write(&regbase->miimadd, ((einfo->phyid) << 8) | regnum);
-
-       /* Write out the value we want */
-       gfar_write(&regbase->miimcon, value);
-
-       /* Wait for the transaction to finish */
-       while (gfar_read(&regbase->miimind) & MIIMIND_BUSY)
-               cpu_relax();
-}
-
-/* Reads from register regnum in the PHY for device dev, */
-/* returning the value.  Clears miimcom first.  All PHY */
-/* configuration has to be done through the TSEC1 MIIM regs */
-u16 read_phy_reg(struct net_device *dev, u16 regnum)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       struct gfar *regbase = priv->phyregs;
-       struct ocp_gfar_data *einfo = priv->einfo;
-       u16 value;
-
-       /* Set the PHY address and the register address we want to read */
-       gfar_write(&regbase->miimadd, ((einfo->phyid) << 8) | regnum);
-
-       /* Clear miimcom, and then initiate a read */
-       gfar_write(&regbase->miimcom, 0);
-       gfar_write(&regbase->miimcom, MIIM_READ_COMMAND);
-
-       /* Wait for the transaction to finish */
-       while (gfar_read(&regbase->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))
-               cpu_relax();
-
-       /* Grab the value of the register from miimstat */
-       value = gfar_read(&regbase->miimstat);
-
-       return value;
-}
-
-/* returns which value to write to the control register. */
-/* For 10/100 the value is slightly different. */
-u16 mii_cr_init(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       struct ocp_gfar_data *einfo = priv->einfo;
-
-       if (einfo->flags & GFAR_HAS_GIGABIT)
-               return MIIM_CONTROL_INIT;
-       else
-               return MIIM_CR_INIT;
-}
-
-#define BRIEF_GFAR_ERRORS
-/* Wait for auto-negotiation to complete */
-u16 mii_parse_sr(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       unsigned int timeout = GFAR_AN_TIMEOUT;
-
-       if (mii_reg & MIIM_STATUS_LINK)
-               priv->link = 1;
-       else
-               priv->link = 0;
-
-       /* Only auto-negotiate if the link has just gone up */
-       if (priv->link && !priv->oldlink) {
-               while ((!(mii_reg & MIIM_STATUS_AN_DONE)) && timeout--)
-                       mii_reg = read_phy_reg(dev, MIIM_STATUS);
-
-#if defined(BRIEF_GFAR_ERRORS)
-               if (mii_reg & MIIM_STATUS_AN_DONE)
-                       printk(KERN_INFO "%s: Auto-negotiation done\n",
-                              dev->name);
-               else
-                       printk(KERN_INFO "%s: Auto-negotiation timed out\n",
-                              dev->name);
-#endif
-       }
-
-       return 0;
-}
-
-/* Determine the speed and duplex which was negotiated */
-u16 mii_parse_88E1011_psr(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       unsigned int speed;
-
-       if (priv->link) {
-               if (mii_reg & MIIM_88E1011_PHYSTAT_DUPLEX)
-                       priv->duplexity = 1;
-               else
-                       priv->duplexity = 0;
-
-               speed = (mii_reg & MIIM_88E1011_PHYSTAT_SPEED);
-
-               switch (speed) {
-               case MIIM_88E1011_PHYSTAT_GBIT:
-                       priv->speed = 1000;
-                       break;
-               case MIIM_88E1011_PHYSTAT_100:
-                       priv->speed = 100;
-                       break;
-               default:
-                       priv->speed = 10;
-                       break;
-               }
-       } else {
-               priv->speed = 0;
-               priv->duplexity = 0;
-       }
-
-       return 0;
-}
-
-u16 mii_parse_cis8201(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       unsigned int speed;
-
-       if (priv->link) {
-               if (mii_reg & MIIM_CIS8201_AUXCONSTAT_DUPLEX)
-                       priv->duplexity = 1;
-               else
-                       priv->duplexity = 0;
-
-               speed = mii_reg & MIIM_CIS8201_AUXCONSTAT_SPEED;
-
-               switch (speed) {
-               case MIIM_CIS8201_AUXCONSTAT_GBIT:
-                       priv->speed = 1000;
-                       break;
-               case MIIM_CIS8201_AUXCONSTAT_100:
-                       priv->speed = 100;
-                       break;
-               default:
-                       priv->speed = 10;
-                       break;
-               }
-       } else {
-               priv->speed = 0;
-               priv->duplexity = 0;
-       }
-
-       return 0;
-}
-
-u16 mii_parse_dm9161_scsr(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       if (mii_reg & (MIIM_DM9161_SCSR_100F | MIIM_DM9161_SCSR_100H))
-               priv->speed = 100;
-       else
-               priv->speed = 10;
-
-       if (mii_reg & (MIIM_DM9161_SCSR_100F | MIIM_DM9161_SCSR_10F))
-               priv->duplexity = 1;
-       else
-               priv->duplexity = 0;
-
-       return 0;
-}
-
-u16 dm9161_wait(u16 mii_reg, struct net_device *dev)
-{
-       int timeout = HZ;
-       int secondary = 10;
-       u16 temp;
-
-       do {
-
-               /* Davicom takes a bit to come up after a reset,
-                * so wait here for a bit */
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(timeout);
-
-               temp = read_phy_reg(dev, MIIM_STATUS);
-
-               secondary--;
-       } while ((!(temp & MIIM_STATUS_AN_DONE)) && secondary);
-
-       return 0;
-}
-
-/*
- * consult the BCM54xx auxilliary status register to find the link settings
- */
-u16 mii_parse_bcm54xx_sr(u16 mii_reg, struct net_device * dev)
-{
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-
-       /* Link modes of the BCM5400 PHY */
-       static const uint16_t link_table[8][3] = {
-               { 0, 0          },      /* No link */
-               { 0, 10         },      /* 10BT Half Duplex */
-               { 1, 10         },      /* 10BT Full Duplex */
-               { 0, 100        },      /* 100BT Half Duplex */
-               { 0, 100        },      /* 100BT Half Duplex */
-               { 1, 100        },      /* 100BT Full Duplex*/
-               { 1, 1000       },      /* 1000BT */
-               { 1, 1000       },      /* 1000BT */
-       };
-
-       uint16_t link_mode;
-
-       link_mode = mii_reg & MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK;
-       link_mode >>= MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT;
-
-       priv->duplexity = link_table[link_mode][0];
-       priv->speed = link_table[link_mode][1];
-
-       return 0;
-}
-
-static struct phy_info phy_info_M88E1011S = {
-       0x01410c6,
-       "Marvell 88E1011S",
-       4,
-       (const struct phy_cmd[]) {      /* config */
-               /* Reset and configure the PHY */
-               {MIIM_CONTROL, MIIM_CONTROL_INIT, mii_cr_init},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* startup */
-               /* Status is read once to clear old link state */
-               {MIIM_STATUS, miim_read, NULL},
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               /* Read the status */
-               {MIIM_88E1011_PHY_STATUS, miim_read, mii_parse_88E1011_psr},
-               /* Clear the IEVENT register */
-               {MIIM_88E1011_IEVENT, miim_read, NULL},
-               /* Set up the mask */
-               {MIIM_88E1011_IMASK, MIIM_88E1011_IMASK_INIT, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* ack_int */
-               /* Clear the interrupt */
-               {MIIM_88E1011_IEVENT, miim_read, NULL},
-               /* Disable interrupts */
-               {MIIM_88E1011_IMASK, MIIM_88E1011_IMASK_CLEAR, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* handle_int */
-               /* Read the Status (2x to make sure link is right) */
-               {MIIM_STATUS, miim_read, NULL},
-               /* Check the status */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               {MIIM_88E1011_PHY_STATUS, miim_read, mii_parse_88E1011_psr},
-                       /* Enable Interrupts */
-               {MIIM_88E1011_IMASK, MIIM_88E1011_IMASK_INIT, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* shutdown */
-               {MIIM_88E1011_IEVENT, miim_read, NULL},
-               {MIIM_88E1011_IMASK, MIIM_88E1011_IMASK_CLEAR, NULL},
-               {miim_end,}
-       },
-};
-
-/* Cicada 8204 */
-static struct phy_info phy_info_cis8204 = {
-       0x3f11,
-       "Cicada Cis8204",
-       6,
-       (const struct phy_cmd[]) {      /* config */
-               /* Override PHY config settings */
-               {MIIM_CIS8201_AUX_CONSTAT, MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
-               /* Set up the interface mode */
-               {MIIM_CIS8201_EXT_CON1, MIIM_CIS8201_EXTCON1_INIT, NULL},
-               /* Configure some basic stuff */
-               {MIIM_CONTROL, MIIM_CONTROL_INIT, mii_cr_init},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* startup */
-               /* Read the Status (2x to make sure link is right) */
-               {MIIM_STATUS, miim_read, NULL},
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               /* Read the status */
-               {MIIM_CIS8201_AUX_CONSTAT, miim_read, mii_parse_cis8201},
-               /* Clear the status register */
-               {MIIM_CIS8204_ISTAT, miim_read, NULL},
-               /* Enable interrupts */
-               {MIIM_CIS8204_IMASK, MIIM_CIS8204_IMASK_MASK, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* ack_int */
-               /* Clear the status register */
-               {MIIM_CIS8204_ISTAT, miim_read, NULL},
-               /* Disable interrupts */
-               {MIIM_CIS8204_IMASK, 0x0, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* handle_int */
-               /* Read the Status (2x to make sure link is right) */
-               {MIIM_STATUS, miim_read, NULL},
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               /* Read the status */
-               {MIIM_CIS8201_AUX_CONSTAT, miim_read, mii_parse_cis8201},
-               /* Enable interrupts */
-               {MIIM_CIS8204_IMASK, MIIM_CIS8204_IMASK_MASK, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* shutdown */
-               /* Clear the status register */
-               {MIIM_CIS8204_ISTAT, miim_read, NULL},
-               /* Disable interrupts */
-               {MIIM_CIS8204_IMASK, 0x0, NULL},
-               {miim_end,}
-       },
-};
-
-/* Cicada 8201 */
-static struct phy_info phy_info_cis8201 = {
-       0xfc41,
-       "CIS8201",
-       4,
-       (const struct phy_cmd[]) {      /* config */
-               /* Override PHY config settings */
-               {MIIM_CIS8201_AUX_CONSTAT, MIIM_CIS8201_AUXCONSTAT_INIT, NULL},
-               /* Set up the interface mode */
-               {MIIM_CIS8201_EXT_CON1, MIIM_CIS8201_EXTCON1_INIT, NULL},
-               /* Configure some basic stuff */
-               {MIIM_CONTROL, MIIM_CONTROL_INIT, mii_cr_init},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* startup */
-               /* Read the Status (2x to make sure link is right) */
-               {MIIM_STATUS, miim_read, NULL},
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               /* Read the status */
-               {MIIM_CIS8201_AUX_CONSTAT, miim_read, mii_parse_cis8201},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* ack_int */
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* handle_int */
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* shutdown */
-               {miim_end,}
-       },
-};
-
-static struct phy_info phy_info_dm9161 = {
-       0x0181b88,
-       "Davicom DM9161E",
-       4,
-       (const struct phy_cmd[]) {      /* config */
-               {MIIM_CONTROL, MIIM_DM9161_CR_STOP, NULL},
-               /* Do not bypass the scrambler/descrambler */
-               {MIIM_DM9161_SCR, MIIM_DM9161_SCR_INIT, NULL},
-               /* Clear 10BTCSR to default */
-               {MIIM_DM9161_10BTCSR, MIIM_DM9161_10BTCSR_INIT, NULL},
-               /* Configure some basic stuff */
-               {MIIM_CONTROL, MIIM_CR_INIT, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* startup */
-               /* Restart Auto Negotiation */
-               {MIIM_CONTROL, MIIM_DM9161_CR_RSTAN, NULL},
-               /* Status is read once to clear old link state */
-               {MIIM_STATUS, miim_read, dm9161_wait},
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               /* Read the status */
-               {MIIM_DM9161_SCSR, miim_read, mii_parse_dm9161_scsr},
-               /* Clear any pending interrupts */
-               {MIIM_DM9161_INTR, miim_read, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* ack_int */
-               {MIIM_DM9161_INTR, miim_read, NULL},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* handle_int */
-               {MIIM_STATUS, miim_read, NULL},
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               {MIIM_DM9161_SCSR, miim_read, mii_parse_dm9161_scsr},
-               {miim_end,}
-       },
-       (const struct phy_cmd[]) {      /* shutdown */
-               {MIIM_DM9161_INTR, miim_read, NULL},
-               {miim_end,}
-       },
-};
-
-/* Broadcom BCM5421S PHY */
-static struct phy_info phy_info_bcm5421s = {
-       .id = 0x2060E1,
-       .name = "Broadcom BCM5421S",
-       .shift = 0,
-       .config = (const struct phy_cmd[]) {
-               /* Configure some basic stuff */
-               {MIIM_CONTROL, MIIM_CR_INIT, NULL},
-#if 0 /* 5421 only */
-               miim_write(MII_BCM5400_AUXCONTROL, 0x1007),
-               miim_set_bits(MII_BCM5400_AUXCONTROL, 0x0400),
-               miim_write(MII_BCM5400_AUXCONTROL, 0x0007),
-               miim_set_bits(MII_BCM5400_AUXCONTROL, 0x0800),
-               miim_write(0x17, 0x000a),
-               miim_set_bits(MII_RERRCOUNTER, 0x0200),
-#endif
-#if 0 /* enable automatic low power */
-               miim_write(MII_NCONFIG, 0x9002),
-               miim_write(MII_NCONFIG, 0xa821),
-               miim_write(MII_NCONFIG, 0x941d),
-#endif
-               {miim_end,}
-       },
-       .startup = (const struct phy_cmd[]) {
-               /* Restart Auto Negotiation */
-               miim_set_bits(MIIM_CONTROL, BMCR_ANENABLE | BMCR_ANRESTART),
-#if 0
-               /* Status is read once to clear old link state */
-               {MIIM_STATUS, miim_read, dm9161_wait},
-#endif
-               /* Auto-negotiate */
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-
-               /* Read the link status */
-               {MIIM_BCM54xx_AUXSTATUS, miim_read, mii_parse_bcm54xx_sr},
-
-               {miim_end,}
-       },
-       .ack_int = (const struct phy_cmd[]) {
-               {miim_end,}
-       },
-       .handle_int = (const struct phy_cmd[]) {
-               {MIIM_STATUS, miim_read, NULL},
-               {MIIM_STATUS, miim_read, mii_parse_sr},
-               {miim_end,}
-       },
-       .shutdown = (const struct phy_cmd[]) {
-               {miim_end,}
-       },
-};
-
-static struct phy_info *phy_info[] = {
-       &phy_info_cis8201,
-       &phy_info_cis8204,
-       &phy_info_M88E1011S,
-       &phy_info_dm9161,
-       &phy_info_bcm5421s,
-       NULL
-};
-
-/* Use the PHY ID registers to determine what type of PHY is attached
- * to device dev.  return a struct phy_info structure describing that PHY
- */
-struct phy_info * get_phy_info(struct net_device *dev)
-{
-       u16 phy_reg;
-       u32 phy_ID;
-       int i;
-       struct phy_info *theInfo = NULL;
-
-       /* Grab the bits from PHYIR1, and put them in the upper half */
-       phy_reg = read_phy_reg(dev, MIIM_PHYIR1);
-       phy_ID = (phy_reg & 0xffff) << 16;
-
-       /* Grab the bits from PHYIR2, and put them in the lower half */
-       phy_reg = read_phy_reg(dev, MIIM_PHYIR2);
-       phy_ID |= (phy_reg & 0xffff);
-
-       /* loop through all the known PHY types, and find one that */
-       /* matches the ID we read from the PHY. */
-       for (i = 0; phy_info[i]; i++)
-               if (phy_info[i]->id == (phy_ID >> phy_info[i]->shift))
-                       theInfo = phy_info[i];
-
-       if (theInfo == NULL) {
-               printk("%s: PHY id %x is not supported!\n", dev->name, phy_ID);
-               return NULL;
-       } else {
-               printk("%s: PHY is %s (%x)\n", dev->name, theInfo->name,
-                      phy_ID);
-       }
-
-       return theInfo;
-}
-
-/* Take a list of struct phy_cmd, and, depending on the values, either */
-/* read or write, using a helper function if provided */
-/* It is assumed that all lists of struct phy_cmd will be terminated by */
-/* mii_end. */
-void phy_run_commands(struct net_device *dev, const struct phy_cmd *cmd)
-{
-       int i;
-       u16 result;
-       struct gfar_private *priv = (struct gfar_private *) dev->priv;
-       struct gfar *phyregs = priv->phyregs;
-
-       /* Reset the management interface */
-       gfar_write(&phyregs->miimcfg, MIIMCFG_RESET);
-
-       /* Setup the MII Mgmt clock speed */
-       gfar_write(&phyregs->miimcfg, MIIMCFG_INIT_VALUE);
-
-       /* Wait until the bus is free */
-       while (gfar_read(&phyregs->miimind) & MIIMIND_BUSY)
-               cpu_relax();
-
-       for (i = 0; cmd->mii_reg != miim_end; i++) {
-               switch (cmd->mii_data >> 16) {
-               case 0x0000:
-                       /* Otherwise, it's a write */
-                       /* If a function was supplied, it will provide 
-                        * the value to write */
-                       /* Otherwise, the value was supplied in cmd->mii_data */
-                       if (cmd->funct != NULL)
-                               result = (*(cmd->funct)) (0, dev);
-                       else
-                               result = cmd->mii_data;
-
-                       write_phy_reg(dev, cmd->mii_reg, result);
-                       break;
-
-               case 0x0001:
-                       /* Read the value of the PHY reg */
-                       result = read_phy_reg(dev, cmd->mii_reg);
-
-                       /* If a function was supplied, we need to let it process */
-                       /* the result. */
-                       if (cmd->funct != NULL)
-                               (*(cmd->funct)) (result, dev);
-                       break;
-
-               case 0x0002:
-                       /* read the value, clear some bits and write it back */
-                       BUG_ON(cmd->funct);
-
-                       result = read_phy_reg(dev, cmd->mii_reg);
-                       result &= cmd->mii_data;
-                       write_phy_reg(dev, cmd->mii_reg, result);
-                       break;
-
-               case 0x0003:
-                       /* read the value, set some bits and write it back */
-                       BUG_ON(cmd->funct);
-
-                       result = read_phy_reg(dev, cmd->mii_reg);
-                       result &= cmd->mii_data;
-                       write_phy_reg(dev, cmd->mii_reg, result);
-                       break;
-
-               case 0x0004:
-                       /* read the value, flip some bits and write it back */
-                       BUG_ON(cmd->funct);
-
-                       result = read_phy_reg(dev, cmd->mii_reg);
-                       result &= cmd->mii_data;
-                       write_phy_reg(dev, cmd->mii_reg, result);
-                       break;
-
-               default:
-                       printk("GIANFAR: Unknown MII command %08x\n",
-                              cmd->mii_data);
-                       BUG();
-               }
-               cmd++;
-       }
-}
diff --git a/drivers/net/gianfar_phy.h b/drivers/net/gianfar_phy.h
deleted file mode 100644 (file)
index df4c0ec..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/* 
- * drivers/net/gianfar_phy.h
- *
- * Gianfar Ethernet Driver -- PHY handling
- * Driver for FEC on MPC8540 and TSEC on MPC8540/MPC8560
- * Based on 8260_io/fcc_enet.c
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
- *
- * Copyright 2004 Freescale Semiconductor, Inc
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-#ifndef __GIANFAR_PHY_H
-#define __GIANFAR_PHY_H
-
-/* simple datum processing commands */
-#define miim_end               (0xffff0000U)
-#define miim_read              (0x00010000U)
-#define miim_clear_bits(reg,x) { reg, (0x00020000U | ~(u32)(x)), NULL }
-#define miim_set_bits(reg,x)   { reg, (0x00030000U | (u32)(x)),  NULL }
-#define miim_flip_bits(reg,x)  { reg, (0x00040000U | (u32)(x)),  NULL }
-#define miim_write(reg, x)     { reg, (0x0000ffffU & (u32)(x)),  NULL }
-
-#define MIIMIND_BUSY            0x00000001
-#define MIIMIND_NOTVALID        0x00000004
-
-#define MIIM_CONTROL           0x00
-#define MIIM_CONTROL_RESET     0x00008000
-#define MIIM_CONTROL_INIT      0x00001140
-#define MIIM_ANEN              0x00001000
-
-#define MIIM_CR                 0x00
-#define MIIM_CR_RST            0x00008000
-#define MIIM_CR_INIT           0x00001000
-
-#define MIIM_STATUS            0x1
-#define MIIM_STATUS_AN_DONE    0x00000020
-#define MIIM_STATUS_LINK       0x0004
-
-#define MIIM_PHYIR1            0x2
-#define MIIM_PHYIR2            0x3
-
-#define GFAR_AN_TIMEOUT         0x000fffff
-
-#define MIIM_ANLPBPA   0x5
-#define MIIM_ANLPBPA_HALF      0x00000040
-#define MIIM_ANLPBPA_FULL      0x00000020
-
-#define MIIM_ANEX              0x6
-#define MIIM_ANEX_NP           0x00000004
-#define MIIM_ANEX_PRX          0x00000002
-
-
-/* Cicada Extended Control Register 1 */
-#define MIIM_CIS8201_EXT_CON1           0x17
-#define MIIM_CIS8201_EXTCON1_INIT       0x0000
-
-/* Cicada Interrupt Mask Register */
-#define MIIM_CIS8204_IMASK             0x19
-#define MIIM_CIS8204_IMASK_IEN         0x8000
-#define MIIM_CIS8204_IMASK_SPEED       0x4000
-#define MIIM_CIS8204_IMASK_LINK                0x2000
-#define MIIM_CIS8204_IMASK_DUPLEX      0x1000
-#define MIIM_CIS8204_IMASK_MASK                0xf000
-
-/* Cicada Interrupt Status Register */
-#define MIIM_CIS8204_ISTAT             0x1a
-#define MIIM_CIS8204_ISTAT_STATUS      0x8000
-#define MIIM_CIS8204_ISTAT_SPEED       0x4000
-#define MIIM_CIS8204_ISTAT_LINK                0x2000
-#define MIIM_CIS8204_ISTAT_DUPLEX      0x1000
-
-/* Cicada Auxiliary Control/Status Register */
-#define MIIM_CIS8201_AUX_CONSTAT        0x1c
-#define MIIM_CIS8201_AUXCONSTAT_INIT    0x0004
-#define MIIM_CIS8201_AUXCONSTAT_DUPLEX  0x0020
-#define MIIM_CIS8201_AUXCONSTAT_SPEED   0x0018
-#define MIIM_CIS8201_AUXCONSTAT_GBIT    0x0010
-#define MIIM_CIS8201_AUXCONSTAT_100     0x0008
-                                                                                
-/* 88E1011 PHY Status Register */
-#define MIIM_88E1011_PHY_STATUS         0x11
-#define MIIM_88E1011_PHYSTAT_SPEED      0xc000
-#define MIIM_88E1011_PHYSTAT_GBIT       0x8000
-#define MIIM_88E1011_PHYSTAT_100        0x4000
-#define MIIM_88E1011_PHYSTAT_DUPLEX     0x2000
-#define MIIM_88E1011_PHYSTAT_LINK      0x0400
-
-#define MIIM_88E1011_IEVENT            0x13
-#define MIIM_88E1011_IEVENT_CLEAR      0x0000
-
-#define MIIM_88E1011_IMASK             0x12
-#define MIIM_88E1011_IMASK_INIT                0x6400
-#define MIIM_88E1011_IMASK_CLEAR       0x0000
-
-/* DM9161 Control register values */
-#define MIIM_DM9161_CR_STOP    0x0400
-#define MIIM_DM9161_CR_RSTAN   0x1200
-
-#define MIIM_DM9161_SCR                0x10
-#define MIIM_DM9161_SCR_INIT   0x0610
-
-/* DM9161 Specified Configuration and Status Register */
-#define MIIM_DM9161_SCSR       0x11
-#define MIIM_DM9161_SCSR_100F  0x8000
-#define MIIM_DM9161_SCSR_100H  0x4000
-#define MIIM_DM9161_SCSR_10F   0x2000
-#define MIIM_DM9161_SCSR_10H   0x1000
-
-/* DM9161 Interrupt Register */
-#define MIIM_DM9161_INTR       0x15
-#define MIIM_DM9161_INTR_PEND          0x8000
-#define MIIM_DM9161_INTR_DPLX_MASK     0x0800
-#define MIIM_DM9161_INTR_SPD_MASK      0x0400
-#define MIIM_DM9161_INTR_LINK_MASK     0x0200
-#define MIIM_DM9161_INTR_MASK          0x0100
-#define MIIM_DM9161_INTR_DPLX_CHANGE   0x0010
-#define MIIM_DM9161_INTR_SPD_CHANGE    0x0008
-#define MIIM_DM9161_INTR_LINK_CHANGE   0x0004
-#define MIIM_DM9161_INTR_INIT          0x0000
-#define MIIM_DM9161_INTR_STOP  \
-(MIIM_DM9161_INTR_DPLX_MASK | MIIM_DM9161_INTR_SPD_MASK \
- | MIIM_DM9161_INTR_LINK_MASK | MIIM_DM9161_INTR_MASK)
-
-/* DM9161 10BT Configuration/Status */
-#define MIIM_DM9161_10BTCSR    0x12
-#define MIIM_DM9161_10BTCSR_INIT       0x7800
-
-/* BCM54xx regs */
-#define MIIM_BCM54xx_AUXCONTROL        0x18
-#define MIIM_BCM54xx_AUXSTATUS 0x19
-#define MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK     0x0700
-#define MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT    8  
-
-#define MIIM_READ_COMMAND       0x00000001
-
-/*
- * struct phy_cmd:  A command for reading or writing a PHY register
- *
- * mii_reg:  The register to read or write
- *
- * mii_data:  For writes, the value to put in the register.
- *     A value of -1 indicates this is a read.
- *
- * funct: A function pointer which is invoked for each command.
- *     For reads, this function will be passed the value read
- *     from the PHY, and process it.
- *     For writes, the result of this function will be written
- *     to the PHY register
- */
-struct phy_cmd {
-    u32 mii_reg;
-    u32 mii_data;
-    u16 (*funct) (u16 mii_reg, struct net_device * dev);
-};
-
-/* struct phy_info: a structure which defines attributes for a PHY
- *
- * id will contain a number which represents the PHY.  During
- * startup, the driver will poll the PHY to find out what its
- * UID--as defined by registers 2 and 3--is.  The 32-bit result
- * gotten from the PHY will be shifted right by "shift" bits to
- * discard any bits which may change based on revision numbers
- * unimportant to functionality
- *
- * The struct phy_cmd entries represent pointers to an arrays of
- * commands which tell the driver what to do to the PHY.
- */
-struct phy_info {
-    u32 id;
-    char *name;
-    unsigned int shift;
-    /* Called to configure the PHY, and modify the controller
-     * based on the results */
-    const struct phy_cmd *config;
-
-    /* Called when starting up the controller.  Usually sets
-     * up the interrupt for state changes */
-    const struct phy_cmd *startup;
-
-    /* Called inside the interrupt handler to acknowledge
-     * the interrupt */
-    const struct phy_cmd *ack_int;
-
-    /* Called in the bottom half to handle the interrupt */
-    const struct phy_cmd *handle_int;
-
-    /* Called when bringing down the controller.  Usually stops
-     * the interrupts from being generated */
-    const struct phy_cmd *shutdown;
-};
-
-struct phy_info *get_phy_info(struct net_device *dev);
-void phy_run_commands(struct net_device *dev, const struct phy_cmd *cmd);
-
-#endif /* GIANFAR_PHY_H */
index 3142c00..b5169e8 100644 (file)
@@ -1017,7 +1017,7 @@ static inline int hamachi_tx(struct net_device *dev)
                                hmp->tx_ring[entry].addr, skb->len, 
                                PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
-                       hmp->tx_skbuff[entry] = 0;
+                       hmp->tx_skbuff[entry] = NULL;
                }
                hmp->tx_ring[entry].status_n_length = 0;
                if (entry >= TX_RING_SIZE-1) 
@@ -1105,7 +1105,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
                        pci_unmap_single(hmp->pci_dev, hmp->tx_ring[i].addr, 
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
-                       hmp->tx_skbuff[i] = 0;
+                       hmp->tx_skbuff[i] = NULL;
                }
        }
 
@@ -1127,7 +1127,7 @@ static void hamachi_tx_timeout(struct net_device *dev)
                        pci_unmap_single(hmp->pci_dev, hmp->rx_ring[i].addr, 
                                hmp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
-                       hmp->rx_skbuff[i] = 0;
+                       hmp->rx_skbuff[i] = NULL;
                }
        }
        /* Fill in the Rx buffers.  Handle allocation failure gracefully. */
@@ -1189,7 +1189,7 @@ static void hamachi_init_ring(struct net_device *dev)
        /* Initialize all Rx descriptors. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                hmp->rx_ring[i].status_n_length = 0;
-               hmp->rx_skbuff[i] = 0;
+               hmp->rx_skbuff[i] = NULL;
        }
        /* Fill in the Rx buffers.  Handle allocation failure gracefully. */
        for (i = 0; i < RX_RING_SIZE; i++) {
@@ -1209,7 +1209,7 @@ static void hamachi_init_ring(struct net_device *dev)
        hmp->rx_ring[RX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing);
 
        for (i = 0; i < TX_RING_SIZE; i++) {
-               hmp->tx_skbuff[i] = 0;
+               hmp->tx_skbuff[i] = NULL;
                hmp->tx_ring[i].status_n_length = 0;
        }
        /* Mark the last entry of the ring */
@@ -1421,7 +1421,7 @@ static irqreturn_t hamachi_interrupt(int irq, void *dev_instance, struct pt_regs
                                                        skb->len,
                                                        PCI_DMA_TODEVICE);
                                                dev_kfree_skb_irq(skb);
-                                               hmp->tx_skbuff[entry] = 0;
+                                               hmp->tx_skbuff[entry] = NULL;
                                        }
                                        hmp->tx_ring[entry].status_n_length = 0;
                                        if (entry >= TX_RING_SIZE-1)  
@@ -1791,7 +1791,7 @@ static int hamachi_close(struct net_device *dev)
                                hmp->rx_ring[i].addr, hmp->rx_buf_sz, 
                                PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
-                       hmp->rx_skbuff[i] = 0;
+                       hmp->rx_skbuff[i] = NULL;
                }
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
@@ -1801,7 +1801,7 @@ static int hamachi_close(struct net_device *dev)
                                hmp->tx_ring[i].addr, skb->len, 
                                PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
-                       hmp->tx_skbuff[i] = 0;
+                       hmp->tx_skbuff[i] = NULL;
                }
        }
 
index 70b58d2..4b6c01a 100644 (file)
@@ -233,7 +233,7 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
        }
 
        /* Set the wrap registers for string I/O reads.   */
-       outw((HP_START_PG + TX_2X_PAGES) | ((HP_STOP_PG - 1) << 8), ioaddr + 14);
+       outw((HP_START_PG + TX_PAGES/2) | ((HP_STOP_PG - 1) << 8), ioaddr + 14);
 
        /* Set the base address to point to the NIC, not the "real" base! */
        dev->base_addr = ioaddr + NIC_OFFSET;
@@ -247,7 +247,7 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
        ei_status.name = name;
        ei_status.word16 = 0;           /* Agggghhhhh! Debug time: 2 days! */
        ei_status.tx_start_page = HP_START_PG;
-       ei_status.rx_start_page = HP_START_PG + TX_2X_PAGES;
+       ei_status.rx_start_page = HP_START_PG + TX_PAGES/2;
        ei_status.stop_page = HP_STOP_PG;
 
        ei_status.reset_8390 = &hpp_reset_8390;
@@ -261,7 +261,7 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
                ei_status.block_output = &hpp_mem_block_output;
                ei_status.get_8390_hdr = &hpp_mem_get_8390_hdr;
                dev->mem_start = mem_start;
-               ei_status.rmem_start = dev->mem_start + TX_2X_PAGES*256;
+               ei_status.rmem_start = dev->mem_start + TX_PAGES/2*256;
                dev->mem_end = ei_status.rmem_end
                        = dev->mem_start + (HP_STOP_PG - HP_START_PG)*256;
        }
@@ -297,7 +297,7 @@ hpp_open(struct net_device *dev)
 
        /* Set the wrap registers for programmed-I/O operation.   */
        outw(HW_Page, ioaddr + HP_PAGING);
-       outw((HP_START_PG + TX_2X_PAGES) | ((HP_STOP_PG - 1) << 8), ioaddr + 14);
+       outw((HP_START_PG + TX_PAGES/2) | ((HP_STOP_PG - 1) << 8), ioaddr + 14);
 
        /* Select the operational page. */
        outw(Perf_Page, ioaddr + HP_PAGING);
index 8d12144..a464841 100644 (file)
@@ -333,7 +333,7 @@ config WINBOND_FIR
 
 config TOSHIBA_FIR
        tristate "Toshiba Type-O IR Port"
-       depends on IRDA && !64BIT
+       depends on IRDA && PCI && !64BIT
        help
          Say Y here if you want to build support for the Toshiba Type-O IR
          and Donau oboe chipsets. These chipsets are used by the Toshiba
@@ -385,7 +385,7 @@ config SA1100_FIR
 
 config VIA_FIR
        tristate "VIA VT8231/VT1211 SIR/MIR/FIR"
-       depends on IRDA && ISA
+       depends on IRDA && ISA && PCI
        help
          Say Y here if you want to build support for the VIA VT8231
          and VIA VT1211 IrDA controllers, found on the motherboards using
index 5908733..b9998af 100644 (file)
@@ -67,7 +67,7 @@ uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
        /* Delay a few ms just to allow the reset to complete */
        msec_delay(IXGB_DELAY_AFTER_RESET);
        ctrl_reg = IXGB_READ_REG(hw, CTRL0);
-#if DBG
+#ifdef DBG
        /* Make sure the self-clearing global reset bit did self clear */
        ASSERT(!(ctrl_reg & IXGB_CTRL0_RST));
 #endif
index f1184e4..892f86c 100644 (file)
@@ -64,7 +64,7 @@ typedef enum {
 #define ASSERT(x)      if(!(x)) BUG()
 #define MSGOUT(S, A, B)        printk(KERN_DEBUG S "\n", A, B)
 
-#if DBG
+#ifdef DBG
 #define DEBUGOUT(S)            printk(KERN_DEBUG S "\n")
 #define DEBUGOUT1(S, A...)     printk(KERN_DEBUG S "\n", A)
 #else
index 25c7aa4..f04d0a8 100644 (file)
@@ -834,7 +834,7 @@ lance_purge_ring(struct net_device *dev)
        /* Free all the skbuffs in the Rx and Tx queues. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                struct sk_buff *skb = lp->rx_skbuff[i];
-               lp->rx_skbuff[i] = 0;
+               lp->rx_skbuff[i] = NULL;
                lp->rx_ring[i].base = 0;                /* Not owned by LANCE chip. */
                if (skb)
                        dev_kfree_skb_any(skb);
@@ -878,7 +878,7 @@ lance_init_ring(struct net_device *dev, int gfp)
        /* The Tx buffer address is filled in as needed, but we do need to clear
           the upper ownership bit. */
        for (i = 0; i < TX_RING_SIZE; i++) {
-               lp->tx_skbuff[i] = 0;
+               lp->tx_skbuff[i] = NULL;
                lp->tx_ring[i].base = 0;
        }
 
@@ -1083,7 +1083,7 @@ lance_interrupt(int irq, void *dev_id, struct pt_regs * regs)
                                   in the bounce buffer. */
                                if (lp->tx_skbuff[entry]) {
                                        dev_kfree_skb_irq(lp->tx_skbuff[entry]);
-                                       lp->tx_skbuff[entry] = 0;
+                                       lp->tx_skbuff[entry] = NULL;
                                }
                                dirty_tx++;
                        }
index 9e83a01..4957de6 100644 (file)
@@ -92,8 +92,7 @@
 #include <asm/cache.h>
 #include <asm/parisc-device.h>
 
-static char version[] __devinitdata =
-       "82596.c $Revision: 1.29 $\n";
+#define LASI_82596_DRIVER_VERSION "LASI 82596 driver - Revision: 1.30"
 
 /* DEBUG flags
  */
@@ -124,10 +123,10 @@ static char version[] __devinitdata =
        do { dma_cache_sync((void *)addr, len, DMA_TO_DEVICE); } while (0)
 
 #define  CHECK_INV(addr,len) \
-       do { dma_cache_sync((void *)addr,len, DMA_FROM_DEVICE); } while(0)
+       do { dma_cache_sync((void *)addr, len, DMA_FROM_DEVICE); } while(0)
 
 #define  CHECK_WBACK_INV(addr,len) \
-       do { dma_cache_sync((void *)addr,len, DMA_BIDIRECTIONAL); } while (0)
+       do { dma_cache_sync((void *)addr, len, DMA_BIDIRECTIONAL); } while (0)
 
 
 #define PA_I82596_RESET                0       /* Offsets relative to LASI-LAN-Addr.*/
@@ -506,7 +505,7 @@ static void i596_display_data(struct net_device *dev)
        rfd = lp->rfd_head;
        printk("rfd_head = %p\n", rfd);
        do {
-               printk ("   %p .stat %04x, .cmd %04x, b_next %08x, rbd %08x,"
+               printk("   %p .stat %04x, .cmd %04x, b_next %08x, rbd %08x,"
                         " count %04x\n",
                        rfd, rfd->stat, rfd->cmd, rfd->b_next, rfd->rbd,
                        rfd->count);
@@ -552,7 +551,7 @@ static inline void init_rx_bufs(struct net_device *dev)
                struct sk_buff *skb = dev_alloc_skb(PKT_BUF_SZ + 4);
 
                if (skb == NULL)
-                       panic("82596: alloc_skb() failed");
+                       panic("%s: alloc_skb() failed", __FILE__);
                skb_reserve(skb, 2);
                dma_addr = dma_map_single(lp->dev, skb->tail,PKT_BUF_SZ,
                                          DMA_FROM_DEVICE);
@@ -637,8 +636,8 @@ static int init_i596_mem(struct net_device *dev)
 
        disable_irq(dev->irq);  /* disable IRQs from LAN */
        DEB(DEB_INIT,
-               printk("RESET 82596 port: %08lX (with IRQ%d disabled)\n",
-                      dev->base_addr + PA_I82596_RESET,
+               printk("RESET 82596 port: %p (with IRQ %d disabled)\n",
+                      (void*)(dev->base_addr + PA_I82596_RESET),
                       dev->irq));
        
        gsc_writel(0, (void*)(dev->base_addr + PA_I82596_RESET)); /* Hard Reset */
@@ -658,7 +657,7 @@ static int init_i596_mem(struct net_device *dev)
        lp->cmd_head = NULL;
         lp->scb.cmd = I596_NULL;
 
-       DEB(DEB_INIT,printk("%s: starting i82596.\n", dev->name));
+       DEB(DEB_INIT, printk("%s: starting i82596.\n", dev->name));
 
        CHECK_WBACK(&(lp->scp), sizeof(struct i596_scp));
        CHECK_WBACK(&(lp->iscp), sizeof(struct i596_iscp));
@@ -667,9 +666,9 @@ static int init_i596_mem(struct net_device *dev)
 
        CA(dev);
 
-       if (wait_istat(dev,lp,1000,"initialization timed out"))
+       if (wait_istat(dev, lp, 1000, "initialization timed out"))
                goto failed;
-       DEB(DEB_INIT,printk("%s: i82596 initialization successful\n", dev->name));
+       DEB(DEB_INIT, printk("%s: i82596 initialization successful\n", dev->name));
 
        /* Ensure rx frame/buffer descriptors are tidy */
        rebuild_rx_bufs(dev);
@@ -679,30 +678,30 @@ static int init_i596_mem(struct net_device *dev)
 
        enable_irq(dev->irq);   /* enable IRQs from LAN */
 
-       DEB(DEB_INIT,printk("%s: queuing CmdConfigure\n", dev->name));
+       DEB(DEB_INIT, printk("%s: queuing CmdConfigure\n", dev->name));
        memcpy(lp->cf_cmd.i596_config, init_setup, 14);
        lp->cf_cmd.cmd.command = CmdConfigure;
        CHECK_WBACK(&(lp->cf_cmd), sizeof(struct cf_cmd));
        i596_add_cmd(dev, &lp->cf_cmd.cmd);
 
-       DEB(DEB_INIT,printk("%s: queuing CmdSASetup\n", dev->name));
+       DEB(DEB_INIT, printk("%s: queuing CmdSASetup\n", dev->name));
        memcpy(lp->sa_cmd.eth_addr, dev->dev_addr, 6);
        lp->sa_cmd.cmd.command = CmdSASetup;
        CHECK_WBACK(&(lp->sa_cmd), sizeof(struct sa_cmd));
        i596_add_cmd(dev, &lp->sa_cmd.cmd);
 
-       DEB(DEB_INIT,printk("%s: queuing CmdTDR\n", dev->name));
+       DEB(DEB_INIT, printk("%s: queuing CmdTDR\n", dev->name));
        lp->tdr_cmd.cmd.command = CmdTDR;
        CHECK_WBACK(&(lp->tdr_cmd), sizeof(struct tdr_cmd));
        i596_add_cmd(dev, &lp->tdr_cmd.cmd);
 
        spin_lock_irqsave (&lp->lock, flags);
 
-       if (wait_cmd(dev,lp,1000,"timed out waiting to issue RX_START")) {
+       if (wait_cmd(dev, lp, 1000, "timed out waiting to issue RX_START")) {
                spin_unlock_irqrestore (&lp->lock, flags);
                goto failed;
        }
-       DEB(DEB_INIT,printk("%s: Issuing RX_START\n", dev->name));
+       DEB(DEB_INIT, printk("%s: Issuing RX_START\n", dev->name));
        lp->scb.command = RX_START;
        lp->scb.rfd = WSWAPrfd(virt_to_dma(lp,lp->rfds));
        CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb));
@@ -711,9 +710,9 @@ static int init_i596_mem(struct net_device *dev)
 
        spin_unlock_irqrestore (&lp->lock, flags);
 
-       if (wait_cmd(dev,lp,1000,"RX_START not processed"))
+       if (wait_cmd(dev, lp, 1000, "RX_START not processed"))
                goto failed;
-       DEB(DEB_INIT,printk("%s: Receive unit started OK\n", dev->name));
+       DEB(DEB_INIT, printk("%s: Receive unit started OK\n", dev->name));
 
        return 0;
 
@@ -731,7 +730,7 @@ static inline int i596_rx(struct net_device *dev)
        struct i596_rbd *rbd;
        int frames = 0;
 
-       DEB(DEB_RXFRAME,printk ("i596_rx(), rfd_head %p, rbd_head %p\n",
+       DEB(DEB_RXFRAME, printk("i596_rx(), rfd_head %p, rbd_head %p\n",
                        lp->rfd_head, lp->rbd_head));
 
 
@@ -794,7 +793,7 @@ static inline int i596_rx(struct net_device *dev)
 memory_squeeze:
                        if (skb == NULL) {
                                /* XXX tulip.c can defer packets here!! */
-                               printk ("%s: i596_rx Memory squeeze, dropping packet.\n", dev->name);
+                               printk("%s: i596_rx Memory squeeze, dropping packet.\n", dev->name);
                                lp->stats.rx_dropped++;
                        }
                        else {
@@ -863,7 +862,7 @@ memory_squeeze:
                CHECK_INV(rfd, sizeof(struct i596_rfd));
        }
 
-       DEB(DEB_RXFRAME,printk ("frames %d\n", frames));
+       DEB(DEB_RXFRAME, printk("frames %d\n", frames));
 
        return 0;
 }
@@ -902,7 +901,7 @@ static inline void i596_cleanup_cmd(struct net_device *dev, struct i596_private
                CHECK_WBACK_INV(ptr, sizeof(struct i596_cmd));
        }
 
-       wait_cmd(dev,lp,100,"i596_cleanup_cmd timed out");
+       wait_cmd(dev, lp, 100, "i596_cleanup_cmd timed out");
        lp->scb.cmd = I596_NULL;
        CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb));
 }
@@ -912,11 +911,11 @@ static inline void i596_reset(struct net_device *dev, struct i596_private *lp)
 {
        unsigned long flags;
 
-       DEB(DEB_RESET,printk("i596_reset\n"));
+       DEB(DEB_RESET, printk("i596_reset\n"));
 
        spin_lock_irqsave (&lp->lock, flags);
 
-       wait_cmd(dev,lp,100,"i596_reset timed out");
+       wait_cmd(dev, lp, 100, "i596_reset timed out");
 
        netif_stop_queue(dev);
 
@@ -926,7 +925,7 @@ static inline void i596_reset(struct net_device *dev, struct i596_private *lp)
        CA(dev);
 
        /* wait for shutdown */
-       wait_cmd(dev,lp,1000,"i596_reset 2 timed out");
+       wait_cmd(dev, lp, 1000, "i596_reset 2 timed out");
        spin_unlock_irqrestore (&lp->lock, flags);
 
        i596_cleanup_cmd(dev,lp);
@@ -942,7 +941,7 @@ static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd)
        struct i596_private *lp = dev->priv;
        unsigned long flags;
 
-       DEB(DEB_ADDCMD,printk("i596_add_cmd cmd_head %p\n", lp->cmd_head));
+       DEB(DEB_ADDCMD, printk("i596_add_cmd cmd_head %p\n", lp->cmd_head));
 
        cmd->status = 0;
        cmd->command |= (CMD_EOL | CMD_INTR);
@@ -958,7 +957,7 @@ static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd)
                CHECK_WBACK(lp->cmd_tail, sizeof(struct i596_cmd));
        } else {
                lp->cmd_head = cmd;
-               wait_cmd(dev,lp,100,"i596_add_cmd timed out");
+               wait_cmd(dev, lp, 100, "i596_add_cmd timed out");
                lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&cmd->status));
                lp->scb.command = CUC_START;
                CHECK_WBACK(&(lp->scb), sizeof(struct i596_scb));
@@ -1014,7 +1013,7 @@ static int i596_test(struct net_device *dev)
 
 static int i596_open(struct net_device *dev)
 {
-       DEB(DEB_OPEN,printk("%s: i596_open() irq %d.\n", dev->name, dev->irq));
+       DEB(DEB_OPEN, printk("%s: i596_open() irq %d.\n", dev->name, dev->irq));
 
        if (request_irq(dev->irq, &i596_interrupt, 0, "i82596", dev)) {
                printk("%s: IRQ %d not free\n", dev->name, dev->irq);
@@ -1044,19 +1043,19 @@ static void i596_tx_timeout (struct net_device *dev)
        struct i596_private *lp = dev->priv;
 
        /* Transmitter timeout, serious problems. */
-       DEB(DEB_ERRORS,printk("%s: transmit timed out, status resetting.\n",
+       DEB(DEB_ERRORS, printk("%s: transmit timed out, status resetting.\n",
                        dev->name));
 
        lp->stats.tx_errors++;
 
        /* Try to restart the adaptor */
        if (lp->last_restart == lp->stats.tx_packets) {
-               DEB(DEB_ERRORS,printk ("Resetting board.\n"));
+               DEB(DEB_ERRORS, printk("Resetting board.\n"));
                /* Shutdown and restart */
                i596_reset (dev, lp);
        } else {
                /* Issue a channel attention signal */
-               DEB(DEB_ERRORS,printk ("Kicking board.\n"));
+               DEB(DEB_ERRORS, printk("Kicking board.\n"));
                lp->scb.command = CUC_START | RX_START;
                CHECK_WBACK_INV(&(lp->scb), sizeof(struct i596_scb));
                CA (dev);
@@ -1076,7 +1075,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
        short length = skb->len;
        dev->trans_start = jiffies;
 
-       DEB(DEB_STARTTX,printk("%s: i596_start_xmit(%x,%p) called\n", dev->name,
+       DEB(DEB_STARTTX, printk("%s: i596_start_xmit(%x,%p) called\n", dev->name,
                                skb->len, skb->data));
 
        if (length < ETH_ZLEN) {
@@ -1092,7 +1091,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
        tbd = lp->tbds + lp->next_tx_cmd;
 
        if (tx_cmd->cmd.command) {
-               DEB(DEB_ERRORS,printk ("%s: xmit ring full, dropping packet.\n",
+               DEB(DEB_ERRORS, printk("%s: xmit ring full, dropping packet.\n",
                                dev->name));
                lp->stats.tx_dropped++;
 
@@ -1156,28 +1155,28 @@ static int __devinit i82596_probe(struct net_device *dev,
        /* This lot is ensure things have been cache line aligned. */
        if (sizeof(struct i596_rfd) != 32) {
            printk("82596: sizeof(struct i596_rfd) = %d\n",
-                           sizeof(struct i596_rfd));
+                           (int)sizeof(struct i596_rfd));
            return -ENODEV;
        }
        if ((sizeof(struct i596_rbd) % 32) != 0) {
            printk("82596: sizeof(struct i596_rbd) = %d\n",
-                           sizeof(struct i596_rbd));
+                           (int)sizeof(struct i596_rbd));
            return -ENODEV;
        }
        if ((sizeof(struct tx_cmd) % 32) != 0) {
            printk("82596: sizeof(struct tx_cmd) = %d\n",
-                           sizeof(struct tx_cmd));
+                           (int)sizeof(struct tx_cmd));
            return -ENODEV;
        }
        if (sizeof(struct i596_tbd) != 32) {
            printk("82596: sizeof(struct i596_tbd) = %d\n",
-                           sizeof(struct i596_tbd));
+                           (int)sizeof(struct i596_tbd));
            return -ENODEV;
        }
 #ifndef __LP64__
        if (sizeof(struct i596_private) > 4096) {
            printk("82596: sizeof(struct i596_private) = %d\n",
-                           sizeof(struct i596_private));
+                           (int)sizeof(struct i596_private));
            return -ENODEV;
        }
 #endif
@@ -1189,24 +1188,18 @@ static int __devinit i82596_probe(struct net_device *dev,
                for (i=0; i < 6; i++) {
                        eth_addr[i] = gsc_readb(LAN_PROM_ADDR + i);
                }
-               printk("82596.c: MAC of HP700 LAN read from EEPROM\n");
+               printk(KERN_INFO "%s: MAC of HP700 LAN read from EEPROM\n", __FILE__);
        }
 
        dev->mem_start = (unsigned long) dma_alloc_noncoherent(gen_dev, 
                sizeof(struct i596_private), &dma_addr, GFP_KERNEL);
        if (!dev->mem_start) {
-               printk("%s: Couldn't get shared memory\n", dev->name);
+               printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
                return -ENOMEM;
        }
 
-       DEB(DEB_PROBE,printk("%s: 82596 at %#3lx,", dev->name, dev->base_addr));
-
        for (i = 0; i < 6; i++)
-               DEB(DEB_PROBE,printk(" %2.2X", dev->dev_addr[i] = eth_addr[i]));
-
-       DEB(DEB_PROBE,printk(" IRQ %d.\n", dev->irq));
-
-       DEB(DEB_PROBE,printk(version));
+               dev->dev_addr[i] = eth_addr[i];
 
        /* The 82596-specific entries in the device structure. */
        dev->open = i596_open;
@@ -1220,9 +1213,6 @@ static int __devinit i82596_probe(struct net_device *dev,
        dev->priv = (void *)(dev->mem_start);
 
        lp = dev->priv;
-       DEB(DEB_INIT,printk ("%s: lp at 0x%08lx (%d bytes), lp->scb at 0x%08lx\n",
-               dev->name, (unsigned long)lp,
-               sizeof(struct i596_private), (unsigned long)&lp->scb));
        memset(lp, 0, sizeof(struct i596_private));
 
        lp->scb.command = 0;
@@ -1234,6 +1224,21 @@ static int __devinit i82596_probe(struct net_device *dev,
 
        CHECK_WBACK_INV(dev->mem_start, sizeof(struct i596_private));
 
+       i = register_netdev(dev);
+       if (i) {
+               lp = dev->priv;
+               dma_free_noncoherent(lp->dev, sizeof(struct i596_private), 
+                                   (void *)dev->mem_start, lp->dma_addr);
+               return i;
+       };
+
+       DEB(DEB_PROBE, printk(KERN_INFO "%s: 82596 at %#3lx,", dev->name, dev->base_addr));
+       for (i = 0; i < 6; i++)
+               DEB(DEB_PROBE, printk(" %2.2X", dev->dev_addr[i]));
+       DEB(DEB_PROBE, printk(" IRQ %d.\n", dev->irq));
+       DEB(DEB_INIT, printk(KERN_INFO "%s: lp at 0x%p (%d bytes), lp->scb at 0x%p\n",
+               dev->name, lp, (int)sizeof(struct i596_private), &lp->scb));
+
        return 0;
 }
 
@@ -1245,7 +1250,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        unsigned short status, ack_cmd = 0;
 
        if (dev == NULL) {
-               printk("i596_interrupt(): irq %d for unknown device.\n", irq);
+               printk("%s: irq %d for unknown device.\n", __FUNCTION__, irq);
                return IRQ_NONE;
        }
 
@@ -1253,10 +1258,10 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        spin_lock (&lp->lock);
 
-       wait_cmd(dev,lp,100,"i596 interrupt, timeout");
+       wait_cmd(dev, lp, 100, "i596 interrupt, timeout");
        status = lp->scb.status;
 
-       DEB(DEB_INTS,printk("%s: i596 interrupt, IRQ %d, status %4.4x.\n",
+       DEB(DEB_INTS, printk("%s: i596 interrupt, IRQ %d, status %4.4x.\n",
                        dev->name, irq, status));
 
        ack_cmd = status & 0xf000;
@@ -1271,9 +1276,9 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                struct i596_cmd *ptr;
 
                if ((status & 0x8000))
-                       DEB(DEB_INTS,printk("%s: i596 interrupt completed command.\n", dev->name));
+                       DEB(DEB_INTS, printk("%s: i596 interrupt completed command.\n", dev->name));
                if ((status & 0x2000))
-                       DEB(DEB_INTS,printk("%s: i596 interrupt command unit inactive %x.\n", dev->name, status & 0x0700));
+                       DEB(DEB_INTS, printk("%s: i596 interrupt command unit inactive %x.\n", dev->name, status & 0x0700));
 
                while (lp->cmd_head != NULL) {
                        CHECK_INV(lp->cmd_head, sizeof(struct i596_cmd));
@@ -1282,7 +1287,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
                        ptr = lp->cmd_head;
 
-                       DEB(DEB_STATUS,printk("cmd_head->status = %04x, ->command = %04x\n",
+                       DEB(DEB_STATUS, printk("cmd_head->status = %04x, ->command = %04x\n",
                                       lp->cmd_head->status, lp->cmd_head->command));
                        lp->cmd_head = ptr->v_next;
                        lp->cmd_backlog--;
@@ -1294,7 +1299,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                struct sk_buff *skb = tx_cmd->skb;
 
                                if ((ptr->status) & STAT_OK) {
-                                       DEB(DEB_TXADDR,print_eth(skb->data, "tx-done"));
+                                       DEB(DEB_TXADDR, print_eth(skb->data, "tx-done"));
                                } else {
                                        lp->stats.tx_errors++;
                                        if ((ptr->status) & 0x0020)
@@ -1319,7 +1324,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                unsigned short status = ((struct tdr_cmd *)ptr)->status;
 
                                if (status & 0x8000) {
-                                       DEB(DEB_ANY,printk("%s: link ok.\n", dev->name));
+                                       DEB(DEB_ANY, printk("%s: link ok.\n", dev->name));
                                } else {
                                        if (status & 0x4000)
                                                printk("%s: Transceiver problem.\n", dev->name);
@@ -1328,7 +1333,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                                        if (status & 0x1000)
                                                printk("%s: Short circuit.\n", dev->name);
 
-                                       DEB(DEB_TDR,printk("%s: Time %d.\n", dev->name, status & 0x07ff));
+                                       DEB(DEB_TDR, printk("%s: Time %d.\n", dev->name, status & 0x07ff));
                                }
                                break;
                            }
@@ -1363,12 +1368,12 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        }
        if ((status & 0x1000) || (status & 0x4000)) {
                if ((status & 0x4000))
-                       DEB(DEB_INTS,printk("%s: i596 interrupt received a frame.\n", dev->name));
+                       DEB(DEB_INTS, printk("%s: i596 interrupt received a frame.\n", dev->name));
                i596_rx(dev);
                /* Only RX_START if stopped - RGH 07-07-96 */
                if (status & 0x1000) {
                        if (netif_running(dev)) {
-                               DEB(DEB_ERRORS,printk("%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status));
+                               DEB(DEB_ERRORS, printk("%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status));
                                ack_cmd |= RX_START;
                                lp->stats.rx_errors++;
                                lp->stats.rx_fifo_errors++;
@@ -1376,7 +1381,7 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                        }
                }
        }
-       wait_cmd(dev,lp,100,"i596 interrupt, timeout");
+       wait_cmd(dev, lp, 100, "i596 interrupt, timeout");
        lp->scb.command = ack_cmd;
        CHECK_WBACK(&lp->scb, sizeof(struct i596_scb));
 
@@ -1386,8 +1391,8 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        CA(dev);
 
-       wait_cmd(dev,lp,100,"i596 interrupt, exit timeout");
-       DEB(DEB_INTS,printk("%s: exiting interrupt.\n", dev->name));
+       wait_cmd(dev, lp, 100, "i596 interrupt, exit timeout");
+       DEB(DEB_INTS, printk("%s: exiting interrupt.\n", dev->name));
 
        spin_unlock (&lp->lock);
        return IRQ_HANDLED;
@@ -1400,18 +1405,18 @@ static int i596_close(struct net_device *dev)
 
        netif_stop_queue(dev);
 
-       DEB(DEB_INIT,printk("%s: Shutting down ethercard, status was %4.4x.\n",
+       DEB(DEB_INIT, printk("%s: Shutting down ethercard, status was %4.4x.\n",
                       dev->name, lp->scb.status));
 
        spin_lock_irqsave(&lp->lock, flags);
 
-       wait_cmd(dev,lp,100,"close1 timed out");
+       wait_cmd(dev, lp, 100, "close1 timed out");
        lp->scb.command = CUC_ABORT | RX_ABORT;
        CHECK_WBACK(&lp->scb, sizeof(struct i596_scb));
 
        CA(dev);
 
-       wait_cmd(dev,lp,100,"close2 timed out");
+       wait_cmd(dev, lp, 100, "close2 timed out");
        spin_unlock_irqrestore(&lp->lock, flags);
        DEB(DEB_STRUCT,i596_display_data(dev));
        i596_cleanup_cmd(dev,lp);
@@ -1443,7 +1448,9 @@ static void set_multicast_list(struct net_device *dev)
        struct i596_private *lp = dev->priv;
        int config = 0, cnt;
 
-       DEB(DEB_MULTI,printk("%s: set multicast list, %d entries, promisc %s, allmulti %s\n", dev->name, dev->mc_count, dev->flags & IFF_PROMISC ? "ON" : "OFF", dev->flags & IFF_ALLMULTI ? "ON" : "OFF"));
+       DEB(DEB_MULTI, printk("%s: set multicast list, %d entries, promisc %s, allmulti %s\n",
+               dev->name, dev->mc_count, dev->flags & IFF_PROMISC ? "ON" : "OFF",
+               dev->flags & IFF_ALLMULTI ? "ON" : "OFF"));
 
        if ((dev->flags & IFF_PROMISC) && !(lp->cf_cmd.i596_config[8] & 0x01)) {
                lp->cf_cmd.i596_config[8] |= 0x01;
@@ -1492,7 +1499,7 @@ static void set_multicast_list(struct net_device *dev)
                for (dmi = dev->mc_list; cnt && dmi != NULL; dmi = dmi->next, cnt--, cp += 6) {
                        memcpy(cp, dmi->dmi_addr, 6);
                        if (i596_debug > 1)
-                               DEB(DEB_MULTI,printk("%s: Adding address %02x:%02x:%02x:%02x:%02x:%02x\n",
+                               DEB(DEB_MULTI, printk("%s: Adding address %02x:%02x:%02x:%02x:%02x:%02x\n",
                                                dev->name, cp[0],cp[1],cp[2],cp[3],cp[4],cp[5]));
                }
                CHECK_WBACK_INV(&lp->mc_cmd, sizeof(struct mc_cmd));
@@ -1515,11 +1522,15 @@ lan_init_chip(struct parisc_device *dev)
 
        if (num_drivers >= MAX_DRIVERS) {
                /* max count of possible i82596 drivers reached */
-               return -ENODEV;
+               return -ENOMEM;
        }
+
+       if (num_drivers == 0)
+               printk(KERN_INFO LASI_82596_DRIVER_VERSION "\n");
        
        if (!dev->irq) {
-               printk(KERN_ERR __FILE__ ": IRQ not found for i82596 at 0x%lx\n", dev->hpa);
+               printk(KERN_ERR "%s: IRQ not found for i82596 at 0x%lx\n",
+                       __FILE__, dev->hpa);
                return -ENODEV;
        }
 
@@ -1538,15 +1549,6 @@ lan_init_chip(struct parisc_device *dev)
                return -ENODEV;
        }
 
-       retval = register_netdev(netdevice);
-       if (retval) {
-               struct i596_private *lp = netdevice->priv;
-               printk(KERN_WARNING __FILE__ ": register_netdevice ret'd %d\n", retval);
-               dma_free_noncoherent(lp->dev, sizeof(struct i596_private), 
-                                   (void *)netdevice->mem_start, lp->dma_addr);
-               free_netdev(netdevice);
-               return -ENODEV;
-       };
        if (dev->id.sversion == 0x72) {
                ((struct i596_private *)netdevice->priv)->options = OPT_SWAP_PORT;
        }
@@ -1599,6 +1601,7 @@ static void __exit lasi_82596_exit(void)
                                       (void *)netdevice->mem_start, lp->dma_addr);
                free_netdev(netdevice);
        }
+       num_drivers = 0;
 
        unregister_parisc_driver(&lan_driver);
 }
index 38281f5..c87d90a 100644 (file)
@@ -479,7 +479,7 @@ remove_rx_bufs(struct net_device *dev) {
                kfree(rfd);
        } while (rfd != lp->rx_tail);
 
-       lp->rx_tail = 0;
+       lp->rx_tail = NULL;
 
 #if 0
        for (lp->rbd_list) {
index ee9d4dd..a4116f1 100644 (file)
@@ -111,7 +111,7 @@ bad_clone_list[] __initdata = {
     {"PCM-4823", "PCM-4823", {0x00, 0xc0, 0x6c}}, /* Broken Advantech MoBo */
     {"REALTEK", "RTL8019", {0x00, 0x00, 0xe8}}, /* no-name with Realtek chip */
     {"LCS-8834", "LCS-8836", {0x04, 0x04, 0x37}}, /* ShinyNet (SET) */
-    {0,}
+    {NULL,}
 };
 #endif
 
index 311471a..5d690c9 100644 (file)
@@ -776,14 +776,12 @@ static int irq[MAX_NE_CARDS];
 static int bad[MAX_NE_CARDS];  /* 0xbad = bad sig or no reset ack */
 MODULE_LICENSE("GPL");
 
-#ifdef MODULE_PARM
 MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
 MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
 MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
 MODULE_PARM_DESC(io, "(ignored)");
 MODULE_PARM_DESC(irq, "(ignored)");
 MODULE_PARM_DESC(bad, "(ignored)");
-#endif
 
 /* Module code fixed by David Weinehall */
 
index 1ee8c49..c2551c5 100644 (file)
@@ -1089,7 +1089,7 @@ again:
 
        frag = skb_shinfo(skb)->frags;
        if (!nr_frags)
-               frag = 0;
+               frag = NULL;
        extsts = 0;
        if (skb->ip_summed == CHECKSUM_HW) {
                extsts |= EXTSTS_IPPKT;
index bf70b18..0d9a06f 100644 (file)
@@ -1178,7 +1178,7 @@ static int ei_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
        else if (ei_local->tx2 == 0) 
        {
-               output_page = ei_local->tx_start_page + TX_1X_PAGES;
+               output_page = ei_local->tx_start_page + TX_PAGES/2;
                ei_local->tx2 = send_length;
                if (ei_debug  &&  ei_local->tx1 > 0)
                        printk(KERN_DEBUG "%s: idle transmitter, tx1=%d, lasttx=%d, txing=%d.\n",
index 475d68d..947dad4 100644 (file)
@@ -1472,7 +1472,7 @@ updateCRC
        Modified from Am79C90 data sheet.
 ---------------------------------------------------------------------------- */
 
-#if BROKEN_MULTICAST
+#ifdef BROKEN_MULTICAST
 
 static void updateCRC(int *CRC, int bit)
 {
index 8e13927..e44b189 100644 (file)
@@ -208,7 +208,7 @@ ppp_asynctty_close(struct tty_struct *tty)
 
        write_lock_irq(&disc_data_lock);
        ap = tty->disc_data;
-       tty->disc_data = 0;
+       tty->disc_data = NULL;
        write_unlock_irq(&disc_data_lock);
        if (ap == 0)
                return;
@@ -606,7 +606,7 @@ ppp_async_encode(struct asyncppp *ap)
        ap->olim = buf;
 
        kfree_skb(ap->tpkt);
-       ap->tpkt = 0;
+       ap->tpkt = NULL;
        return 1;
 }
 
@@ -705,7 +705,7 @@ flush:
        clear_bit(XMIT_BUSY, &ap->xmit_flags);
        if (ap->tpkt != 0) {
                kfree_skb(ap->tpkt);
-               ap->tpkt = 0;
+               ap->tpkt = NULL;
                clear_bit(XMIT_FULL, &ap->xmit_flags);
                done = 1;
        }
@@ -727,7 +727,7 @@ ppp_async_flush_output(struct asyncppp *ap)
        ap->optr = ap->olim;
        if (ap->tpkt != NULL) {
                kfree_skb(ap->tpkt);
-               ap->tpkt = 0;
+               ap->tpkt = NULL;
                clear_bit(XMIT_FULL, &ap->xmit_flags);
                done = 1;
        }
@@ -805,7 +805,7 @@ process_input_packet(struct asyncppp *ap)
        /* queue the frame to be processed */
        skb->cb[0] = ap->state;
        skb_queue_tail(&ap->rqueue, skb);
-       ap->rpkt = 0;
+       ap->rpkt = NULL;
        ap->state = 0;
        return;
 
index a681d08..6516011 100644 (file)
@@ -371,7 +371,7 @@ static int ppp_release(struct inode *inode, struct file *file)
        struct ppp *ppp;
 
        if (pf != 0) {
-               file->private_data = 0;
+               file->private_data = NULL;
                if (pf->kind == INTERFACE) {
                        ppp = PF_TO_PPP(pf);
                        if (file == ppp->owner)
@@ -397,7 +397,7 @@ static ssize_t ppp_read(struct file *file, char __user *buf,
        struct ppp_file *pf = file->private_data;
        DECLARE_WAITQUEUE(wait, current);
        ssize_t ret;
-       struct sk_buff *skb = 0;
+       struct sk_buff *skb = NULL;
 
        ret = count;
 
@@ -1026,11 +1026,7 @@ ppp_send_frame(struct ppp *ppp, struct sk_buff *skb)
                /* check if we should pass this packet */
                /* the filter instructions are constructed assuming
                   a four-byte PPP header on each packet */
-               {
-                       u_int16_t *p = (u_int16_t *) skb_push(skb, 2);
-
-                       *p = htons(4); /* indicate outbound in DLT_LINUX_SLL */;
-               }
+               *skb_push(skb, 2) = 1;
                if (ppp->pass_filter
                    && sk_run_filter(skb, ppp->pass_filter,
                                     ppp->pass_len) == 0) {
@@ -1161,7 +1157,7 @@ ppp_push(struct ppp *ppp)
        list = &ppp->channels;
        if (list_empty(list)) {
                /* nowhere to send the packet, just drop it */
-               ppp->xmit_pending = 0;
+               ppp->xmit_pending = NULL;
                kfree_skb(skb);
                return;
        }
@@ -1174,11 +1170,11 @@ ppp_push(struct ppp *ppp)
                spin_lock_bh(&pch->downl);
                if (pch->chan) {
                        if (pch->chan->ops->start_xmit(pch->chan, skb))
-                               ppp->xmit_pending = 0;
+                               ppp->xmit_pending = NULL;
                } else {
                        /* channel got unregistered */
                        kfree_skb(skb);
-                       ppp->xmit_pending = 0;
+                       ppp->xmit_pending = NULL;
                }
                spin_unlock_bh(&pch->downl);
                return;
@@ -1191,7 +1187,7 @@ ppp_push(struct ppp *ppp)
                return;
 #endif /* CONFIG_PPP_MULTILINK */
 
-       ppp->xmit_pending = 0;
+       ppp->xmit_pending = NULL;
        kfree_skb(skb);
 }
 
@@ -1573,11 +1569,7 @@ ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb)
                /* check if the packet passes the pass and active filters */
                /* the filter instructions are constructed assuming
                   a four-byte PPP header on each packet */
-               {
-                       u_int16_t *p = (u_int16_t *) skb_push(skb, 2);
-
-                       *p = 0; /* indicate inbound in DLT_LINUX_SLL */
-               }
+               *skb_push(skb, 2) = 0;
                if (ppp->pass_filter
                    && sk_run_filter(skb, ppp->pass_filter,
                                     ppp->pass_len) == 0) {
@@ -1976,7 +1968,7 @@ ppp_unregister_channel(struct ppp_channel *chan)
 
        if (pch == 0)
                return;         /* should never happen */
-       chan->ppp = 0;
+       chan->ppp = NULL;
 
        /*
         * This ensures that we have returned from any calls into the
@@ -1984,7 +1976,7 @@ ppp_unregister_channel(struct ppp_channel *chan)
         */
        down_write(&pch->chan_sem);
        spin_lock_bh(&pch->downl);
-       pch->chan = 0;
+       pch->chan = NULL;
        spin_unlock_bh(&pch->downl);
        up_write(&pch->chan_sem);
        ppp_disconnect_channel(pch);
@@ -2187,11 +2179,11 @@ ppp_ccp_closed(struct ppp *ppp)
        ppp->xstate = 0;
        xcomp = ppp->xcomp;
        xstate = ppp->xc_state;
-       ppp->xc_state = 0;
+       ppp->xc_state = NULL;
        ppp->rstate = 0;
        rcomp = ppp->rcomp;
        rstate = ppp->rc_state;
-       ppp->rc_state = 0;
+       ppp->rc_state = NULL;
        ppp_unlock(ppp);
 
        if (xstate) {
@@ -2224,7 +2216,7 @@ find_comp_entry(int proto)
                if (ce->comp->compress_proto == proto)
                        return ce;
        }
-       return 0;
+       return NULL;
 }
 
 /* Register a compressor */
@@ -2269,7 +2261,7 @@ static struct compressor *
 find_compressor(int type)
 {
        struct compressor_entry *ce;
-       struct compressor *cp = 0;
+       struct compressor *cp = NULL;
 
        spin_lock(&compressor_list_lock);
        ce = find_comp_entry(type);
@@ -2413,7 +2405,7 @@ static void ppp_shutdown_interface(struct ppp *ppp)
        down(&all_ppp_sem);
        ppp_lock(ppp);
        dev = ppp->dev;
-       ppp->dev = 0;
+       ppp->dev = NULL;
        ppp_unlock(ppp);
        /* This will call dev_close() for us. */
        if (dev) {
@@ -2447,7 +2439,7 @@ static void ppp_destroy_interface(struct ppp *ppp)
        ppp_ccp_closed(ppp);
        if (ppp->vj) {
                slhc_free(ppp->vj);
-               ppp->vj = 0;
+               ppp->vj = NULL;
        }
        skb_queue_purge(&ppp->file.xq);
        skb_queue_purge(&ppp->file.rq);
@@ -2461,7 +2453,7 @@ static void ppp_destroy_interface(struct ppp *ppp)
        }
        if (ppp->active_filter) {
                kfree(ppp->active_filter);
-               ppp->active_filter = 0;
+               ppp->active_filter = NULL;
        }
 #endif /* CONFIG_PPP_FILTER */
 
@@ -2507,7 +2499,7 @@ ppp_find_channel(int unit)
                if (pch->file.index == unit)
                        return pch;
        }
-       return 0;
+       return NULL;
 }
 
 /*
index f2c7335..a8f8908 100644 (file)
@@ -259,7 +259,7 @@ ppp_sync_close(struct tty_struct *tty)
 
        write_lock_irq(&disc_data_lock);
        ap = tty->disc_data;
-       tty->disc_data = 0;
+       tty->disc_data = NULL;
        write_unlock_irq(&disc_data_lock);
        if (ap == 0)
                return;
@@ -656,7 +656,7 @@ ppp_sync_push(struct syncppp *ap)
                                tty_stuffed = 1;
                        } else {
                                kfree_skb(ap->tpkt);
-                               ap->tpkt = 0;
+                               ap->tpkt = NULL;
                                clear_bit(XMIT_FULL, &ap->xmit_flags);
                                done = 1;
                        }
@@ -675,7 +675,7 @@ ppp_sync_push(struct syncppp *ap)
 flush:
        if (ap->tpkt != 0) {
                kfree_skb(ap->tpkt);
-               ap->tpkt = 0;
+               ap->tpkt = NULL;
                clear_bit(XMIT_FULL, &ap->xmit_flags);
                done = 1;
        }
@@ -695,7 +695,7 @@ ppp_sync_flush_output(struct syncppp *ap)
        spin_lock_bh(&ap->xmit_lock);
        if (ap->tpkt != NULL) {
                kfree_skb(ap->tpkt);
-               ap->tpkt = 0;
+               ap->tpkt = NULL;
                clear_bit(XMIT_FULL, &ap->xmit_flags);
                done = 1;
        }
index f79e9ab..64b35cc 100644 (file)
@@ -79,6 +79,8 @@
 #define PPPOE_HASH_BITS 4
 #define PPPOE_HASH_SIZE (1<<PPPOE_HASH_BITS)
 
+static struct ppp_channel_ops pppoe_chan_ops;
+
 static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
 static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb);
 static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
index 8ac2d81..03f28fd 100644 (file)
@@ -799,7 +799,7 @@ skipped_frame:
                        skb ? session_id : session_id | 0x40, frame_id);
        if (skb) {
                dev_kfree_skb(skb);
-               skb = 0;
+               skb = NULL;
        }
 
 good_frame:
@@ -875,7 +875,7 @@ printk("cm0: IP identification: %02x%02x  fragment offset: %02x%02x\n", buffer[3
        dev->last_rx = jiffies;
        stats->rx_bytes+=dlen;
        stats->rx_packets++;
-       lp->rx_skb[ns] = 0;
+       lp->rx_skb[ns] = NULL;
        lp->rx_session_id[ns] |= 0x40;
        return 0;
 
@@ -893,7 +893,7 @@ dropped_frame:
        if (ns < NPIDS) {
                if ((skb = lp->rx_skb[ns])) {
                        dev_kfree_skb(skb);
-                       lp->rx_skb[ns] = 0;
+                       lp->rx_skb[ns] = NULL;
                }
                lp->rx_session_id[ns] |= 0x40;
        }
index 63bb21b..425e89f 100644 (file)
@@ -126,7 +126,7 @@ static struct mii_chip_info {
        { "NS 83851 PHY",                       0x2000, 0x5C20, MIX },
        { "Realtek RTL8201 PHY",                0x0000, 0x8200, LAN },
        { "VIA 6103 PHY",                       0x0101, 0x8f20, LAN },
-       {0,},
+       {NULL,},
 };
 
 struct mii_phy {
@@ -1452,7 +1452,7 @@ static void sis900_tx_timeout(struct net_device *net_dev)
                                sis_priv->tx_ring[i].bufptr, skb->len,
                                PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(skb);
-                       sis_priv->tx_skbuff[i] = 0;
+                       sis_priv->tx_skbuff[i] = NULL;
                        sis_priv->tx_ring[i].cmdsts = 0;
                        sis_priv->tx_ring[i].bufptr = 0;
                        sis_priv->stats.tx_dropped++;
@@ -1847,7 +1847,7 @@ sis900_close(struct net_device *net_dev)
                                sis_priv->rx_ring[i].bufptr,
                                RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
-                       sis_priv->rx_skbuff[i] = 0;
+                       sis_priv->rx_skbuff[i] = NULL;
                }
        }
        for (i = 0; i < NUM_TX_DESC; i++) {
@@ -1857,7 +1857,7 @@ sis900_close(struct net_device *net_dev)
                                sis_priv->tx_ring[i].bufptr, skb->len,
                                PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
-                       sis_priv->tx_skbuff[i] = 0;
+                       sis_priv->tx_skbuff[i] = NULL;
                }
        }
 
index 1f3b423..76e7844 100644 (file)
@@ -1075,7 +1075,7 @@ static struct s_fpmc* mac_get_mc_table(struct s_smc *smc,
                for (i = 0 ; i < 6 ; i++, p++)
                        *p = canonical[*p] ;
        }
-       slot = ;
+       slot = NULL;
        for (i = 0, tb = smc->hw.fp.mc.table ; i < FPMAX_MULTICAST ; i++, tb++){
                if (!tb->n) {           /* not used */
                        if (!del && !slot)      /* if !del save first free */
index 8016c9a..6a74332 100644 (file)
@@ -1981,7 +1981,7 @@ void mac_drv_clear_txd(struct s_smc *smc)
 {
        struct s_smt_tx_queue *queue ;
        struct s_smt_fp_txd volatile *t1 ;
-       struct s_smt_fp_txd volatile *t2=0 ;
+       struct s_smt_fp_txd volatile *t2 = NULL ;
        SMbuf *mb ;
        u_long  tbctrl ;
        int i ;
index e9422e6..f2b446d 100644 (file)
@@ -558,8 +558,8 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
 {
        struct smt_para *pa ;
        const struct s_p_tab    *pt ;
-       struct fddi_mib_m *mib_m = ;
-       struct fddi_mib_p *mib_p = ;
+       struct fddi_mib_m *mib_m = NULL;
+       struct fddi_mib_p *mib_p = NULL;
        int             len ;
        int             plen ;
        char            *from ;
@@ -644,7 +644,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
        /*
         * check special paras
         */
-       swap = ;
+       swap = NULL;
        switch (para) {
        case SMT_P10F0 :
        case SMT_P10F1 :
@@ -1091,9 +1091,9 @@ int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local,
        char            c ;
        char            *mib_addr ;
        struct fddi_mib *mib ;
-       struct fddi_mib_m       *mib_m = ;
-       struct fddi_mib_a       *mib_a = ;
-       struct fddi_mib_p       *mib_p = ;
+       struct fddi_mib_m       *mib_m = NULL;
+       struct fddi_mib_a       *mib_a = NULL;
+       struct fddi_mib_p       *mib_p = NULL;
        int             mac ;
        int             path ;
        int             port ;
@@ -1533,7 +1533,7 @@ static const struct s_p_tab *smt_get_ptab(u_short para)
        const struct s_p_tab    *pt ;
        for (pt = p_tab ; pt->p_num && pt->p_num != para ; pt++)
                ;
-       return(pt->p_num ? pt : 0) ;
+       return(pt->p_num ? pt : NULL) ;
 }
 
 static int smt_mib_phys(struct s_smc *smc)
index 43f78c7..721569b 100644 (file)
@@ -1701,7 +1701,7 @@ void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para)
        char    *p ;
        int     len ;
        int     plen ;
-       void    *found = ;
+       void    *found = NULL;
 
        SK_UNUSED(smc) ;
 
@@ -1715,16 +1715,16 @@ void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para)
                len -= plen ;
                if (len < 0) {
                        DB_SMT("SMT : sm_to_para - length error %d\n",plen,0) ;
-                       return(0) ;
+                       return NULL;
                }
                if ((plen & 3) && (para != SMT_P_ECHODATA)) {
                        DB_SMT("SMT : sm_to_para - odd length %d\n",plen,0) ;
-                       return(0) ;
+                       return NULL;
                }
                if (found)
                        return(found) ;
        }
-       return(0) ;
+       return NULL;
 }
 
 #if    0
index 91fa855..5a0c8db 100644 (file)
@@ -262,7 +262,7 @@ static void smt_init_mib(struct s_smc *smc, int level)
                 */
                /* Attention: don't initialize mib pointer here! */
                /*  It must be initialized during phase 2 */
-               smc->y[port].mib = ;
+               smc->y[port].mib = NULL;
                mib->fddiSMTPORTIndexes[port] = port+INDEX_PORT ;
 
                pm->fddiPORTIndex = port+INDEX_PORT ;
index 0be1158..d5779e4 100644 (file)
@@ -73,7 +73,7 @@ static struct s_ptab {
        { "SBACOMMAND",16,      0 } ,
        { "SBAAVAILABLE",17,    1,      0,      100     } ,
 #endif
-       { 0 }
+       { NULL }
 } ;
 
 /* Define maximum string size for values and keybuffer */
index a82649b..531795e 100644 (file)
@@ -30,9 +30,9 @@ static void timer_done(struct s_smc *smc, int restart);
 
 void smt_timer_init(struct s_smc *smc)
 {
-       smc->t.st_queue = ;
+       smc->t.st_queue = NULL;
        smc->t.st_fast.tm_active = FALSE ;
-       smc->t.st_fast.tm_next = ;
+       smc->t.st_fast.tm_next = NULL;
        hwt_init(smc) ;
 }
 
@@ -75,7 +75,7 @@ void smt_timer_start(struct s_smc *smc, struct smt_timer *timer, u_long time,
        timer->tm_active = TRUE ;
        if (!smc->t.st_queue) {
                smc->t.st_queue = timer ;
-               timer->tm_next = ;
+               timer->tm_next = NULL;
                timer->tm_delta = time ;
                hwt_start(smc,time) ;
                return ;
@@ -141,7 +141,7 @@ static void timer_done(struct s_smc *smc, int restart)
                        done = 1 ;
                }
        }
-       *last = ;
+       *last = NULL;
        next = smc->t.st_queue ;
        smc->t.st_queue = tm ;
 
index f5b380b..16573ac 100644 (file)
@@ -167,7 +167,7 @@ static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index)
                if (evc->evc_code == code && evc->evc_index == index)
                        return(evc) ;
        }
-       return(0) ;
+       return NULL;
 }
 
 #define THRESHOLD_2    (2*TICKS_PER_SECOND)
index 44c7aa5..849b576 100644 (file)
@@ -300,7 +300,7 @@ static struct pci_id_info pci_id_tbl[] = {
        {"D-Link DFE-530TXS FAST Ethernet Adapter"},
        {"D-Link DL10050-based FAST Ethernet Adapter"},
        {"Sundance Technology Alta"},
-       {0,},                   /* 0 terminated list. */
+       {NULL,},                        /* 0 terminated list. */
 };
 
 /* This driver was written to use PCI memory space, however x86-oriented
@@ -1030,7 +1030,7 @@ static void init_ring(struct net_device *dev)
                        ((i+1)%RX_RING_SIZE)*sizeof(*np->rx_ring));
                np->rx_ring[i].status = 0;
                np->rx_ring[i].frag[0].length = 0;
-               np->rx_skbuff[i] = 0;
+               np->rx_skbuff[i] = NULL;
        }
 
        /* Fill in the Rx buffers.  Handle allocation failure gracefully. */
@@ -1049,7 +1049,7 @@ static void init_ring(struct net_device *dev)
        np->dirty_rx = (unsigned int)(i - RX_RING_SIZE);
 
        for (i = 0; i < TX_RING_SIZE; i++) {
-               np->tx_skbuff[i] = 0;
+               np->tx_skbuff[i] = NULL;
                np->tx_ring[i].status = 0;
        }
        return;
@@ -1153,7 +1153,7 @@ reset_tx (struct net_device *dev)
                                dev_kfree_skb_irq (skb);
                        else
                                dev_kfree_skb (skb);
-                       np->tx_skbuff[i] = 0;
+                       np->tx_skbuff[i] = NULL;
                        np->stats.tx_dropped++;
                }
        }
@@ -1256,7 +1256,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
                                        np->tx_ring[entry].frag[0].addr,
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
-                               np->tx_skbuff[entry] = 0;
+                               np->tx_skbuff[entry] = NULL;
                                np->tx_ring[entry].frag[0].addr = 0;
                                np->tx_ring[entry].frag[0].length = 0;
                        }
@@ -1275,7 +1275,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
                                        np->tx_ring[entry].frag[0].addr,
                                        skb->len, PCI_DMA_TODEVICE);
                                dev_kfree_skb_irq (np->tx_skbuff[entry]);
-                               np->tx_skbuff[entry] = 0;
+                               np->tx_skbuff[entry] = NULL;
                                np->tx_ring[entry].frag[0].addr = 0;
                                np->tx_ring[entry].frag[0].length = 0;
                        }
@@ -1753,7 +1753,7 @@ static int netdev_close(struct net_device *dev)
                                np->rx_ring[i].frag[0].addr, np->rx_buf_sz,
                                PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(skb);
-                       np->rx_skbuff[i] = 0;
+                       np->rx_skbuff[i] = NULL;
                }
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
@@ -1763,7 +1763,7 @@ static int netdev_close(struct net_device *dev)
                                np->tx_ring[i].frag[0].addr, skb->len,
                                PCI_DMA_TODEVICE);
                        dev_kfree_skb(skb);
-                       np->tx_skbuff[i] = 0;
+                       np->tx_skbuff[i] = NULL;
                }
        }
 
index 6fe6f36..e48ec34 100644 (file)
@@ -2024,8 +2024,7 @@ static void gem_stop_phy(struct gem *gp)
        /* Let the chip settle down a bit, it seems that helps
         * for sleep mode on some models
         */
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ/100);
+       msleep(10);
 
        /* Make sure we aren't polling PHY status change. We
         * don't currently use that feature though
@@ -2043,8 +2042,7 @@ static void gem_stop_phy(struct gem *gp)
                 * dont wait a bit here, looks like the chip takes
                 * some time to really shut down
                 */
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ/100);
+               msleep(10);
        }
 
        writel(0, gp->regs + MAC_TXCFG);
index e5b49eb..0e46154 100644 (file)
@@ -3635,9 +3635,25 @@ static int tg3_chip_reset(struct tg3 *tp)
        /* restore 5701 hardware bug workaround flag */
        tp->tg3_flags = flags_save;
 
+       /* Unfortunately, we have to delay before the PCI read back.
+        * Some 575X chips even will not respond to a PCI cfg access
+        * when the reset command is given to the chip.
+        *
+        * How do these hardware designers expect things to work
+        * properly if the PCI write is posted for a long period
+        * of time?  It is always necessary to have some method by
+        * which a register read back can occur to push the write
+        * out which does the reset.
+        *
+        * For most tg3 variants the trick below was working.
+        * Ho hum...
+        */
+       udelay(120);
+
        /* Flush PCI posted writes.  The normal MMIO registers
         * are inaccessible at this time so this is the only
-        * way to make this reliably.  I tried to use indirect
+        * way to make this reliably (actually, this is no longer
+        * the case, see above).  I tried to use indirect
         * register read/write but this upset some 5701 variants.
         */
        pci_read_config_dword(tp->pdev, PCI_COMMAND, &val);
index 4c57ab2..6454331 100644 (file)
@@ -212,7 +212,7 @@ MODULE_PARM_DESC(bbuf, "ThunderLAN use big buffer (0-1)");
 /* Define this to enable Link beat monitoring */
 #undef MONITOR
 
-/* Turn on debugging. See linux/Documentation/networking/tlan.txt for details */
+/* Turn on debugging. See Documentation/networking/tlan.txt for details */
 static  int            debug;
 
 static int             bbuf;
@@ -225,7 +225,7 @@ static  int tlan_have_eisa;
 
 const char *media[] = {
        "10BaseT-HD ", "10BaseT-FD ","100baseTx-HD ", 
-       "100baseTx-FD", "100baseT4", 0
+       "100baseTx-FD", "100baseT4", NULL
 };
 
 int media_map[] = { 0x0020, 0x0040, 0x0080, 0x0100, 0x0200,};
index 938283a..f34e40e 100644 (file)
@@ -167,7 +167,7 @@ config MADGEMC
 
 config SMCTR
        tristate "SMC ISA/MCA adapter support"
-       depends on TR && (ISA || MCA_LEGACY)
+       depends on TR && (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
        ---help---
          This is support for the ISA and MCA SMC Token Ring cards,
          specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A
index 498f612..cff6f97 100644 (file)
@@ -1535,7 +1535,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                }
        }
        /* Lite-On boards have the address byte-swapped. */
-       if ((dev->dev_addr[0] == 0xA0  ||  dev->dev_addr[0] == 0xC0)
+       if ((dev->dev_addr[0] == 0xA0  ||  dev->dev_addr[0] == 0xC0 || dev->dev_addr[0] == 0x02)
                &&  dev->dev_addr[1] == 0x00)
                for (i = 0; i < 6; i+=2) {
                        char tmp = dev->dev_addr[i];
index 5589393..6c92063 100644 (file)
@@ -748,6 +748,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
        }
 #endif /* USE_MMIO */
        dev->base_addr = ioaddr;
+       rp = netdev_priv(dev);
+       rp->quirks = quirks;
 
        rhine_power_init(dev);
 
@@ -792,10 +794,8 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
 
        dev->irq = pdev->irq;
 
-       rp = netdev_priv(dev);
        spin_lock_init(&rp->lock);
        rp->pdev = pdev;
-       rp->quirks = quirks;
        rp->mii_if.dev = dev;
        rp->mii_if.mdio_read = mdio_read;
        rp->mii_if.mdio_write = mdio_write;
@@ -980,7 +980,7 @@ static void alloc_rbufs(struct net_device *dev)
                rp->rx_ring[i].desc_length = cpu_to_le32(rp->rx_buf_sz);
                next += sizeof(struct rx_desc);
                rp->rx_ring[i].next_desc = cpu_to_le32(next);
-               rp->rx_skbuff[i] = 0;
+               rp->rx_skbuff[i] = NULL;
        }
        /* Mark the last entry as wrapping the ring. */
        rp->rx_ring[i-1].next_desc = cpu_to_le32(rp->rx_ring_dma);
@@ -1018,7 +1018,7 @@ static void free_rbufs(struct net_device* dev)
                                         rp->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        dev_kfree_skb(rp->rx_skbuff[i]);
                }
-               rp->rx_skbuff[i] = 0;
+               rp->rx_skbuff[i] = NULL;
        }
 }
 
@@ -1031,7 +1031,7 @@ static void alloc_tbufs(struct net_device* dev)
        rp->dirty_tx = rp->cur_tx = 0;
        next = rp->tx_ring_dma;
        for (i = 0; i < TX_RING_SIZE; i++) {
-               rp->tx_skbuff[i] = 0;
+               rp->tx_skbuff[i] = NULL;
                rp->tx_ring[i].tx_status = 0;
                rp->tx_ring[i].desc_length = cpu_to_le32(TXDESC);
                next += sizeof(struct tx_desc);
@@ -1060,8 +1060,8 @@ static void free_tbufs(struct net_device* dev)
                        }
                        dev_kfree_skb(rp->tx_skbuff[i]);
                }
-               rp->tx_skbuff[i] = 0;
-               rp->tx_buf[i] = 0;
+               rp->tx_skbuff[i] = NULL;
+               rp->tx_buf[i] = NULL;
        }
 }
 
index d0dd897..8b1ef3e 100644 (file)
@@ -1578,7 +1578,7 @@ calc_crc32( u32  crc,  u8  *p,  u32  len )
        register u32  _crc;
        _crc = crc;
        
-       __asm __volatile (
+       __asm__ __volatile__ (
                "xorl   %%ebx, %%ebx\n"
                "movl   %2, %%esi\n" 
                "movl   %3, %%ecx\n" 
index 41a7a97..8d38c18 100644 (file)
@@ -2615,10 +2615,10 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
 
 static void wifi_setup(struct net_device *dev)
 {
-       dev->hard_header        = 0;
-       dev->rebuild_header     = 0;
-       dev->hard_header_cache  = 0;
-       dev->header_cache_update= 0;
+       dev->hard_header        = NULL;
+       dev->rebuild_header     = NULL;
+       dev->hard_header_cache  = NULL;
+       dev->header_cache_update= NULL;
 
        dev->hard_header_parse  = wll_header_parse;
        dev->hard_start_xmit = &airo_start_xmit11;
@@ -2699,7 +2699,7 @@ struct net_device *_init_airo_card( unsigned short irq, int port,
        }
 
        ai = dev->priv;
-       ai->wifidev = 0;
+       ai->wifidev = NULL;
        ai->flags = 0;
        if (pci && (pci->device == 0x5000 || pci->device == 0xa504)) {
                printk(KERN_DEBUG "airo: Found an MPI350 card\n");
@@ -2829,7 +2829,7 @@ err_out_free:
 
 struct net_device *init_airo_card( unsigned short irq, int port, int is_pcmcia )
 {
-       return _init_airo_card ( irq, port, is_pcmcia, 0);
+       return _init_airo_card ( irq, port, is_pcmcia, NULL);
 }
 
 EXPORT_SYMBOL(init_airo_card);
@@ -4351,7 +4351,7 @@ static struct file_operations proc_wepkey_ops = {
        .release        = proc_close
 };
 
-static struct proc_dir_entry *airo_entry = 0;
+static struct proc_dir_entry *airo_entry;
 
 struct proc_data {
        int release_buffer;
@@ -5139,7 +5139,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
            (data->wbuffer[1] == ' ' || data->wbuffer[1] == '\n')) {
                index = data->wbuffer[0] - '0';
                if (data->wbuffer[1] == '\n') {
-                       set_wep_key(ai, index, 0, 0, 1, 1);
+                       set_wep_key(ai, index, NULL, 0, 1, 1);
                        return;
                }
                j = 2;
@@ -5324,8 +5324,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
        }
        data->writelen = 0;
        data->maxwritelen = 0;
-       data->wbuffer = 0;
-       data->on_close = 0;
+       data->wbuffer = NULL;
+       data->on_close = NULL;
 
        if (file->f_mode & FMODE_WRITE) {
                if (!(file->f_mode & FMODE_READ)) {
@@ -5386,7 +5386,7 @@ static int proc_close( struct inode *inode, struct file *file )
 static struct net_device_list {
        struct net_device *dev;
        struct net_device_list *next;
-} *airo_devices = 0;
+} *airo_devices;
 
 /* Since the card doesn't automatically switch to the right WEP mode,
    we will make it do it.  If the card isn't associated, every secs we
@@ -5407,13 +5407,13 @@ static void timer_func( struct net_device *dev ) {
                        break;
                case AUTH_SHAREDKEY:
                        if (apriv->keyindex < auto_wep) {
-                               set_wep_key(apriv, apriv->keyindex, 0, 0, 0, 0);
+                               set_wep_key(apriv, apriv->keyindex, NULL, 0, 0, 0);
                                apriv->config.authType = AUTH_SHAREDKEY;
                                apriv->keyindex++;
                        } else {
                                /* Drop to ENCRYPT */
                                apriv->keyindex = 0;
-                               set_wep_key(apriv, apriv->defindex, 0, 0, 0, 0);
+                               set_wep_key(apriv, apriv->defindex, NULL, 0, 0, 0);
                                apriv->config.authType = AUTH_ENCRYPT;
                        }
                        break;
@@ -6207,7 +6207,7 @@ static int airo_set_encode(struct net_device *dev,
                /* Do we want to just set the transmit key index ? */
                int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
                if ((index >= 0) && (index < ((cap_rid.softCap & 0x80)?4:1))) {
-                       set_wep_key(local, index, 0, 0, 1, 1);
+                       set_wep_key(local, index, NULL, 0, 1, 1);
                } else
                        /* Don't complain if only change the mode */
                        if(!dwrq->flags & IW_ENCODE_MODE) {
index b2e0152..86da31c 100644 (file)
@@ -399,7 +399,7 @@ static int arlan_setup_card_by_book(struct net_device *dev)
 static char arlan_drive_info[ARLAN_STR_SIZE] = "A655\n\0";
 
 static int arlan_sysctl_info(ctl_table * ctl, int write, struct file *filp,
-                     void __user *buffer, size_t * lenp)
+                     void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int i;
        int retv, pos, devnum;
@@ -625,7 +625,7 @@ final:
        *lenp = pos;
 
        if (!write)
-               retv = proc_dostring(ctl, write, filp, buffer, lenp);
+               retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
        else
        {
                *lenp = 0;
@@ -636,7 +636,7 @@ final:
 
 
 static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp,
-                           void __user *buffer, size_t * lenp)
+                           void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int i;
        int retv, pos, devnum;
@@ -665,12 +665,12 @@ static int arlan_sysctl_info161719(ctl_table * ctl, int write, struct file *filp
 
 final:
        *lenp = pos;
-       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+       retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
        return retv;
 }
 
 static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp,
-                           void __user *buffer, size_t * lenp)
+                           void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int i;
        int retv, pos, devnum;
@@ -694,12 +694,12 @@ static int arlan_sysctl_infotxRing(ctl_table * ctl, int write, struct file *filp
        SARLBNpln(u_char, txBuffer, 0x800);
 final:
        *lenp = pos;
-       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+       retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
        return retv;
 }
 
 static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp,
-                           void __user *buffer, size_t * lenp)
+                           void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int i;
        int retv, pos, devnum;
@@ -722,12 +722,12 @@ static int arlan_sysctl_inforxRing(ctl_table * ctl, int write, struct file *filp
        SARLBNpln(u_char, rxBuffer, 0x800);
 final:
        *lenp = pos;
-       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+       retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
        return retv;
 }
 
 static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
-                       void __user *buffer, size_t * lenp)
+                       void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int i;
        int retv, pos, devnum;
@@ -752,7 +752,7 @@ static int arlan_sysctl_info18(ctl_table * ctl, int write, struct file *filp,
 
 final:
        *lenp = pos;
-       retv = proc_dostring(ctl, write, filp, buffer, lenp);
+       retv = proc_dostring(ctl, write, filp, buffer, lenp, ppos);
        return retv;
 }
 
@@ -763,7 +763,7 @@ final:
 static char conf_reset_result[200];
 
 static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
-                   void __user *buffer, size_t * lenp)
+                   void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int pos = 0;
        int devnum = ctl->procname[6] - '0';
@@ -784,11 +784,11 @@ static int arlan_configure(ctl_table * ctl, int write, struct file *filp,
                return -1;
 
        *lenp = pos;
-       return proc_dostring(ctl, write, filp, buffer, lenp);
+       return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
-                      void __user *buffer, size_t * lenp)
+                      void __user *buffer, size_t * lenp, loff_t *ppos)
 {
        int pos = 0;
        int devnum = ctl->procname[5] - '0';
@@ -807,7 +807,7 @@ static int arlan_sysctl_reset(ctl_table * ctl, int write, struct file *filp,
        } else
                return -1;
        *lenp = pos + 3;
-       return proc_dostring(ctl, write, filp, buffer, lenp);
+       return proc_dostring(ctl, write, filp, buffer, lenp, ppos);
 }
 
 
index 2da0102..cde68a4 100644 (file)
@@ -2647,12 +2647,12 @@ static void send_authentication_request(struct atmel_private *priv, u8 *challeng
        memcpy(header.addr3, priv->CurrentBSSID, 6);
        
        if (priv->wep_is_on) {
-               auth.alg = C80211_MGMT_AAN_SHAREDKEY
+               auth.alg = cpu_to_le16(C80211_MGMT_AAN_SHAREDKEY)
                /* no WEP for authentication frames with TrSeqNo 1 */
                if (priv->CurrentAuthentTransactionSeqNum != 1)
                        header.frame_ctl |=  cpu_to_le16(IEEE802_11_FCTL_WEP); 
        } else {
-               auth.alg = C80211_MGMT_AAN_OPENSYSTEM;
+               auth.alg = cpu_to_le16(C80211_MGMT_AAN_OPENSYSTEM);
        }
 
        auth.status = 0;
index dd50660..3ee3102 100644 (file)
@@ -18,8 +18,6 @@
  *
  */
 
-#define __KERNEL_SYSCALLS__
-
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/types.h>
index 7aa05d6..7924b36 100644 (file)
@@ -436,7 +436,7 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info,
 {
        struct iw_range *range = (struct iw_range *) extra;
        islpci_private *priv = netdev_priv(ndev);
-       char *data;
+       u8 *data;
        int i, m, rvalue;
        struct obj_frequencies *freq;
        union oid_res_t r;
@@ -513,8 +513,7 @@ prism54_get_range(struct net_device *ndev, struct iw_request_info *info,
        i = 0;
        while ((i < IW_MAX_BITRATES) && (*data != 0)) {
                /*       the result must be in bps. The card gives us 500Kbps */
-               range->bitrate[i] = (__s32) (*data >> 1);
-               range->bitrate[i] *= 1000000;
+               range->bitrate[i] = *data * 500000;
                i++;
                data++;
        }
@@ -820,9 +819,11 @@ prism54_set_rate(struct net_device *ndev,
                return mgt_set_request(priv, DOT11_OID_PROFILES, 0, &profile);
        }
 
-       if ((ret =
-            mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r)))
+       ret = mgt_get_request(priv, DOT11_OID_SUPPORTEDRATES, 0, NULL, &r);
+       if (ret) {
+               kfree(r.ptr);
                return ret;
+       }
 
        rate = (u32) (vwrq->value / 500000);
        data = r.ptr;
@@ -840,6 +841,7 @@ prism54_set_rate(struct net_device *ndev,
        }
 
        if (!data[i]) {
+               kfree(r.ptr);
                return -EINVAL;
        }
 
@@ -888,8 +890,11 @@ prism54_get_rate(struct net_device *ndev,
        vwrq->value = r.u * 500000;
 
        /* request the device for the enabled rates */
-       if ((rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r)))
+       rvalue = mgt_get_request(priv, DOT11_OID_RATES, 0, NULL, &r);
+       if (rvalue) {
+               kfree(r.ptr);
                return rvalue;
+       }
        data = r.ptr;
        vwrq->fixed = (data[0] != 0) && (data[1] == 0);
        kfree(r.ptr);
@@ -1942,7 +1947,7 @@ prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
 {
        islpci_private *priv = netdev_priv(ndev);
        struct islpci_mgmtframe *response = NULL;
-       int ret = -EIO, response_op = PIMFOR_OP_ERROR;
+       int ret = -EIO;
 
        printk("%s: get_oid 0x%08X\n", ndev->name, priv->priv_oid);
        data->length = 0;
@@ -1952,9 +1957,7 @@ prism54_debug_get_oid(struct net_device *ndev, struct iw_request_info *info,
                    islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
                                           priv->priv_oid, extra, 256,
                                           &response);
-               response_op = response->header->operation;
                printk("%s: ret: %i\n", ndev->name, ret);
-               printk("%s: response_op: %i\n", ndev->name, response_op);
                if (ret || !response
                    || response->header->operation == PIMFOR_OP_ERROR) {
                        if (response) {
@@ -1991,16 +1994,20 @@ prism54_debug_set_oid(struct net_device *ndev, struct iw_request_info *info,
                                           priv->priv_oid, extra, data->length,
                                           &response);
                printk("%s: ret: %i\n", ndev->name, ret);
+               if (ret || !response
+                   || response->header->operation == PIMFOR_OP_ERROR) {
+                       if (response) {
+                               islpci_mgt_release(response);
+                       }
+                       printk("%s: EIO\n", ndev->name);
+                       ret = -EIO;
+               }
                if (!ret) {
                        response_op = response->header->operation;
                        printk("%s: response_op: %i\n", ndev->name,
                               response_op);
                        islpci_mgt_release(response);
                }
-               if (ret || response_op == PIMFOR_OP_ERROR) {
-                       printk("%s: EIO\n", ndev->name);
-                       ret = -EIO;
-               }
        }
 
        return (ret ? ret : -EINPROGRESS);
index 62847f4..d96d621 100644 (file)
@@ -39,6 +39,7 @@
 #include "oid_mgt.h"
 
 #define ISL3877_IMAGE_FILE     "isl3877"
+#define ISL3886_IMAGE_FILE     "isl3886"
 #define ISL3890_IMAGE_FILE     "isl3890"
 
 static int prism54_bring_down(islpci_private *);
@@ -82,7 +83,7 @@ isl_upload_firmware(islpci_private *priv)
        mdelay(50);
 
        {
-               const struct firmware *fw_entry = 0;
+               const struct firmware *fw_entry = NULL;
                long fw_len;
                const u32 *fw_ptr;
 
@@ -185,6 +186,9 @@ islpci_interrupt(int irq, void *config, struct pt_regs *regs)
        void *device = priv->device_base;
        int powerstate = ISL38XX_PSM_POWERSAVE_STATE;
 
+       /* lock the interrupt handler */
+       spin_lock(&priv->slock);
+
        /* received an interrupt request on a shared IRQ line
         * first check whether the device is in sleep mode */
        reg = readl(device + ISL38XX_CTRL_STAT_REG);
@@ -194,14 +198,10 @@ islpci_interrupt(int irq, void *config, struct pt_regs *regs)
 #if VERBOSE > SHOW_ERROR_MESSAGES
                DEBUG(SHOW_TRACING, "Assuming someone else called the IRQ\n");
 #endif
+               spin_unlock(&priv->slock);
                return IRQ_NONE;
        }
 
-       if (islpci_get_state(priv) != PRV_STATE_SLEEP)
-               powerstate = ISL38XX_PSM_ACTIVE_STATE;
-
-       /* lock the interrupt handler */
-       spin_lock(&priv->slock);
 
        /* check whether there is any source of interrupt on the device */
        reg = readl(device + ISL38XX_INT_IDENT_REG);
@@ -212,6 +212,9 @@ islpci_interrupt(int irq, void *config, struct pt_regs *regs)
        reg &= ISL38XX_INT_SOURCES;
 
        if (reg != 0) {
+               if (islpci_get_state(priv) != PRV_STATE_SLEEP)
+                       powerstate = ISL38XX_PSM_ACTIVE_STATE;
+
                /* reset the request bits in the Identification register */
                isl38xx_w32_flush(device, reg, ISL38XX_INT_ACK_REG);
 
@@ -339,6 +342,12 @@ islpci_interrupt(int irq, void *config, struct pt_regs *regs)
                        isl38xx_handle_wakeup(priv->control_block,
                                              &powerstate, priv->device_base);
                }
+       } else {
+#if VERBOSE > SHOW_ERROR_MESSAGES
+               DEBUG(SHOW_TRACING, "Assuming someone else called the IRQ\n");
+#endif
+               spin_unlock(&priv->slock);
+               return IRQ_NONE;
        }
 
        /* sleep -> ready */
@@ -716,7 +725,7 @@ islpci_free_memory(islpci_private *priv)
 
        if (priv->device_base)
                iounmap(priv->device_base);
-       priv->device_base = 0;
+       priv->device_base = NULL;
 
        /* free consistent DMA area... */
        if (priv->driver_mem_address)
@@ -725,10 +734,10 @@ islpci_free_memory(islpci_private *priv)
                                    priv->device_host_address);
 
        /* clear some dangling pointers */
-       priv->driver_mem_address = 0;
+       priv->driver_mem_address = NULL;
        priv->device_host_address = 0;
        priv->device_psm_buffer = 0;
-       priv->control_block = 0;
+       priv->control_block = NULL;
 
         /* clean up mgmt rx buffers */
         for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) {
@@ -754,7 +763,7 @@ islpci_free_memory(islpci_private *priv)
 
                if (priv->data_low_rx[counter])
                        dev_kfree_skb(priv->data_low_rx[counter]);
-               priv->data_low_rx[counter] = 0;
+               priv->data_low_rx[counter] = NULL;
        }
 
        /* Free the acces control list and the WPA list */
@@ -856,14 +865,14 @@ islpci_setup(struct pci_dev *pdev)
 
        /* select the firmware file depending on the device id */
        switch (pdev->device) {
-       case PCIDEVICE_ISL3890:
-       case PCIDEVICE_3COM6001:
-               strcpy(priv->firmware, ISL3890_IMAGE_FILE);
-               break;
-       case PCIDEVICE_ISL3877:
+       case 0x3877:
                strcpy(priv->firmware, ISL3877_IMAGE_FILE);
                break;
 
+       case 0x3886:
+               strcpy(priv->firmware, ISL3886_IMAGE_FILE);
+               break;
+
        default:
                strcpy(priv->firmware, ISL3890_IMAGE_FILE);
                break;
@@ -880,9 +889,9 @@ islpci_setup(struct pci_dev *pdev)
       do_islpci_free_memory:
        islpci_free_memory(priv);
       do_free_netdev:
-       pci_set_drvdata(pdev, 0);
+       pci_set_drvdata(pdev, NULL);
        free_netdev(ndev);
-       priv = 0;
+       priv = NULL;
        return NULL;
 }
 
index 35bde67..11b315b 100644 (file)
@@ -36,107 +36,38 @@ MODULE_AUTHOR("[Intersil] R.Bastings and W.Termorshuizen, The prism54.org Develo
 MODULE_DESCRIPTION("The Prism54 802.11 Wireless LAN adapter");
 MODULE_LICENSE("GPL");
 
+static int     init_pcitm = 0;
+module_param(init_pcitm, int, 0);
+
 /* In this order: vendor, device, subvendor, subdevice, class, class_mask,
  * driver_data 
  * If you have an update for this please contact prism54-devel@prism54.org 
  * The latest list can be found at http://prism54.org/supported_cards.php */
 static const struct pci_device_id prism54_id_tbl[] = {
-       /* 3COM 3CRWE154G72 Wireless LAN adapter */
-       {
-        PCIVENDOR_3COM, PCIDEVICE_3COM6001,
-        PCIVENDOR_3COM, PCIDEVICE_3COM6001,
-        0, 0, 0
-       },
-
-       /* D-Link Air Plus Xtreme G A1 - DWL-g650 A1 */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_DLINK, 0x3202UL, 
-        0, 0, 0
-       },
-
-       /* I-O Data WN-G54/CB - WN-G54/CB */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_IODATA, 0xd019UL, 
-        0, 0, 0
-       },
-
-       /* Netgear WG511 */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_NETGEAR, 0x4800UL,
-        0, 0, 0
-       },
-
-       /* Tekram Technology clones, Allnet, Netcomm, Zyxel */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_TTL, 0x1605UL,
-        0, 0, 0
-       },
-
-       /* SMC2802W */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0x2802UL,
-        0, 0, 0
-       },
-
-       /* SMC2835W */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0x2835UL,
-        0, 0, 0
-       },
-
-       /* Corega CG-WLCB54GT */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_ATI, 0xc104UL,
-        0, 0, 0
-       },
-
-       /* I4 Z-Com XG-600 */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_I4, 0x0014UL,
-        0, 0, 0
-       },
-
-       /* I4 Z-Com XG-900  and clones Macer, Ovislink, Planex, Peabird, */
-       /* Sitecom, Xterasys */
-       {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_I4, 0x0020UL,
-        0, 0, 0
-       },
-
-       /* SMC 2802W V2 */
+       /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_ACCTON, 0xee03UL,
+        0x1260, 0x3890,
+        PCI_ANY_ID, PCI_ANY_ID,
         0, 0, 0
        },
 
-       /* SMC 2835W V2 */
+       /* 3COM 3CRWE154G72 Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
-        PCIVENDOR_SMC, 0xa835UL,
+        0x10b7, 0x6001,
+        PCI_ANY_ID, PCI_ANY_ID,
         0, 0, 0
        },
 
        /* Intersil PRISM Indigo Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3877,
+        0x1260, 0x3877,
         PCI_ANY_ID, PCI_ANY_ID,
         0, 0, 0
        },
 
-       /* Intersil PRISM Duette/Prism GT Wireless LAN adapter */
-       /* Default */
+       /* Intersil PRISM Javelin/Xbow Wireless LAN adapter */
        {
-        PCIVENDOR_INTERSIL, PCIDEVICE_ISL3890,
+        0x1260, 0x3886,
         PCI_ANY_ID, PCI_ANY_ID,
         0, 0, 0
        },
@@ -163,85 +94,6 @@ static struct pci_driver prism54_driver = {
        /* .enable_wake ; we don't support this yet */
 };
 
-static void
-prism54_get_card_model(struct net_device *ndev)
-{
-       islpci_private  *priv;
-       char            *modelp;
-       int             notwork = 0;
-
-       priv = netdev_priv(ndev);
-       switch (priv->pdev->subsystem_device) {
-       case PCIDEVICE_ISL3877:
-               modelp = "PRISM Indigo";
-               break;
-       case PCIDEVICE_ISL3886:
-               modelp = "PRISM Javelin / Xbow";
-               break;
-       case PCIDEVICE_3COM6001:
-               modelp = "3COM 3CRWE154G72";
-               break;
-       case 0x3202UL:
-               modelp = "D-Link DWL-g650 A1";
-               break;
-       case 0xd019UL:
-               modelp = "WN-G54/CB";
-               break;
-       case 0x4800UL:
-               modelp = "Netgear WG511";
-               break;
-       case 0x2802UL:
-               modelp = "SMC2802W";
-               break;
-       case 0xee03UL:
-               modelp = "SMC2802W V2";
-               notwork = 1;
-               break;
-       case 0x2835UL:
-               modelp = "SMC2835W";
-               break;
-       case 0xa835UL:
-               modelp = "SMC2835W V2";
-               notwork = 1;
-               break;
-       case 0xc104UL:
-               modelp = "CG-WLCB54GT";
-               break;
-       case 0x1605UL:
-               modelp = "Tekram Technology clone";
-               break;
-       /* Let's leave this one out for now since it seems bogus/wrong 
-        * Even if the manufacturer did use 0x0000UL it may not be correct
-        * by their part, therefore deserving no name ;) */
-       /*      case 0x0000UL: 
-        *              modelp = "SparkLAN WL-850F";
-        *              break;*/
-
-       /* We have two reported for the one below :( */
-       case 0x0014UL:
-               modelp = "I4 Z-Com XG-600 and clones";
-               break;
-       case 0x0020UL:
-               modelp = "I4 Z-Com XG-900 and clones";
-               break;
-/* Default it */
-/*
-       case PCIDEVICE_ISL3890:
-               modelp = "PRISM Duette/GT";
-               break;
-*/
-       default:
-               modelp = "PRISM Duette/GT";
-       }
-       printk(KERN_DEBUG "%s: %s driver detected card model: %s\n",
-                       ndev->name, DRV_NAME, modelp);
-       if ( notwork ) {
-               printk(KERN_DEBUG "%s: %s Warning - This may not work\n",
-                       ndev->name, DRV_NAME);
-       }
-       return;
-}
-
 /******************************************************************************
     Module initialization functions
 ******************************************************************************/
@@ -292,14 +144,14 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
         *
         *      Writing zero to both these two registers will disable both timeouts and
         *      *can* solve problems caused by devices that are slow to respond.
+        *      Make this configurable - MSW
         */
-       /*      I am taking these out, we should not be poking around in the
-        *      programmable timers - MSW
-       */
-/*     Do not zero the programmable timers
-       pci_write_config_byte(pdev, 0x40, 0);
-       pci_write_config_byte(pdev, 0x41, 0);
-*/
+       if ( init_pcitm >= 0 ) {
+               pci_write_config_byte(pdev, 0x40, (u8)init_pcitm);
+               pci_write_config_byte(pdev, 0x41, (u8)init_pcitm);
+       } else {
+               printk(KERN_INFO "PCI TRDY/RETRY unchanged\n");
+       }
 
        /* request the pci device I/O regions */
        rvalue = pci_request_regions(pdev, DRV_NAME);
@@ -351,17 +203,14 @@ prism54_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        /* firmware upload is triggered in islpci_open */
 
-       /* Pretty card model discovery output */
-       prism54_get_card_model(ndev);
-
        return 0;
 
       do_unregister_netdev:
        unregister_netdev(ndev);
        islpci_free_memory(priv);
-       pci_set_drvdata(pdev, 0);
+       pci_set_drvdata(pdev, NULL);
        free_netdev(ndev);
-       priv = 0;
+       priv = NULL;
       do_pci_release_regions:
        pci_release_regions(pdev);
       do_pci_disable_device:
@@ -377,7 +226,7 @@ void
 prism54_remove(struct pci_dev *pdev)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        if (!__in_cleanup_module) {
@@ -405,9 +254,9 @@ prism54_remove(struct pci_dev *pdev)
        /* free the PCI memory and unmap the remapped page */
        islpci_free_memory(priv);
 
-       pci_set_drvdata(pdev, 0);
+       pci_set_drvdata(pdev, NULL);
        free_netdev(ndev);
-       priv = 0;
+       priv = NULL;
 
        pci_release_regions(pdev);
 
@@ -418,7 +267,7 @@ int
 prism54_suspend(struct pci_dev *pdev, u32 state)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        printk(KERN_NOTICE "%s: got suspend request (state %d)\n",
@@ -443,7 +292,7 @@ int
 prism54_resume(struct pci_dev *pdev)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
-       islpci_private *priv = ndev ? netdev_priv(ndev) : 0;
+       islpci_private *priv = ndev ? netdev_priv(ndev) : NULL;
        BUG_ON(!priv);
 
        printk(KERN_NOTICE "%s: got resume request\n", ndev->name);
index 58cd358..95b709c 100644 (file)
@@ -458,6 +458,8 @@ islpci_mgt_transaction(struct net_device *ndev,
        int err;
        DEFINE_WAIT(wait);
 
+       *recvframe = NULL;
+
        if (down_interruptible(&priv->mgmt_sem))
                return -ERESTARTSYS;
 
index 2e8f8ea..21303fc 100644 (file)
@@ -38,21 +38,6 @@ extern int pc_debug;
 
 
 /* General driver definitions */
-#define PCIVENDOR_INTERSIL                      0x1260UL
-#define PCIVENDOR_3COM                         0x10b7UL
-#define PCIVENDOR_DLINK                                0x1186UL
-#define PCIVENDOR_I4                           0x17cfUL
-#define PCIVENDOR_IODATA                       0x10fcUL
-#define PCIVENDOR_NETGEAR                      0x1385UL
-#define PCIVENDOR_SMC                          0x10b8UL
-#define PCIVENDOR_ACCTON                       0x1113UL
-#define PCIVENDOR_ATI                          0x1259UL
-#define PCIVENDOR_TTL                          0x16a5UL
-
-#define PCIDEVICE_ISL3877                       0x3877UL
-#define PCIDEVICE_ISL3886                       0x3886UL
-#define PCIDEVICE_ISL3890                       0x3890UL
-#define        PCIDEVICE_3COM6001                      0x6001UL
 #define PCIDEVICE_LATENCY_TIMER_MIN            0x40
 #define PCIDEVICE_LATENCY_TIMER_VAL            0x50
 
index 65085ee..333926d 100644 (file)
@@ -219,7 +219,7 @@ struct oid_t isl_oid[] = {
        OID_UNKNOWN(OID_INL_MEMORY, 0xFF020002),
        OID_U32_C(OID_INL_MODE, 0xFF020003),
        OID_UNKNOWN(OID_INL_COMPONENT_NR, 0xFF020004),
-       OID_UNKNOWN(OID_INL_VERSION, 0xFF020005),
+       OID_STRUCT(OID_INL_VERSION, 0xFF020005, u8[8], OID_TYPE_RAW),
        OID_UNKNOWN(OID_INL_INTERFACE_ID, 0xFF020006),
        OID_UNKNOWN(OID_INL_COMPONENT_ID, 0xFF020007),
        OID_U32_C(OID_INL_CONFIG, 0xFF020008),
@@ -408,7 +408,7 @@ int
 mgt_set_request(islpci_private *priv, enum oid_num_t n, int extra, void *data)
 {
        int ret = 0;
-       struct islpci_mgmtframe *response;
+       struct islpci_mgmtframe *response = NULL;
        int response_op = PIMFOR_OP_ERROR;
        int dlen;
        void *cache, *_data = data;
@@ -481,6 +481,8 @@ mgt_get_request(islpci_private *priv, enum oid_num_t n, int extra, void *data,
        BUG_ON(OID_NUM_LAST <= n);
        BUG_ON(extra > isl_oid[n].range);
 
+       res->ptr = NULL;
+
        if (!priv->mib)
                /* memory has been freed */
                return -1;
@@ -613,14 +615,16 @@ static enum oid_num_t commit_part2[] = {
        DOT11_OID_DEFKEYID,
        DOT11_OID_DOT1XENABLE,
        OID_INL_DOT11D_CONFORMANCE,
+       /* Do not initialize this - fw < 1.0.4.3 rejects it
        OID_INL_OUTPUTPOWER,
+       */
 };
 
 /* update the MAC addr. */
 static int
 mgt_update_addr(islpci_private *priv)
 {
-       struct islpci_mgmtframe *res;
+       struct islpci_mgmtframe *res = NULL;
        int ret;
 
        ret = islpci_mgt_transaction(priv->ndev, PIMFOR_OP_GET,
index eaafb42..8148219 100644 (file)
@@ -286,7 +286,7 @@ static struct pci_id_info pci_id_tbl[] = {
         FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
        {"Symbios SYM83C885", { 0x07011000, 0xffffffff},
         PCI_IOTYPE, YELLOWFIN_SIZE, HasMII | DontUseEeprom },
-       {0,},
+       {NULL,},
 };
 
 static struct pci_device_id yellowfin_pci_tbl[] = {
@@ -805,7 +805,7 @@ static void yellowfin_init_ring(struct net_device *dev)
 #ifdef NO_TXSTATS
        /* In this mode the Tx ring needs only a single descriptor. */
        for (i = 0; i < TX_RING_SIZE; i++) {
-               yp->tx_skbuff[i] = 0;
+               yp->tx_skbuff[i] = NULL;
                yp->tx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
                yp->tx_ring[i].branch_addr = cpu_to_le32(yp->tx_ring_dma +
                        ((i+1)%TX_RING_SIZE)*sizeof(struct yellowfin_desc));
@@ -987,7 +987,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance, struct pt_re
                        pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr,
                                skb->len, PCI_DMA_TODEVICE);
                        dev_kfree_skb_irq(skb);
-                       yp->tx_skbuff[entry] = 0;
+                       yp->tx_skbuff[entry] = NULL;
                }
                if (yp->tx_full
                        && yp->cur_tx - yp->dirty_tx < TX_QUEUE_SIZE - 4) {
@@ -1320,12 +1320,12 @@ static int yellowfin_close(struct net_device *dev)
                if (yp->rx_skbuff[i]) {
                        dev_kfree_skb(yp->rx_skbuff[i]);
                }
-               yp->rx_skbuff[i] = 0;
+               yp->rx_skbuff[i] = NULL;
        }
        for (i = 0; i < TX_RING_SIZE; i++) {
                if (yp->tx_skbuff[i])
                        dev_kfree_skb(yp->tx_skbuff[i]);
-               yp->tx_skbuff[i] = 0;
+               yp->tx_skbuff[i] = NULL;
        }
 
 #ifdef YF_PROTOTYPE                    /* Support for prototype hardware errata. */
index b80990d..d9746f1 100644 (file)
@@ -47,23 +47,7 @@ static struct super_operations s_ops = {
 
 ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count, loff_t * offset)
 {
-       size_t len = strlen(str);
-
-       if (!count)
-               return 0;
-
-       if (*offset > len)
-               return 0;
-
-       if (count > len - *offset)
-               count = len - *offset;
-
-       if (copy_to_user(buf, str + *offset, count))
-               return -EFAULT;
-
-       *offset += count;
-
-       return count;
+       return simple_read_from_buffer(buf, count, offset, str, strlen(str));
 }
 
 
@@ -72,29 +56,10 @@ ssize_t oprofilefs_str_to_user(char const * str, char __user * buf, size_t count
 ssize_t oprofilefs_ulong_to_user(unsigned long val, char __user * buf, size_t count, loff_t * offset)
 {
        char tmpbuf[TMPBUFSIZE];
-       size_t maxlen;
-
-       if (!count)
-               return 0;
-
-       spin_lock(&oprofilefs_lock);
-       maxlen = snprintf(tmpbuf, TMPBUFSIZE, "%lu\n", val);
-       spin_unlock(&oprofilefs_lock);
+       size_t maxlen = snprintf(tmpbuf, TMPBUFSIZE, "%lu\n", val);
        if (maxlen > TMPBUFSIZE)
                maxlen = TMPBUFSIZE;
-
-       if (*offset > maxlen)
-               return 0;
-
-       if (count > maxlen - *offset)
-               count = maxlen - *offset;
-
-       if (copy_to_user(buf, tmpbuf + *offset, count))
-               return -EFAULT;
-
-       *offset += count;
-
-       return count;
+       return simple_read_from_buffer(buf, count, offset, tmpbuf, maxlen);
 }
 
 
index ad78115..6357ec1 100644 (file)
@@ -419,8 +419,10 @@ superio_serial_init(void)
 {
 #ifdef CONFIG_SERIAL_8250
        int retval;
+#ifdef CONFIG_SERIAL_8250_CONSOLE
        extern void serial8250_console_init(void); /* drivers/serial/8250.c */
-       
+#endif        
+        
        if (!sio_dev.irq_region)
                return; /* superio not present */
 
@@ -438,8 +440,10 @@ superio_serial_init(void)
                return;
        }
 
+#ifdef CONFIG_SERIAL_8250_CONSOLE
        serial8250_console_init();
-
+#endif
+        
        serial[1].iobase = sio_dev.sp2_base;
        serial[1].irq = sio_dev.irq_region->data.irqbase + SP2_IRQ;
        retval = early_serial_setup(&serial[1]);
index afa6ac4..061097f 100644 (file)
@@ -33,7 +33,7 @@
 #define PARPORT_MAX_SPINTIME_VALUE 1000
 
 static int do_active_device(ctl_table *table, int write, struct file *filp,
-                     void __user *result, size_t *lenp)
+                     void __user *result, size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
        char buffer[256];
@@ -43,7 +43,7 @@ static int do_active_device(ctl_table *table, int write, struct file *filp,
        if (write)              /* can't happen anyway */
                return -EACCES;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -63,14 +63,14 @@ static int do_active_device(ctl_table *table, int write, struct file *filp,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 #ifdef CONFIG_PARPORT_1284
 static int do_autoprobe(ctl_table *table, int write, struct file *filp,
-                       void __user *result, size_t *lenp)
+                       void __user *result, size_t *lenp, loff_t *ppos)
 {
        struct parport_device_info *info = table->extra2;
        const char *str;
@@ -80,7 +80,7 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
        if (write) /* permissions stop this */
                return -EACCES;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -105,7 +105,7 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user (result, buffer, len) ? -EFAULT : 0;
 }
@@ -113,13 +113,13 @@ static int do_autoprobe(ctl_table *table, int write, struct file *filp,
 
 static int do_hardware_base_addr (ctl_table *table, int write,
                                  struct file *filp, void __user *result,
-                                 size_t *lenp)
+                                 size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
        char buffer[20];
        int len = 0;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -134,20 +134,20 @@ static int do_hardware_base_addr (ctl_table *table, int write,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_irq (ctl_table *table, int write,
                            struct file *filp, void __user *result,
-                           size_t *lenp)
+                           size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
        char buffer[20];
        int len = 0;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -162,20 +162,20 @@ static int do_hardware_irq (ctl_table *table, int write,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_dma (ctl_table *table, int write,
                            struct file *filp, void __user *result,
-                           size_t *lenp)
+                           size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
        char buffer[20];
        int len = 0;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -190,20 +190,20 @@ static int do_hardware_dma (ctl_table *table, int write,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
 
 static int do_hardware_modes (ctl_table *table, int write,
                              struct file *filp, void __user *result,
-                             size_t *lenp)
+                             size_t *lenp, loff_t *ppos)
 {
        struct parport *port = (struct parport *)table->extra1;
        char buffer[40];
        int len = 0;
 
-       if (filp->f_pos) {
+       if (*ppos) {
                *lenp = 0;
                return 0;
        }
@@ -229,7 +229,7 @@ static int do_hardware_modes (ctl_table *table, int write,
        else
                *lenp = len;
 
-       filp->f_pos += len;
+       *ppos += len;
 
        return copy_to_user(result, buffer, len) ? -EFAULT : 0;
 }
index 03681b9..929012e 100644 (file)
@@ -1,22 +1,15 @@
 #
 # PCI configuration
 #
-config PCI_USE_VECTOR
-       bool "Vector-based interrupt indexing (MSI)"
+config PCI_MSI
+       bool "Message Signaled Interrupts (MSI and MSI-X)"
        depends on (X86_LOCAL_APIC && X86_IO_APIC) || IA64
        default n
        help
-          This replaces the current existing IRQ-based index interrupt scheme
-          with the vector-base index scheme. The advantages of vector base
-          over IRQ base are listed below:
-          1) Support MSI implementation.
-          2) Support future IOxAPIC hotplug
-
-          Note that this allows the device drivers to enable MSI, Message
-          Signaled Interrupt, on all MSI capable device functions detected.
-          Message Signal Interrupt enables an MSI-capable hardware device to
-          send an inbound Memory Write on its PCI bus instead of asserting
-          IRQ signal on device IRQ pin.
+          This allows device drivers to enable MSI (Message Signaled
+          Interrupts).  Message Signaled Interrupts enable a device to
+          generate an interrupt using an inbound Memory Write on its
+          PCI bus instead of asserting a device IRQ pin.
 
           If you don't know what to do here, say N.
 
index 35c73b9..d4c89d7 100644 (file)
@@ -64,15 +64,13 @@ static void msi_set_mask_bit(unsigned int vector, int flag)
        case PCI_CAP_ID_MSI:
        {
                int             pos;
-               unsigned int    mask_bits;
+               u32             mask_bits;
 
                pos = entry->mask_base;
-               entry->dev->bus->ops->read(entry->dev->bus, entry->dev->devfn,
-                               pos, 4, &mask_bits);
+               pci_read_config_dword(entry->dev, pos, &mask_bits);
                mask_bits &= ~(1);
                mask_bits |= flag;
-               entry->dev->bus->ops->write(entry->dev->bus, entry->dev->devfn,
-                               pos, 4, mask_bits);
+               pci_write_config_dword(entry->dev, pos, mask_bits);
                break;
        }
        case PCI_CAP_ID_MSIX:
@@ -105,15 +103,13 @@ static void set_msi_affinity(unsigned int vector, cpumask_t cpu_mask)
                if (!(pos = pci_find_capability(entry->dev, PCI_CAP_ID_MSI)))
                        return;
 
-               entry->dev->bus->ops->read(entry->dev->bus, entry->dev->devfn,
-                       msi_lower_address_reg(pos), 4,
+               pci_read_config_dword(entry->dev, msi_lower_address_reg(pos),
                        &address.lo_address.value);
                address.lo_address.value &= MSI_ADDRESS_DEST_ID_MASK;
                address.lo_address.value |= (cpu_mask_to_apicid(cpu_mask) <<
                        MSI_TARGET_CPU_SHIFT);
                entry->msi_attrib.current_cpu = cpu_mask_to_apicid(cpu_mask);
-               entry->dev->bus->ops->write(entry->dev->bus, entry->dev->devfn,
-                       msi_lower_address_reg(pos), 4,
+               pci_write_config_dword(entry->dev, msi_lower_address_reg(pos),
                        address.lo_address.value);
                break;
        }
@@ -158,13 +154,25 @@ static void unmask_MSI_irq(unsigned int vector)
 
 static unsigned int startup_msi_irq_wo_maskbit(unsigned int vector)
 {
+       struct msi_desc *entry;
+       unsigned long flags;
+
+       spin_lock_irqsave(&msi_lock, flags);
+       entry = msi_desc[vector];
+       if (!entry || !entry->dev) {
+               spin_unlock_irqrestore(&msi_lock, flags);
+               return 0;
+       }
+       entry->msi_attrib.state = 1;    /* Mark it active */
+       spin_unlock_irqrestore(&msi_lock, flags);
+
        return 0;       /* never anything pending */
 }
 
-static void pci_disable_msi(unsigned int vector);
+static void release_msi(unsigned int vector);
 static void shutdown_msi_irq(unsigned int vector)
 {
-       pci_disable_msi(vector);
+       release_msi(vector);
 }
 
 #define shutdown_msi_irq_wo_maskbit    shutdown_msi_irq
@@ -179,6 +187,18 @@ static void end_msi_irq_wo_maskbit(unsigned int vector)
 
 static unsigned int startup_msi_irq_w_maskbit(unsigned int vector)
 {
+       struct msi_desc *entry;
+       unsigned long flags;
+
+       spin_lock_irqsave(&msi_lock, flags);
+       entry = msi_desc[vector];
+       if (!entry || !entry->dev) {
+               spin_unlock_irqrestore(&msi_lock, flags);
+               return 0;
+       }
+       entry->msi_attrib.state = 1;    /* Mark it active */
+       spin_unlock_irqrestore(&msi_lock, flags);
+
        unmask_MSI_irq(vector);
        return 0;       /* never anything pending */
 }
@@ -200,7 +220,7 @@ static void end_msi_irq_w_maskbit(unsigned int vector)
  * which implement the MSI-X Capability Structure.
  */
 static struct hw_interrupt_type msix_irq_type = {
-       .typename       = "PCI MSI-X",
+       .typename       = "PCI-MSI-X",
        .startup        = startup_msi_irq_w_maskbit,
        .shutdown       = shutdown_msi_irq_w_maskbit,
        .enable         = enable_msi_irq_w_maskbit,
@@ -216,7 +236,7 @@ static struct hw_interrupt_type msix_irq_type = {
  * Mask-and-Pending Bits.
  */
 static struct hw_interrupt_type msi_irq_w_maskbit_type = {
-       .typename       = "PCI MSI",
+       .typename       = "PCI-MSI",
        .startup        = startup_msi_irq_w_maskbit,
        .shutdown       = shutdown_msi_irq_w_maskbit,
        .enable         = enable_msi_irq_w_maskbit,
@@ -232,7 +252,7 @@ static struct hw_interrupt_type msi_irq_w_maskbit_type = {
  * Mask-and-Pending Bits.
  */
 static struct hw_interrupt_type msi_irq_wo_maskbit_type = {
-       .typename       = "PCI MSI",
+       .typename       = "PCI-MSI",
        .startup        = startup_msi_irq_wo_maskbit,
        .shutdown       = shutdown_msi_irq_wo_maskbit,
        .enable         = enable_msi_irq_wo_maskbit,
@@ -265,6 +285,7 @@ static void msi_address_init(struct msg_address *msi_address)
        msi_address->lo_address.value |= (MSI_TARGET_CPU << MSI_TARGET_CPU_SHIFT);
 }
 
+static int msi_free_vector(struct pci_dev* dev, int vector, int reassign);
 static int assign_msi_vector(void)
 {
        static int new_vector_avail = 1;
@@ -278,6 +299,8 @@ static int assign_msi_vector(void)
        spin_lock_irqsave(&msi_lock, flags);
 
        if (!new_vector_avail) {
+               int free_vector = 0;
+
                /*
                 * vector_irq[] = -1 indicates that this specific vector is:
                 * - assigned for MSI (since MSI have no associated IRQ) or
@@ -294,13 +317,34 @@ static int assign_msi_vector(void)
                for (vector = FIRST_DEVICE_VECTOR; vector < NR_IRQS; vector++) {
                        if (vector_irq[vector] != 0)
                                continue;
-                       vector_irq[vector] = -1;
-                       nr_released_vectors--;
+                       free_vector = vector;
+                       if (!msi_desc[vector])
+                               break;
+                       else
+                               continue;
+               }
+               if (!free_vector) {
                        spin_unlock_irqrestore(&msi_lock, flags);
-                       return vector;
+                       return -EBUSY;
                }
+               vector_irq[free_vector] = -1;
+               nr_released_vectors--;
                spin_unlock_irqrestore(&msi_lock, flags);
-               return -EBUSY;
+               if (msi_desc[free_vector] != NULL) {
+                       struct pci_dev *dev;
+                       int tail;
+
+                       /* free all linked vectors before re-assign */
+                       do {
+                               spin_lock_irqsave(&msi_lock, flags);
+                               dev = msi_desc[free_vector]->dev;
+                               tail = msi_desc[free_vector]->link.tail;
+                               spin_unlock_irqrestore(&msi_lock, flags);
+                               msi_free_vector(dev, tail, 1);
+                       } while (free_vector != tail);
+               }
+
+               return free_vector;
        }
        vector = assign_irq_vector(AUTO_ASSIGN);
        last_alloc_vector = vector;
@@ -333,6 +377,15 @@ static int msi_init(void)
                printk(KERN_INFO "WARNING: MSI INIT FAILURE\n");
                return status;
        }
+       last_alloc_vector = assign_irq_vector(AUTO_ASSIGN);
+       if (last_alloc_vector < 0) {
+               pci_msi_enable = 0;
+               printk(KERN_INFO "WARNING: ALL VECTORS ARE BUSY\n");
+               status = -EBUSY;
+               return status;
+       }
+       vector_irq[last_alloc_vector] = 0;
+       nr_released_vectors++;
        printk(KERN_INFO "MSI INIT SUCCESS\n");
 
        return status;
@@ -383,55 +436,49 @@ static void irq_handler_init(int cap_id, int pos, int mask)
 
 static void enable_msi_mode(struct pci_dev *dev, int pos, int type)
 {
-       u32 control;
+       u16 control;
 
-       dev->bus->ops->read(dev->bus, dev->devfn,
-               msi_control_reg(pos), 2, &control);
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
        if (type == PCI_CAP_ID_MSI) {
                /* Set enabled bits to single MSI & enable MSI_enable bit */
                msi_enable(control, 1);
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_control_reg(pos), 2, control);
+               pci_write_config_word(dev, msi_control_reg(pos), control);
        } else {
                msix_enable(control);
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_control_reg(pos), 2, control);
+               pci_write_config_word(dev, msi_control_reg(pos), control);
        }
        if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
                /* PCI Express Endpoint device detected */
-               u32 cmd;
-               dev->bus->ops->read(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd);
+               u16 cmd;
+               pci_read_config_word(dev, PCI_COMMAND, &cmd);
                cmd |= PCI_COMMAND_INTX_DISABLE;
-               dev->bus->ops->write(dev->bus, dev->devfn, PCI_COMMAND, 2, cmd);
+               pci_write_config_word(dev, PCI_COMMAND, cmd);
        }
 }
 
 static void disable_msi_mode(struct pci_dev *dev, int pos, int type)
 {
-       u32 control;
+       u16 control;
 
-       dev->bus->ops->read(dev->bus, dev->devfn,
-               msi_control_reg(pos), 2, &control);
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
        if (type == PCI_CAP_ID_MSI) {
                /* Set enabled bits to single MSI & enable MSI_enable bit */
                msi_disable(control);
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_control_reg(pos), 2, control);
+               pci_write_config_word(dev, msi_control_reg(pos), control);
        } else {
                msix_disable(control);
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_control_reg(pos), 2, control);
+               pci_write_config_word(dev, msi_control_reg(pos), control);
        }
        if (pci_find_capability(dev, PCI_CAP_ID_EXP)) {
                /* PCI Express Endpoint device detected */
-               u32 cmd;
-               dev->bus->ops->read(dev->bus, dev->devfn, PCI_COMMAND, 2, &cmd);
+               u16 cmd;
+               pci_read_config_word(dev, PCI_COMMAND, &cmd);
                cmd &= ~PCI_COMMAND_INTX_DISABLE;
-               dev->bus->ops->write(dev->bus, dev->devfn, PCI_COMMAND, 2, cmd);
+               pci_write_config_word(dev, PCI_COMMAND, cmd);
        }
 }
 
-static int msi_lookup_vector(struct pci_dev *dev)
+static int msi_lookup_vector(struct pci_dev *dev, int type)
 {
        int vector;
        unsigned long flags;
@@ -439,11 +486,11 @@ static int msi_lookup_vector(struct pci_dev *dev)
        spin_lock_irqsave(&msi_lock, flags);
        for (vector = FIRST_DEVICE_VECTOR; vector < NR_IRQS; vector++) {
                if (!msi_desc[vector] || msi_desc[vector]->dev != dev ||
-                       msi_desc[vector]->msi_attrib.entry_nr ||
+                       msi_desc[vector]->msi_attrib.type != type ||
                        msi_desc[vector]->msi_attrib.default_vector != dev->irq)
-                       continue;       /* not entry 0, skip */
+                       continue;
                spin_unlock_irqrestore(&msi_lock, flags);
-               /* This pre-assigned entry-0 MSI vector for this device
+               /* This pre-assigned MSI vector for this device
                   already exits. Override dev->irq with this vector */
                dev->irq = vector;
                return 0;
@@ -458,10 +505,9 @@ void pci_scan_msi_device(struct pci_dev *dev)
        if (!dev)
                return;
 
-       if (pci_find_capability(dev, PCI_CAP_ID_MSIX) > 0) {
-               nr_reserved_vectors++;
+       if (pci_find_capability(dev, PCI_CAP_ID_MSIX) > 0)
                nr_msix_devices++;
-       else if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0)
+       else if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0)
                nr_reserved_vectors++;
 }
 
@@ -480,22 +526,10 @@ static int msi_capability_init(struct pci_dev *dev)
        struct msg_address address;
        struct msg_data data;
        int pos, vector;
-       u32 control;
+       u16 control;
 
        pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
-       if (!pos)
-               return -EINVAL;
-
-       dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos),
-               2, &control);
-       if (control & PCI_MSI_FLAGS_ENABLE)
-               return 0;
-
-       if (!msi_lookup_vector(dev)) {
-               /* Lookup Sucess */
-               enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
-               return 0;
-       }
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
        /* MSI Entry Initialization */
        if (!(entry = alloc_msi_entry()))
                return -ENOMEM;
@@ -504,11 +538,14 @@ static int msi_capability_init(struct pci_dev *dev)
                kmem_cache_free(msi_cachep, entry);
                return -EBUSY;
        }
+       entry->link.head = vector;
+       entry->link.tail = vector;
        entry->msi_attrib.type = PCI_CAP_ID_MSI;
+       entry->msi_attrib.state = 0;                    /* Mark it not active */
        entry->msi_attrib.entry_nr = 0;
        entry->msi_attrib.maskbit = is_mask_bit_support(control);
-       entry->msi_attrib.default_vector = dev->irq;
-       dev->irq = vector;      /* save default pre-assigned ioapic vector */
+       entry->msi_attrib.default_vector = dev->irq;    /* Save IOAPIC IRQ */
+       dev->irq = vector;
        entry->dev = dev;
        if (is_mask_bit_support(control)) {
                entry->mask_base = msi_mask_bits_reg(pos,
@@ -521,27 +558,27 @@ static int msi_capability_init(struct pci_dev *dev)
        msi_data_init(&data, vector);
        entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >>
                                MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
-       dev->bus->ops->write(dev->bus, dev->devfn, msi_lower_address_reg(pos),
-                               4, address.lo_address.value);
+       pci_write_config_dword(dev, msi_lower_address_reg(pos),
+                       address.lo_address.value);
        if (is_64bit_address(control)) {
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_upper_address_reg(pos), 4, address.hi_address);
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_data_reg(pos, 1), 2, *((u32*)&data));
+               pci_write_config_dword(dev,
+                       msi_upper_address_reg(pos), address.hi_address);
+               pci_write_config_word(dev,
+                       msi_data_reg(pos, 1), *((u32*)&data));
        } else
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_data_reg(pos, 0), 2, *((u32*)&data));
+               pci_write_config_word(dev,
+                       msi_data_reg(pos, 0), *((u32*)&data));
        if (entry->msi_attrib.maskbit) {
                unsigned int maskbits, temp;
                /* All MSIs are unmasked by default, Mask them all */
-               dev->bus->ops->read(dev->bus, dev->devfn,
-                       msi_mask_bits_reg(pos, is_64bit_address(control)), 4,
+               pci_read_config_dword(dev,
+                       msi_mask_bits_reg(pos, is_64bit_address(control)),
                        &maskbits);
                temp = (1 << multi_msi_capable(control));
                temp = ((temp - 1) & ~temp);
                maskbits |= temp;
-               dev->bus->ops->write(dev->bus, dev->devfn,
-                       msi_mask_bits_reg(pos, is_64bit_address(control)), 4,
+               pci_write_config_dword(dev,
+                       msi_mask_bits_reg(pos, is_64bit_address(control)),
                        maskbits);
        }
        attach_msi_entry(entry, vector);
@@ -556,238 +593,219 @@ static int msi_capability_init(struct pci_dev *dev)
  * @dev: pointer to the pci_dev data structure of MSI-X device function
  *
  * Setup the MSI-X capability structure of device funtion with a
- * single MSI-X vector. A return of zero indicates the successful setup
- * of an entry zero with the new MSI-X vector or non-zero for otherwise.
- * To request for additional MSI-X vectors, the device drivers are
- * required to utilize the following supported APIs:
- * 1) msi_alloc_vectors(...) for requesting one or more MSI-X vectors
- * 2) msi_free_vectors(...) for releasing one or more MSI-X vectors
- *    back to PCI subsystem before calling free_irq(...)
+ * single MSI-X vector. A return of zero indicates the successful setup of
+ * requested MSI-X entries with allocated vectors or non-zero for otherwise.
  **/
-static int msix_capability_init(struct pci_dev *dev)
+static int msix_capability_init(struct pci_dev *dev,
+                               struct msix_entry *entries, int nvec)
 {
-       struct msi_desc *entry;
+       struct msi_desc *head = NULL, *tail = NULL, *entry = NULL;
        struct msg_address address;
        struct msg_data data;
-       int vector = 0, pos, dev_msi_cap, i;
+       int vector, pos, i, j, nr_entries, temp = 0;
        u32 phys_addr, table_offset;
-       u32 control;
+       u16 control;
        u8 bir;
        void *base;
 
        pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
-       if (!pos)
-               return -EINVAL;
-
        /* Request & Map MSI-X table region */
-       dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos), 2,
-               &control);
-       if (control & PCI_MSIX_FLAGS_ENABLE)
-               return 0;
-
-       if (!msi_lookup_vector(dev)) {
-               /* Lookup Sucess */
-               enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
-               return 0;
-       }
-
-       dev_msi_cap = multi_msix_capable(control);
-       dev->bus->ops->read(dev->bus, dev->devfn,
-               msix_table_offset_reg(pos), 4, &table_offset);
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
+       nr_entries = multi_msix_capable(control);
+       pci_read_config_dword(dev, msix_table_offset_reg(pos),
+               &table_offset);
        bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
        phys_addr = pci_resource_start (dev, bir);
        phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK);
        if (!request_mem_region(phys_addr,
-               dev_msi_cap * PCI_MSIX_ENTRY_SIZE,
-               "MSI-X iomap Failure"))
+               nr_entries * PCI_MSIX_ENTRY_SIZE,
+               "MSI-X vector table"))
                return -ENOMEM;
-       base = ioremap_nocache(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE);
-       if (base == NULL)
-               goto free_region;
-       /* MSI Entry Initialization */
-       entry = alloc_msi_entry();
-       if (!entry)
-               goto free_iomap;
-       if ((vector = get_msi_vector(dev)) < 0)
-               goto free_entry;
+       base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
+       if (base == NULL) {
+               release_mem_region(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
+               return -ENOMEM;
+       }
+       /* MSI-X Table Initialization */
+       for (i = 0; i < nvec; i++) {
+               entry = alloc_msi_entry();
+               if (!entry)
+                       break;
+               if ((vector = get_msi_vector(dev)) < 0)
+                       break;
 
-       entry->msi_attrib.type = PCI_CAP_ID_MSIX;
-       entry->msi_attrib.entry_nr = 0;
-       entry->msi_attrib.maskbit = 1;
-       entry->msi_attrib.default_vector = dev->irq;
-       dev->irq = vector;      /* save default pre-assigned ioapic vector */
-       entry->dev = dev;
-       entry->mask_base = (unsigned long)base;
-       /* Replace with MSI handler */
-       irq_handler_init(PCI_CAP_ID_MSIX, vector, 1);
-       /* Configure MSI-X capability structure */
-       msi_address_init(&address);
-       msi_data_init(&data, vector);
-       entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >>
-                               MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
-       writel(address.lo_address.value, base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
-       writel(address.hi_address, base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
-       writel(*(u32*)&data, base + PCI_MSIX_ENTRY_DATA_OFFSET);
-       /* Initialize all entries from 1 up to 0 */
-       for (i = 1; i < dev_msi_cap; i++) {
-               writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
+               j = entries[i].entry;
+               entries[i].vector = vector;
+               entry->msi_attrib.type = PCI_CAP_ID_MSIX;
+               entry->msi_attrib.state = 0;            /* Mark it not active */
+               entry->msi_attrib.entry_nr = j;
+               entry->msi_attrib.maskbit = 1;
+               entry->msi_attrib.default_vector = dev->irq;
+               entry->dev = dev;
+               entry->mask_base = (unsigned long)base;
+               if (!head) {
+                       entry->link.head = vector;
+                       entry->link.tail = vector;
+                       head = entry;
+               } else {
+                       entry->link.head = temp;
+                       entry->link.tail = tail->link.tail;
+                       tail->link.tail = vector;
+                       head->link.head = vector;
+               }
+               temp = vector;
+               tail = entry;
+               /* Replace with MSI-X handler */
+               irq_handler_init(PCI_CAP_ID_MSIX, vector, 1);
+               /* Configure MSI-X capability structure */
+               msi_address_init(&address);
+               msi_data_init(&data, vector);
+               entry->msi_attrib.current_cpu =
+                       ((address.lo_address.u.dest_id >>
+                       MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
+               writel(address.lo_address.value,
+                       base + j * PCI_MSIX_ENTRY_SIZE +
                        PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
-               writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
+               writel(address.hi_address,
+                       base + j * PCI_MSIX_ENTRY_SIZE +
                        PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
-               writel(0, base + i * PCI_MSIX_ENTRY_SIZE +
+               writel(*(u32*)&data,
+                       base + j * PCI_MSIX_ENTRY_SIZE +
                        PCI_MSIX_ENTRY_DATA_OFFSET);
+               attach_msi_entry(entry, vector);
        }
-       attach_msi_entry(entry, vector);
-       /* Set MSI enabled bits  */
+       if (i != nvec) {
+               i--;
+               for (; i >= 0; i--) {
+                       vector = (entries + i)->vector;
+                       msi_free_vector(dev, vector, 0);
+                       (entries + i)->vector = 0;
+               }
+               return -EBUSY;
+       }
+       /* Set MSI-X enabled bits */
        enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
 
        return 0;
-
-free_entry:
-       kmem_cache_free(msi_cachep, entry);
-free_iomap:
-       iounmap(base);
-free_region:
-       release_mem_region(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE);
-
-       return ((vector < 0) ? -EBUSY : -ENOMEM);
 }
 
 /**
- * pci_enable_msi - configure device's MSI(X) capability structure
- * @dev: pointer to the pci_dev data structure of MSI(X) device function
+ * pci_enable_msi - configure device's MSI capability structure
+ * @dev: pointer to the pci_dev data structure of MSI device function
  *
- * Setup the MSI/MSI-X capability structure of device function with
- * a single MSI(X) vector upon its software driver call to request for
- * MSI(X) mode enabled on its hardware device function. A return of zero
- * indicates the successful setup of an entry zero with the new MSI(X)
+ * Setup the MSI capability structure of device function with
+ * a single MSI vector upon its software driver call to request for
+ * MSI mode enabled on its hardware device function. A return of zero
+ * indicates the successful setup of an entry zero with the new MSI
  * vector or non-zero for otherwise.
  **/
 int pci_enable_msi(struct pci_dev* dev)
 {
-       int status = -EINVAL;
+       int pos, temp = dev->irq, status = -EINVAL;
+       u16 control;
 
        if (!pci_msi_enable || !dev)
                return status;
 
-       if (msi_init() < 0)
-               return -ENOMEM;
+       if ((status = msi_init()) < 0)
+               return status;
 
-       if ((status = msix_capability_init(dev)) == -EINVAL)
-               status = msi_capability_init(dev);
-       if (!status)
-               nr_reserved_vectors--;
+       if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSI)))
+               return -EINVAL;
+
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
+       if (control & PCI_MSI_FLAGS_ENABLE)
+               return 0;                       /* Already in MSI mode */
+
+       if (!msi_lookup_vector(dev, PCI_CAP_ID_MSI)) {
+               /* Lookup Sucess */
+               unsigned long flags;
+
+               spin_lock_irqsave(&msi_lock, flags);
+               if (!vector_irq[dev->irq]) {
+                       msi_desc[dev->irq]->msi_attrib.state = 0;
+                       vector_irq[dev->irq] = -1;
+                       nr_released_vectors--;
+                       spin_unlock_irqrestore(&msi_lock, flags);
+                       enable_msi_mode(dev, pos, PCI_CAP_ID_MSI);
+                       return 0;
+               }
+               spin_unlock_irqrestore(&msi_lock, flags);
+               dev->irq = temp;
+       }
+       /* Check whether driver already requested for MSI-X vectors */
+       if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 &&
+               !msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
+                       printk(KERN_INFO "Can't enable MSI. Device already had MSI-X vectors assigned\n");
+                       dev->irq = temp;
+                       return -EINVAL;
+       }
+       status = msi_capability_init(dev);
+       if (!status) {
+               if (!pos)
+                       nr_reserved_vectors--;  /* Only MSI capable */
+               else if (nr_msix_devices > 0)
+                       nr_msix_devices--;      /* Both MSI and MSI-X capable,
+                                                  but choose enabling MSI */
+       }
 
        return status;
 }
 
-static int msi_free_vector(struct pci_dev* dev, int vector);
-static void pci_disable_msi(unsigned int vector)
+void pci_disable_msi(struct pci_dev* dev)
 {
-       int head, tail, type, default_vector;
        struct msi_desc *entry;
-       struct pci_dev *dev;
+       int pos, default_vector;
+       u16 control;
        unsigned long flags;
 
+       if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSI)))
+               return;
+
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
+       if (!(control & PCI_MSI_FLAGS_ENABLE))
+               return;
+
        spin_lock_irqsave(&msi_lock, flags);
-       entry = msi_desc[vector];
-       if (!entry || !entry->dev) {
+       entry = msi_desc[dev->irq];
+       if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) {
                spin_unlock_irqrestore(&msi_lock, flags);
                return;
        }
-       dev = entry->dev;
-       type = entry->msi_attrib.type;
-       head = entry->link.head;
-       tail = entry->link.tail;
-       default_vector = entry->msi_attrib.default_vector;
-       spin_unlock_irqrestore(&msi_lock, flags);
-
-       disable_msi_mode(dev, pci_find_capability(dev, type), type);
-       /* Restore dev->irq to its default pin-assertion vector */
-       dev->irq = default_vector;
-       if (type == PCI_CAP_ID_MSIX && head != tail) {
-               /* Bad driver, which do not call msi_free_vectors before exit.
-                  We must do a cleanup here */
-               while (1) {
-                       spin_lock_irqsave(&msi_lock, flags);
-                       entry = msi_desc[vector];
-                       head = entry->link.head;
-                       tail = entry->link.tail;
-                       spin_unlock_irqrestore(&msi_lock, flags);
-                       if (tail == head)
-                               break;
-                       if (msi_free_vector(dev, entry->link.tail))
-                               break;
-               }
+       if (entry->msi_attrib.state) {
+               spin_unlock_irqrestore(&msi_lock, flags);
+               printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on vector->%d\n",
+               dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn),
+               dev->irq);
+               BUG_ON(entry->msi_attrib.state > 0);
+       } else {
+               vector_irq[dev->irq] = 0; /* free it */
+               nr_released_vectors++;
+               default_vector = entry->msi_attrib.default_vector;
+               spin_unlock_irqrestore(&msi_lock, flags);
+               /* Restore dev->irq to its default pin-assertion vector */
+               dev->irq = default_vector;
+               disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI),
+                                       PCI_CAP_ID_MSI);
        }
 }
 
-static int msi_alloc_vector(struct pci_dev* dev, int head)
+static void release_msi(unsigned int vector)
 {
        struct msi_desc *entry;
-       struct msg_address address;
-       struct msg_data data;
-       int i, offset, pos, dev_msi_cap, vector;
-       u32 low_address, control;
-       unsigned long base = 0L;
        unsigned long flags;
 
        spin_lock_irqsave(&msi_lock, flags);
-       entry = msi_desc[dev->irq];
-       if (!entry) {
-               spin_unlock_irqrestore(&msi_lock, flags);
-               return -EINVAL;
-       }
-       base = entry->mask_base;
+       entry = msi_desc[vector];
+       if (entry && entry->dev)
+               entry->msi_attrib.state = 0;    /* Mark it not active */
        spin_unlock_irqrestore(&msi_lock, flags);
-
-       pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
-       dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos),
-               2, &control);
-       dev_msi_cap = multi_msix_capable(control);
-       for (i = 1; i < dev_msi_cap; i++) {
-               if (!(low_address = readl(base + i * PCI_MSIX_ENTRY_SIZE)))
-                        break;
-       }
-       if (i >= dev_msi_cap)
-               return -EINVAL;
-
-       /* MSI Entry Initialization */
-       if (!(entry = alloc_msi_entry()))
-               return -ENOMEM;
-
-       if ((vector = get_new_vector()) < 0) {
-               kmem_cache_free(msi_cachep, entry);
-               return vector;
-       }
-       entry->msi_attrib.type = PCI_CAP_ID_MSIX;
-       entry->msi_attrib.entry_nr = i;
-       entry->msi_attrib.maskbit = 1;
-       entry->dev = dev;
-       entry->link.head = head;
-       entry->mask_base = base;
-       irq_handler_init(PCI_CAP_ID_MSIX, vector, 1);
-       /* Configure MSI-X capability structure */
-       msi_address_init(&address);
-       msi_data_init(&data, vector);
-       entry->msi_attrib.current_cpu = ((address.lo_address.u.dest_id >>
-                               MSI_TARGET_CPU_SHIFT) & MSI_TARGET_CPU_MASK);
-       offset = entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE;
-       writel(address.lo_address.value, base + offset +
-               PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
-       writel(address.hi_address, base + offset +
-               PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
-       writel(*(u32*)&data, base + offset + PCI_MSIX_ENTRY_DATA_OFFSET);
-       writel(1, base + offset + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
-       attach_msi_entry(entry, vector);
-
-       return vector;
 }
 
-static int msi_free_vector(struct pci_dev* dev, int vector)
+static int msi_free_vector(struct pci_dev* dev, int vector, int reassign)
 {
        struct msi_desc *entry;
-       int entry_nr, type;
+       int head, entry_nr, type;
        unsigned long base = 0L;
        unsigned long flags;
 
@@ -799,66 +817,177 @@ static int msi_free_vector(struct pci_dev* dev, int vector)
        }
        type = entry->msi_attrib.type;
        entry_nr = entry->msi_attrib.entry_nr;
+       head = entry->link.head;
        base = entry->mask_base;
-       if (entry->link.tail != entry->link.head) {
-               msi_desc[entry->link.head]->link.tail = entry->link.tail;
-               if (entry->link.tail)
-                       msi_desc[entry->link.tail]->link.head = entry->link.head;
-       }
+       msi_desc[entry->link.head]->link.tail = entry->link.tail;
+       msi_desc[entry->link.tail]->link.head = entry->link.head;
        entry->dev = NULL;
-       vector_irq[vector] = 0;
-       nr_released_vectors++;
+       if (!reassign) {
+               vector_irq[vector] = 0;
+               nr_released_vectors++;
+       }
        msi_desc[vector] = NULL;
        spin_unlock_irqrestore(&msi_lock, flags);
 
        kmem_cache_free(msi_cachep, entry);
+
        if (type == PCI_CAP_ID_MSIX) {
-               int offset;
+               if (!reassign)
+                       writel(1, base +
+                               entry_nr * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
+
+               if (head == vector) {
+                       /*
+                        * Detect last MSI-X vector to be released.
+                        * Release the MSI-X memory-mapped table.
+                        */
+                       int pos, nr_entries;
+                       u32 phys_addr, table_offset;
+                       u16 control;
+                       u8 bir;
+
+                       pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
+                       pci_read_config_word(dev, msi_control_reg(pos),
+                               &control);
+                       nr_entries = multi_msix_capable(control);
+                       pci_read_config_dword(dev, msix_table_offset_reg(pos),
+                               &table_offset);
+                       bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
+                       phys_addr = pci_resource_start (dev, bir);
+                       phys_addr += (u32)(table_offset &
+                               ~PCI_MSIX_FLAGS_BIRMASK);
+                       iounmap((void*)base);
+                       release_mem_region(phys_addr,
+                               nr_entries * PCI_MSIX_ENTRY_SIZE);
+               }
+       }
 
-               offset = entry_nr * PCI_MSIX_ENTRY_SIZE;
-               writel(1, base + offset + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
-               writel(0, base + offset + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
+       return 0;
+}
+
+static int reroute_msix_table(int head, struct msix_entry *entries, int *nvec)
+{
+       int vector = head, tail = 0;
+       int i = 0, j = 0, nr_entries = 0;
+       unsigned long base = 0L;
+       unsigned long flags;
+
+       spin_lock_irqsave(&msi_lock, flags);
+       while (head != tail) {
+               nr_entries++;
+               tail = msi_desc[vector]->link.tail;
+               if (entries[0].entry == msi_desc[vector]->msi_attrib.entry_nr)
+                       j = vector;
+               vector = tail;
        }
+       if (*nvec > nr_entries) {
+               spin_unlock_irqrestore(&msi_lock, flags);
+               *nvec = nr_entries;
+               return -EINVAL;
+       }
+       vector = ((j > 0) ? j : head);
+       for (i = 0; i < *nvec; i++) {
+               j = msi_desc[vector]->msi_attrib.entry_nr;
+               msi_desc[vector]->msi_attrib.state = 0; /* Mark it not active */
+               vector_irq[vector] = -1;                /* Mark it busy */
+               nr_released_vectors--;
+               entries[i].vector = vector;
+               if (j != (entries + i)->entry) {
+                       base = msi_desc[vector]->mask_base;
+                       msi_desc[vector]->msi_attrib.entry_nr =
+                               (entries + i)->entry;
+                       writel( readl(base + j * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET), base +
+                               (entries + i)->entry * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET);
+                       writel( readl(base + j * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET), base +
+                               (entries + i)->entry * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET);
+                       writel( (readl(base + j * PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_DATA_OFFSET) & 0xff00) | vector,
+                               base + (entries+i)->entry*PCI_MSIX_ENTRY_SIZE +
+                               PCI_MSIX_ENTRY_DATA_OFFSET);
+               }
+               vector = msi_desc[vector]->link.tail;
+       }
+       spin_unlock_irqrestore(&msi_lock, flags);
 
        return 0;
 }
 
 /**
- * msi_alloc_vectors - allocate additional MSI-X vectors
+ * pci_enable_msix - configure device's MSI-X capability structure
  * @dev: pointer to the pci_dev data structure of MSI-X device function
- * @vector: pointer to an array of new allocated MSI-X vectors
+ * @data: pointer to an array of MSI-X entries
  * @nvec: number of MSI-X vectors requested for allocation by device driver
  *
- * Allocate additional MSI-X vectors requested by device driver. A
- * return of zero indicates the successful setup of MSI-X capability
- * structure with new allocated MSI-X vectors or non-zero for otherwise.
+ * Setup the MSI-X capability structure of device function with the number
+ * of requested vectors upon its software driver call to request for
+ * MSI-X mode enabled on its hardware device function. A return of zero
+ * indicates the successful configuration of MSI-X capability structure
+ * with new allocated MSI-X vectors. A return of < 0 indicates a failure.
+ * Or a return of > 0 indicates that driver request is exceeding the number
+ * of vectors available. Driver should use the returned value to re-send
+ * its request.
  **/
-int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec)
+int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec)
 {
-       struct msi_desc *entry;
-       int i, head, pos, vec, free_vectors, alloc_vectors;
-       int *vectors = (int *)vector;
-       u32 control;
+       int status, pos, nr_entries, free_vectors;
+       int i, j, temp;
+       u16 control;
        unsigned long flags;
 
-       if (!pci_msi_enable || !dev)
+       if (!pci_msi_enable || !dev || !entries)
                return -EINVAL;
 
+       if ((status = msi_init()) < 0)
+               return status;
+
        if (!(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)))
                return -EINVAL;
 
-       dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos),                         2, &control);
-       if (nvec > multi_msix_capable(control))
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
+       if (control & PCI_MSIX_FLAGS_ENABLE)
+               return -EINVAL;                 /* Already in MSI-X mode */
+
+       nr_entries = multi_msix_capable(control);
+       if (nvec > nr_entries)
                return -EINVAL;
 
-       spin_lock_irqsave(&msi_lock, flags);
-       entry = msi_desc[dev->irq];
-       if (!entry || entry->dev != dev ||              /* legal call */
-          entry->msi_attrib.type != PCI_CAP_ID_MSIX || /* must be MSI-X */
-          entry->link.head != entry->link.tail) {      /* already multi */
-               spin_unlock_irqrestore(&msi_lock, flags);
+       /* Check for any invalid entries */
+       for (i = 0; i < nvec; i++) {
+               if (entries[i].entry >= nr_entries)
+                       return -EINVAL;         /* invalid entry */
+               for (j = i + 1; j < nvec; j++) {
+                       if (entries[i].entry == entries[j].entry)
+                               return -EINVAL; /* duplicate entry */
+               }
+       }
+       temp = dev->irq;
+       if (!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
+               /* Lookup Sucess */
+               nr_entries = nvec;
+               /* Reroute MSI-X table */
+               if (reroute_msix_table(dev->irq, entries, &nr_entries)) {
+                       /* #requested > #previous-assigned */
+                       dev->irq = temp;
+                       return nr_entries;
+               }
+               dev->irq = temp;
+               enable_msi_mode(dev, pos, PCI_CAP_ID_MSIX);
+               return 0;
+       }
+       /* Check whether driver already requested for MSI vector */
+       if (pci_find_capability(dev, PCI_CAP_ID_MSI) > 0 &&
+               !msi_lookup_vector(dev, PCI_CAP_ID_MSI)) {
+               printk(KERN_INFO "Can't enable MSI-X. Device already had MSI vector assigned\n");
+               dev->irq = temp;
                return -EINVAL;
        }
+
+       spin_lock_irqsave(&msi_lock, flags);
        /*
         * msi_lock is provided to ensure that enough vectors resources are
         * available before granting.
@@ -874,71 +1003,65 @@ int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec)
                free_vectors /= nr_msix_devices;
        spin_unlock_irqrestore(&msi_lock, flags);
 
-       if (nvec > free_vectors)
-               return -EBUSY;
-
-       alloc_vectors = 0;
-       head = dev->irq;
-       for (i = 0; i < nvec; i++) {
-               if ((vec = msi_alloc_vector(dev, head)) < 0)
-                       break;
-               *(vectors + i) = vec;
-               head = vec;
-               alloc_vectors++;
-       }
-       if (alloc_vectors != nvec) {
-               for (i = 0; i < alloc_vectors; i++) {
-                       vec = *(vectors + i);
-                       msi_free_vector(dev, vec);
-               }
-               spin_lock_irqsave(&msi_lock, flags);
-               msi_desc[dev->irq]->link.tail = msi_desc[dev->irq]->link.head;
-               spin_unlock_irqrestore(&msi_lock, flags);
-               return -EBUSY;
+       if (nvec > free_vectors) {
+               if (free_vectors > 0)
+                       return free_vectors;
+               else
+                       return -EBUSY;
        }
-       if (nr_msix_devices > 0)
+
+       status = msix_capability_init(dev, entries, nvec);
+       if (!status && nr_msix_devices > 0)
                nr_msix_devices--;
 
-       return 0;
+       return status;
 }
 
-/**
- * msi_free_vectors - reclaim MSI-X vectors to unused state
- * @dev: pointer to the pci_dev data structure of MSI-X device function
- * @vector: pointer to an array of released MSI-X vectors
- * @nvec: number of MSI-X vectors requested for release by device driver
- *
- * Reclaim MSI-X vectors released by device driver to unused state,
- * which may be used later on. A return of zero indicates the
- * success or non-zero for otherwise. Device driver should call this
- * before calling function free_irq.
- **/
-int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec)
+void pci_disable_msix(struct pci_dev* dev)
 {
-       struct msi_desc *entry;
-       int i;
-       unsigned long flags;
+       int pos, temp;
+       u16 control;
 
-       if (!pci_msi_enable)
-               return -EINVAL;
+       if (!dev || !(pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)))
+               return;
 
-       spin_lock_irqsave(&msi_lock, flags);
-       entry = msi_desc[dev->irq];
-       if (!entry || entry->dev != dev ||
-               entry->msi_attrib.type != PCI_CAP_ID_MSIX ||
-               entry->link.head == entry->link.tail) { /* Nothing to free */
+       pci_read_config_word(dev, msi_control_reg(pos), &control);
+       if (!(control & PCI_MSIX_FLAGS_ENABLE))
+               return;
+
+       temp = dev->irq;
+       if (!msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
+               int state, vector, head, tail = 0, warning = 0;
+               unsigned long flags;
+
+               vector = head = dev->irq;
+               spin_lock_irqsave(&msi_lock, flags);
+               while (head != tail) {
+                       state = msi_desc[vector]->msi_attrib.state;
+                       if (state)
+                               warning = 1;
+                       else {
+                               vector_irq[vector] = 0; /* free it */
+                               nr_released_vectors++;
+                       }
+                       tail = msi_desc[vector]->link.tail;
+                       vector = tail;
+               }
                spin_unlock_irqrestore(&msi_lock, flags);
-               return -EINVAL;
-       }
-       spin_unlock_irqrestore(&msi_lock, flags);
+               if (warning) {
+                       dev->irq = temp;
+                       printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on all vectors\n",
+                       dev->bus->number, PCI_SLOT(dev->devfn),
+                       PCI_FUNC(dev->devfn));
+                       BUG_ON(warning > 0);
+               } else {
+                       dev->irq = temp;
+                       disable_msi_mode(dev,
+                               pci_find_capability(dev, PCI_CAP_ID_MSIX),
+                               PCI_CAP_ID_MSIX);
 
-       for (i = 0; i < nvec; i++) {
-               if (*(vector + i) == dev->irq)
-                       continue;/* Don't free entry 0 if mistaken by driver */
-               msi_free_vector(dev, *(vector + i));
+               }
        }
-
-       return 0;
 }
 
 /**
@@ -952,62 +1075,73 @@ int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec)
  **/
 void msi_remove_pci_irq_vectors(struct pci_dev* dev)
 {
-       struct msi_desc *entry;
-       int type, temp;
+       int state, pos, temp;
        unsigned long flags;
 
        if (!pci_msi_enable || !dev)
                return;
 
-       if (!pci_find_capability(dev, PCI_CAP_ID_MSI)) {
-               if (!pci_find_capability(dev, PCI_CAP_ID_MSIX))
-                       return;
-       }
-       temp = dev->irq;
-       if (msi_lookup_vector(dev))
-               return;
-
-       spin_lock_irqsave(&msi_lock, flags);
-       entry = msi_desc[dev->irq];
-       if (!entry || entry->dev != dev) {
+       temp = dev->irq;                /* Save IOAPIC IRQ */
+       if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSI)) > 0 &&
+               !msi_lookup_vector(dev, PCI_CAP_ID_MSI)) {
+               spin_lock_irqsave(&msi_lock, flags);
+               state = msi_desc[dev->irq]->msi_attrib.state;
                spin_unlock_irqrestore(&msi_lock, flags);
-               return;
+               if (state) {
+                       printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on vector->%d\n",
+                       dev->bus->number, PCI_SLOT(dev->devfn),
+                       PCI_FUNC(dev->devfn), dev->irq);
+                       BUG_ON(state > 0);
+               } else /* Release MSI vector assigned to this device */
+                       msi_free_vector(dev, dev->irq, 0);
+               dev->irq = temp;                /* Restore IOAPIC IRQ */
        }
-       type = entry->msi_attrib.type;
-       spin_unlock_irqrestore(&msi_lock, flags);
+       if ((pos = pci_find_capability(dev, PCI_CAP_ID_MSIX)) > 0 &&
+               !msi_lookup_vector(dev, PCI_CAP_ID_MSIX)) {
+               int vector, head, tail = 0, warning = 0;
+               unsigned long base = 0L;
 
-       msi_free_vector(dev, dev->irq);
-       if (type == PCI_CAP_ID_MSIX) {
-               int i, pos, dev_msi_cap;
-               u32 phys_addr, table_offset;
-               u32 control;
-               u8 bir;
-
-               pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
-               dev->bus->ops->read(dev->bus, dev->devfn, msi_control_reg(pos),                         2, &control);
-               dev_msi_cap = multi_msix_capable(control);
-               dev->bus->ops->read(dev->bus, dev->devfn,
-                       msix_table_offset_reg(pos), 4, &table_offset);
-               bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
-               phys_addr = pci_resource_start (dev, bir);
-               phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK);
-               for (i = FIRST_DEVICE_VECTOR; i < NR_IRQS; i++) {
+               vector = head = dev->irq;
+               while (head != tail) {
                        spin_lock_irqsave(&msi_lock, flags);
-                       if (!msi_desc[i] || msi_desc[i]->dev != dev) {
-                               spin_unlock_irqrestore(&msi_lock, flags);
-                               continue;
-                       }
+                       state = msi_desc[vector]->msi_attrib.state;
+                       tail = msi_desc[vector]->link.tail;
+                       base = msi_desc[vector]->mask_base;
                        spin_unlock_irqrestore(&msi_lock, flags);
-                       msi_free_vector(dev, i);
+                       if (state)
+                               warning = 1;
+                       else if (vector != head) /* Release MSI-X vector */
+                               msi_free_vector(dev, vector, 0);
+                       vector = tail;
+               }
+               msi_free_vector(dev, vector, 0);
+               if (warning) {
+                       /* Force to release the MSI-X memory-mapped table */
+                       u32 phys_addr, table_offset;
+                       u16 control;
+                       u8 bir;
+
+                       pci_read_config_word(dev, msi_control_reg(pos),
+                               &control);
+                       pci_read_config_dword(dev, msix_table_offset_reg(pos),
+                               &table_offset);
+                       bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
+                       phys_addr = pci_resource_start (dev, bir);
+                       phys_addr += (u32)(table_offset &
+                               ~PCI_MSIX_FLAGS_BIRMASK);
+                       iounmap((void*)base);
+                       release_mem_region(phys_addr, PCI_MSIX_ENTRY_SIZE *
+                               multi_msix_capable(control));
+                       printk(KERN_DEBUG "Driver[%d:%d:%d] unloaded wo doing free_irq on all vectors\n",
+                               dev->bus->number, PCI_SLOT(dev->devfn),
+                               PCI_FUNC(dev->devfn));
+                       BUG_ON(warning > 0);
                }
-               writel(1, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
-               iounmap((void*)entry->mask_base);
-               release_mem_region(phys_addr, dev_msi_cap * PCI_MSIX_ENTRY_SIZE);
+               dev->irq = temp;                /* Restore IOAPIC IRQ */
        }
-       dev->irq = temp;
-       nr_reserved_vectors++;
 }
 
 EXPORT_SYMBOL(pci_enable_msi);
-EXPORT_SYMBOL(msi_alloc_vectors);
-EXPORT_SYMBOL(msi_free_vectors);
+EXPORT_SYMBOL(pci_disable_msi);
+EXPORT_SYMBOL(pci_enable_msix);
+EXPORT_SYMBOL(pci_disable_msix);
index 475b388..6e7c350 100644 (file)
@@ -718,6 +718,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev)
                        case 0x8070: /* P4G8X Deluxe */
                                asus_hides_smbus = 1;
                        }
+               if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)
+                       switch (dev->subsystem_device) {
+                       case 0x1751: /* M2N notebook */
+                               asus_hides_smbus = 1;
+                       }
        } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_HP)) {
                if (dev->device ==  PCI_DEVICE_ID_INTEL_82855PM_HB)
                        switch(dev->subsystem_device) {
@@ -1020,6 +1025,7 @@ static struct pci_fixup pci_fixups[] __devinitdata = {
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82850_HB,   asus_hides_smbus_hostbridge },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_7205_0,     asus_hides_smbus_hostbridge },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82855PM_HB, asus_hides_smbus_hostbridge },
+       { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82855GM_HB, asus_hides_smbus_hostbridge },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801DB_0,  asus_hides_smbus_lpc },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801BA_0,  asus_hides_smbus_lpc },
        { PCI_FIXUP_HEADER,     PCI_VENDOR_ID_INTEL,    PCI_DEVICE_ID_INTEL_82801DB_12, asus_hides_smbus_lpc },
index ceeed4f..0efa9c6 100644 (file)
     file under either the MPL or the GPL.
     
 ======================================================================*/
-/*
- * Please see linux/Documentation/arm/SA1100/PCMCIA for more information
- * on the low-level kernel interface.
- */
 
 #include <linux/module.h>
 #include <linux/init.h>
index 3128b28..c224f74 100644 (file)
@@ -353,7 +353,7 @@ static int pnp_bios_get_event(u16 *event)
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
        status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0 ,0 ,0,
-                              event, sizeof(u16), 0, 0);
+                              event, sizeof(u16), NULL, 0);
        return status;
 }
 #endif
@@ -411,7 +411,7 @@ static int __pnp_bios_get_stat_res(char *info)
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
        status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              info, 65536, 0, 0);
+                              info, 65536, NULL, 0);
        return status;
 }
 
@@ -448,7 +448,7 @@ static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
        status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              data, sizeof(struct pnp_isa_config_struc), 0, 0);
+                              data, sizeof(struct pnp_isa_config_struc), NULL, 0);
        return status;
 }
 
@@ -470,7 +470,7 @@ static int __pnp_bios_escd_info(struct escd_info_struc *data)
        if (!pnp_bios_present())
                return ESCD_FUNCTION_NOT_SUPPORTED;
        status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, PNP_DS,
-                              data, sizeof(struct escd_info_struc), 0, 0);
+                              data, sizeof(struct escd_info_struc), NULL, 0);
        return status;
 }
 
index e5a9b01..de60cfd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/chsc.c
  *   S/390 common I/O routines -- channel subsystem call
- *   $Revision: 1.114 $
+ *   $Revision: 1.115 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *                           IBM Corporation
@@ -906,8 +906,6 @@ new_channel_path(int chpid)
                return -ENOMEM;
        memset(chp, 0, sizeof(struct channel_path));
 
-       chps[chpid] = chp;
-
        /* fill in status, etc. */
        chp->id = chpid;
        chp->state = 1;
@@ -922,12 +920,17 @@ new_channel_path(int chpid)
        if (ret) {
                printk(KERN_WARNING "%s: could not register %02x\n",
                       __func__, chpid);
-               return ret;
+               goto out_free;
        }
        ret = device_create_file(&chp->dev, &dev_attr_status);
-       if (ret)
+       if (ret) {
                device_unregister(&chp->dev);
-
+               goto out_free;
+       } else
+               chps[chpid] = chp;
+       return ret;
+out_free:
+       kfree(chp);
        return ret;
 }
 
index 35e584c..6a8db84 100644 (file)
@@ -244,6 +244,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
                };
                if (notify) {
                        /* Get device online again. */
+                       cdev->private->state = DEV_STATE_OFFLINE;
                        ccw_device_online(cdev);
                        wake_up(&cdev->private->wait_q);
                        return;
index 6c617dd..07a3d22 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  drivers/s390/cio/device_ops.c
  *
- *   $Revision: 1.47 $
+ *   $Revision: 1.50 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *                      IBM Corporation
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/list.h>
 #include <linux/device.h>
+#include <linux/delay.h>
 
 #include <asm/ccwdev.h>
 #include <asm/idals.h>
@@ -268,7 +269,7 @@ __ccw_device_retry_loop(struct ccw_device *cdev, struct ccw1 *ccw, long magic)
                if ((ret == -EBUSY) || (ret == -EACCES)) {
                        /* Try again later. */
                        spin_unlock_irq(&sch->lock);
-                       schedule_timeout(1);
+                       msleep(10);
                        spin_lock_irq(&sch->lock);
                        continue;
                }
@@ -294,7 +295,7 @@ __ccw_device_retry_loop(struct ccw_device *cdev, struct ccw1 *ccw, long magic)
                        break;
                /* Try again later. */
                spin_unlock_irq(&sch->lock);
-               schedule_timeout(1);
+               msleep(10);
                spin_lock_irq(&sch->lock);
        } while (1);
 
index cf8e573..4ab2e0d 100644 (file)
@@ -348,7 +348,8 @@ ccw_device_accumulate_basic_sense(struct ccw_device *cdev, struct irb *irb)
             (irb->scsw.actl & SCSW_ACTL_SUSPENDED)))
                ccw_device_path_notoper(cdev);
 
-       if (!(irb->scsw.dstat & DEV_STAT_UNIT_CHECK)) {
+       if (!(irb->scsw.dstat & DEV_STAT_UNIT_CHECK) &&
+           (irb->scsw.dstat & DEV_STAT_CHN_END)) {
                cdev->private->irb.esw.esw0.erw.cons = 1;
                cdev->private->flags.dosense = 0;
        }
index 9fed696..f35bf04 100644 (file)
@@ -56,7 +56,7 @@
 #include "ioasm.h"
 #include "chsc.h"
 
-#define VERSION_QDIO_C "$Revision: 1.83 $"
+#define VERSION_QDIO_C "$Revision: 1.84 $"
 
 /****************** MODULE PARAMETER VARIABLES ********************/
 MODULE_AUTHOR("Utz Bacher <utz.bacher@de.ibm.com>");
@@ -87,10 +87,10 @@ static debug_info_t *qdio_dbf_setup;
 static debug_info_t *qdio_dbf_sbal;
 static debug_info_t *qdio_dbf_trace;
 static debug_info_t *qdio_dbf_sense;
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 static debug_info_t *qdio_dbf_slsb_out;
 static debug_info_t *qdio_dbf_slsb_in;
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 /* iQDIO stuff: */
 static volatile struct qdio_q *tiq_list=NULL; /* volatile as it could change
@@ -514,10 +514,13 @@ inline static int
 qdio_is_outbound_q_done(struct qdio_q *q)
 {
        int no_used;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif
 
        no_used=atomic_read(&q->number_of_buffers_used);
 
+#ifdef CONFIG_QDIO_DEBUG
        if (no_used) {
                sprintf(dbf_text,"oqisnt%02x",no_used);
                QDIO_DBF_TEXT4(0,trace,dbf_text);
@@ -525,6 +528,7 @@ qdio_is_outbound_q_done(struct qdio_q *q)
                QDIO_DBF_TEXT4(0,trace,"oqisdone");
        }
        QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
+#endif /* CONFIG_QDIO_DEBUG */
        return (no_used==0);
 }
 
@@ -552,10 +556,12 @@ inline static void
 qdio_kick_outbound_q(struct qdio_q *q)
 {
        int result;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
 
        QDIO_DBF_TEXT4(0,trace,"kickoutq");
        QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (!q->siga_out)
                return;
@@ -593,16 +599,18 @@ qdio_kick_outbound_q(struct qdio_q *q)
 
                switch (result) {
                case 0:
-               /* went smooth this time, reset timestamp */
+                       /* went smooth this time, reset timestamp */
+#ifdef CONFIG_QDIO_DEBUG
                        QDIO_DBF_TEXT3(0,trace,"cc2reslv");
                        sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
                                atomic_read(&q->busy_siga_counter));
                        QDIO_DBF_TEXT3(0,trace,dbf_text);
                        q->timing.busy_start=0;
+#endif /* CONFIG_QDIO_DEBUG */
                        break;
                case (2|QDIO_SIGA_ERROR_B_BIT_SET):
                        /* cc=2 and busy bit: */
-               atomic_inc(&q->busy_siga_counter);
+                       atomic_inc(&q->busy_siga_counter);
 
                        /* if the last siga was successful, save
                         * timestamp here */
@@ -616,9 +624,11 @@ qdio_kick_outbound_q(struct qdio_q *q)
                                break;
                        }
                        QDIO_DBF_TEXT2(0,trace,"cc2REPRT");
+#ifdef CONFIG_QDIO_DEBUG
                        sprintf(dbf_text,"%4x%2x%2x",q->irq,q->q_no,
                                atomic_read(&q->busy_siga_counter));
                        QDIO_DBF_TEXT3(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
                        /* else fallthrough and report error */
                default:
                        /* for plain cc=1, 2 or 3: */
@@ -635,7 +645,9 @@ inline static void
 qdio_kick_outbound_handler(struct qdio_q *q)
 {
        int start, end, real_end, count;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif
 
        start = q->first_element_to_kick;
        /* last_move_ftc was just updated */
@@ -645,11 +657,13 @@ qdio_kick_outbound_handler(struct qdio_q *q)
        count = (end+QDIO_MAX_BUFFERS_PER_Q+1-start)&
                (QDIO_MAX_BUFFERS_PER_Q-1);
 
+#ifdef CONFIG_QDIO_DEBUG
        QDIO_DBF_TEXT4(0,trace,"kickouth");
        QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
 
        sprintf(dbf_text,"s=%2xc=%2x",start,count);
        QDIO_DBF_TEXT4(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (q->state==QDIO_IRQ_STATE_ACTIVE)
                q->handler(q->cdev,QDIO_STATUS_OUTBOUND_INT|
@@ -732,7 +746,9 @@ qdio_get_inbound_buffer_frontier(struct qdio_q *q)
        int f,f_mod_no;
        volatile char *slsb;
        int first_not_to_check;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif /* CONFIG_QDIO_DEBUG */
 #ifdef QDIO_USE_PROCESSING_STATE
        int last_position=-1;
 #endif /* QDIO_USE_PROCESSING_STATE */
@@ -806,8 +822,10 @@ check_next:
 
        /* P_ERROR means frontier is reached, break and report error */
        case SLSB_P_INPUT_ERROR:
+#ifdef CONFIG_QDIO_DEBUG
                sprintf(dbf_text,"inperr%2x",f_mod_no);
                QDIO_DBF_TEXT3(1,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
                QDIO_DBF_HEX2(1,sbal,q->sbal[f_mod_no],256);
 
                /* kind of process the buffer */
@@ -884,13 +902,16 @@ inline static int
 iqdio_is_inbound_q_done(struct qdio_q *q)
 {
        int no_used;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif
 
        no_used=atomic_read(&q->number_of_buffers_used);
 
        /* propagate the change from 82 to 80 through VM */
        SYNC_MEMORY;
 
+#ifdef CONFIG_QDIO_DEBUG
        if (no_used) {
                sprintf(dbf_text,"iqisnt%02x",no_used);
                QDIO_DBF_TEXT4(0,trace,dbf_text);
@@ -898,6 +919,7 @@ iqdio_is_inbound_q_done(struct qdio_q *q)
                QDIO_DBF_TEXT4(0,trace,"iniqisdo");
        }
        QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (!no_used)
                return 1;
@@ -933,7 +955,9 @@ inline static int
 qdio_is_inbound_q_done(struct qdio_q *q)
 {
        int no_used;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif
 
        no_used=atomic_read(&q->number_of_buffers_used);
 
@@ -968,16 +992,20 @@ qdio_is_inbound_q_done(struct qdio_q *q)
         * has (probably) not moved (see qdio_inbound_processing) 
         */
        if (NOW>GET_SAVED_TIMESTAMP(q)+q->timing.threshold) {
+#ifdef CONFIG_QDIO_DEBUG
                QDIO_DBF_TEXT4(0,trace,"inqisdon");
                QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
                sprintf(dbf_text,"pf%02xcn%02x",q->first_to_check,no_used);
                QDIO_DBF_TEXT4(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
                return 1;
        } else {
+#ifdef CONFIG_QDIO_DEBUG
                QDIO_DBF_TEXT4(0,trace,"inqisntd");
                QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
                sprintf(dbf_text,"pf%02xcn%02x",q->first_to_check,no_used);
                QDIO_DBF_TEXT4(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
                return 0;
        }
 }
@@ -986,7 +1014,9 @@ inline static void
 qdio_kick_inbound_handler(struct qdio_q *q)
 {
        int count, start, end, real_end, i;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
+#endif
 
        QDIO_DBF_TEXT4(0,trace,"kickinh");
        QDIO_DBF_HEX4(0,trace,&q,sizeof(void*));
@@ -1004,8 +1034,10 @@ qdio_kick_inbound_handler(struct qdio_q *q)
                i=(i+1)&(QDIO_MAX_BUFFERS_PER_Q-1);
        }
 
+#ifdef CONFIG_QDIO_DEBUG
        sprintf(dbf_text,"s=%2xc=%2x",start,count);
        QDIO_DBF_TEXT4(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (likely(q->state==QDIO_IRQ_STATE_ACTIVE))
                q->handler(q->cdev,
@@ -1622,11 +1654,13 @@ static void
 qdio_set_state(struct qdio_irq *irq_ptr, enum qdio_irq_states state)
 {
        int i;
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[15];
 
        QDIO_DBF_TEXT5(0,trace,"newstate");
        sprintf(dbf_text,"%4x%4x",irq_ptr->irq,state);
        QDIO_DBF_TEXT5(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
        irq_ptr->state=state;
        for (i=0;i<irq_ptr->no_input_qs;i++)
@@ -1791,9 +1825,11 @@ qdio_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
        int cstat,dstat;
        char dbf_text[15];
 
+#ifdef CONFIG_QDIO_DEBUG
        QDIO_DBF_TEXT4(0, trace, "qint");
        sprintf(dbf_text, "%s", cdev->dev.bus_id);
        QDIO_DBF_TEXT4(0, trace, dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
        
        if (!intparm) {
                QDIO_PRINT_ERR("got unsolicited interrupt in qdio " \
@@ -1830,8 +1866,10 @@ qdio_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
 
        qdio_irq_check_sense(irq_ptr->irq, irb);
 
+#ifdef CONFIG_QDIO_DEBUG
        sprintf(dbf_text, "state:%d", irq_ptr->state);
        QDIO_DBF_TEXT4(0, trace, dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
         cstat = irb->scsw.cstat;
         dstat = irb->scsw.dstat;
@@ -1872,18 +1910,22 @@ qdio_synchronize(struct ccw_device *cdev, unsigned int flags,
        int cc;
        struct qdio_q *q;
        struct qdio_irq *irq_ptr;
-       char dbf_text[15]="SyncXXXX";
        void *ptr;
+#ifdef CONFIG_QDIO_DEBUG
+       char dbf_text[15]="SyncXXXX";
+#endif
 
        irq_ptr = cdev->private->qdio_data;
        if (!irq_ptr)
                return -ENODEV;
 
+#ifdef CONFIG_QDIO_DEBUG
        *((int*)(&dbf_text[4])) = irq_ptr->irq;
        QDIO_DBF_HEX4(0,trace,dbf_text,QDIO_DBF_TRACE_LEN);
        *((int*)(&dbf_text[0]))=flags;
        *((int*)(&dbf_text[4]))=queue_number;
        QDIO_DBF_HEX4(0,trace,dbf_text,QDIO_DBF_TRACE_LEN);
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (flags&QDIO_FLAG_SYNC_INPUT) {
                q=irq_ptr->input_qs[queue_number];
@@ -3089,11 +3131,12 @@ do_QDIO(struct ccw_device *cdev,unsigned int callflags,
        unsigned int count,struct qdio_buffer *buffers)
 {
        struct qdio_irq *irq_ptr;
-
+#ifdef CONFIG_QDIO_DEBUG
        char dbf_text[20];
 
        sprintf(dbf_text,"doQD%04x",cdev->private->irq);
-       QDIO_DBF_TEXT3(0,trace,dbf_text);
+       QDIO_DBF_TEXT3(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
        if ( (qidx>QDIO_MAX_BUFFERS_PER_Q) ||
             (count>QDIO_MAX_BUFFERS_PER_Q) ||
@@ -3107,6 +3150,7 @@ do_QDIO(struct ccw_device *cdev,unsigned int callflags,
        if (!irq_ptr)
                return -ENODEV;
 
+#ifdef CONFIG_QDIO_DEBUG
        if (callflags&QDIO_FLAG_SYNC_INPUT)
                QDIO_DBF_HEX3(0,trace,&irq_ptr->input_qs[queue_number],
                              sizeof(void*));
@@ -3117,6 +3161,7 @@ do_QDIO(struct ccw_device *cdev,unsigned int callflags,
        QDIO_DBF_TEXT3(0,trace,dbf_text);
        sprintf(dbf_text,"qi%02xct%02x",qidx,count);
        QDIO_DBF_TEXT3(0,trace,dbf_text);
+#endif /* CONFIG_QDIO_DEBUG */
 
        if (irq_ptr->state!=QDIO_IRQ_STATE_ACTIVE)
                return -EBUSY;
@@ -3267,12 +3312,12 @@ qdio_unregister_dbf_views(void)
                debug_unregister(qdio_dbf_sense);
        if (qdio_dbf_trace)
                debug_unregister(qdio_dbf_trace);
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
         if (qdio_dbf_slsb_out)
                 debug_unregister(qdio_dbf_slsb_out);
         if (qdio_dbf_slsb_in)
                 debug_unregister(qdio_dbf_slsb_in);
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 }
 
 static int
@@ -3317,7 +3362,7 @@ qdio_register_dbf_views(void)
        debug_register_view(qdio_dbf_trace,&debug_hex_ascii_view);
        debug_set_level(qdio_dbf_trace,QDIO_DBF_TRACE_LEVEL);
 
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
         qdio_dbf_slsb_out=debug_register(QDIO_DBF_SLSB_OUT_NAME,
                                          QDIO_DBF_SLSB_OUT_INDEX,
                                          QDIO_DBF_SLSB_OUT_NR_AREAS,
@@ -3335,7 +3380,7 @@ qdio_register_dbf_views(void)
                goto oom;
         debug_register_view(qdio_dbf_slsb_in,&debug_hex_ascii_view);
         debug_set_level(qdio_dbf_slsb_in,QDIO_DBF_SLSB_IN_LEVEL);
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
        return 0;
 oom:
        QDIO_PRINT_ERR("not enough memory for dbf.\n");
index 2e7c7b3..fe85c6f 100644 (file)
@@ -1,15 +1,13 @@
 #ifndef _CIO_QDIO_H
 #define _CIO_QDIO_H
 
-#define VERSION_CIO_QDIO_H "$Revision: 1.24 $"
+#define VERSION_CIO_QDIO_H "$Revision: 1.26 $"
 
-//#define QDIO_DBF_LIKE_HELL
-
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_VERBOSE_LEVEL 9
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_VERBOSE_LEVEL 5
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_USE_PROCESSING_STATE
 
@@ -103,75 +101,75 @@ enum qdio_irq_states {
 #define QDIO_DBF_HEX0(ex,name,addr,len) QDIO_DBF_HEX(ex,name,0,addr,len)
 #define QDIO_DBF_HEX1(ex,name,addr,len) QDIO_DBF_HEX(ex,name,1,addr,len)
 #define QDIO_DBF_HEX2(ex,name,addr,len) QDIO_DBF_HEX(ex,name,2,addr,len)
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_HEX3(ex,name,addr,len) QDIO_DBF_HEX(ex,name,3,addr,len)
 #define QDIO_DBF_HEX4(ex,name,addr,len) QDIO_DBF_HEX(ex,name,4,addr,len)
 #define QDIO_DBF_HEX5(ex,name,addr,len) QDIO_DBF_HEX(ex,name,5,addr,len)
 #define QDIO_DBF_HEX6(ex,name,addr,len) QDIO_DBF_HEX(ex,name,6,addr,len)
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_HEX3(ex,name,addr,len) do {} while (0)
 #define QDIO_DBF_HEX4(ex,name,addr,len) do {} while (0)
 #define QDIO_DBF_HEX5(ex,name,addr,len) do {} while (0)
 #define QDIO_DBF_HEX6(ex,name,addr,len) do {} while (0)
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_DBF_TEXT0(ex,name,text) QDIO_DBF_TEXT(ex,name,0,text)
 #define QDIO_DBF_TEXT1(ex,name,text) QDIO_DBF_TEXT(ex,name,1,text)
 #define QDIO_DBF_TEXT2(ex,name,text) QDIO_DBF_TEXT(ex,name,2,text)
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_TEXT3(ex,name,text) QDIO_DBF_TEXT(ex,name,3,text)
 #define QDIO_DBF_TEXT4(ex,name,text) QDIO_DBF_TEXT(ex,name,4,text)
 #define QDIO_DBF_TEXT5(ex,name,text) QDIO_DBF_TEXT(ex,name,5,text)
 #define QDIO_DBF_TEXT6(ex,name,text) QDIO_DBF_TEXT(ex,name,6,text)
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_TEXT3(ex,name,text) do {} while (0)
 #define QDIO_DBF_TEXT4(ex,name,text) do {} while (0)
 #define QDIO_DBF_TEXT5(ex,name,text) do {} while (0)
 #define QDIO_DBF_TEXT6(ex,name,text) do {} while (0)
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_DBF_SETUP_NAME "qdio_setup"
 #define QDIO_DBF_SETUP_LEN 8
 #define QDIO_DBF_SETUP_INDEX 2
 #define QDIO_DBF_SETUP_NR_AREAS 1
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_SETUP_LEVEL 6
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_SETUP_LEVEL 2
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_DBF_SBAL_NAME "qdio_labs" /* sbal */
 #define QDIO_DBF_SBAL_LEN 256
 #define QDIO_DBF_SBAL_INDEX 2
 #define QDIO_DBF_SBAL_NR_AREAS 2
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_SBAL_LEVEL 6
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_SBAL_LEVEL 2
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_DBF_TRACE_NAME "qdio_trace"
 #define QDIO_DBF_TRACE_LEN 8
 #define QDIO_DBF_TRACE_NR_AREAS 2
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_TRACE_INDEX 4
 #define QDIO_DBF_TRACE_LEVEL 4 /* -------- could be even more verbose here */
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_TRACE_INDEX 2
 #define QDIO_DBF_TRACE_LEVEL 2
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_DBF_SENSE_NAME "qdio_sense"
 #define QDIO_DBF_SENSE_LEN 64
 #define QDIO_DBF_SENSE_INDEX 1
 #define QDIO_DBF_SENSE_NR_AREAS 1
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_DBF_SENSE_LEVEL 6
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define QDIO_DBF_SENSE_LEVEL 2
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
-#ifdef QDIO_DBF_LIKE_HELL
+#ifdef CONFIG_QDIO_DEBUG
 #define QDIO_TRACE_QTYPE QDIO_ZFCP_QFMT
 
 #define QDIO_DBF_SLSB_OUT_NAME "qdio_slsb_out"
@@ -185,7 +183,7 @@ enum qdio_irq_states {
 #define QDIO_DBF_SLSB_IN_INDEX 8
 #define QDIO_DBF_SLSB_IN_NR_AREAS 1
 #define QDIO_DBF_SLSB_IN_LEVEL 6
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 #define QDIO_PRINTK_HEADER QDIO_NAME ": "
 
@@ -494,7 +492,7 @@ struct qdio_perf_stats {
 #define QDIO_GET_ADDR(x) ((__u32)(long)x)
 #endif /* CONFIG_ARCH_S390X */
 
-#ifdef QDIO_DBF_LIKE_HELL 
+#ifdef CONFIG_QDIO_DEBUG
 #define set_slsb(x,y) \
   if(q->queue_type==QDIO_TRACE_QTYPE) { \
         if(q->is_input_q) { \
@@ -511,9 +509,9 @@ struct qdio_perf_stats {
             QDIO_DBF_HEX2(0,slsb_out,&q->slsb,QDIO_MAX_BUFFERS_PER_Q); \
         } \
   }
-#else /* QDIO_DBF_LIKE_HELL */
+#else /* CONFIG_QDIO_DEBUG */
 #define set_slsb(x,y) qdio_set_slsb(x,y)
-#endif /* QDIO_DBF_LIKE_HELL */
+#endif /* CONFIG_QDIO_DEBUG */
 
 struct qdio_q {
        volatile struct slsb slsb;
index e9f9954..6a1cb3f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ctcmain.c,v 1.61 2004/07/02 16:31:22 ptiedem Exp $
+ * $Id: ctcmain.c,v 1.63 2004/07/28 12:27:54 ptiedem Exp $
  *
  * CTC / ESCON network driver
  *
@@ -36,7 +36,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.61 $
+ * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.63 $
  *
  */
 \f
@@ -320,7 +320,7 @@ static void
 print_banner(void)
 {
        static int printed = 0;
-       char vbuf[] = "$Revision: 1.61 $";
+       char vbuf[] = "$Revision: 1.63 $";
        char *version = vbuf;
 
        if (printed)
@@ -619,7 +619,7 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
        struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
        __u16 len = *((__u16 *) pskb->data);
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        skb_put(pskb, 2 + LL_HEADER_LENGTH);
        skb_pull(pskb, 2);
        pskb->dev = dev;
@@ -724,7 +724,7 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
                if (ch->protocol == CTC_PROTO_LINUX_TTY)
                        ctc_tty_netif_rx(skb);
                else
-                       netif_rx(skb);
+                       netif_rx_ni(skb);
                /**
                 * Successful rx; reset logflags
                 */
@@ -761,7 +761,7 @@ ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
 static void inline
 ccw_check_return_code(struct channel *ch, int return_code, char *msg)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        switch (return_code) {
                case 0:
                        fsm_event(ch->fsm, CH_EVENT_IO_SUCCESS, ch);
@@ -796,7 +796,7 @@ ccw_check_return_code(struct channel *ch, int return_code, char *msg)
 static void inline
 ccw_unit_check(struct channel *ch, unsigned char sense)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (sense & SNS0_INTERVENTION_REQ) {
                if (sense & 0x01) {
                        if (ch->protocol != CTC_PROTO_LINUX_TTY)
@@ -842,7 +842,7 @@ ctc_purge_skb_queue(struct sk_buff_head *q)
 {
        struct sk_buff *skb;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
 
        while ((skb = skb_dequeue(q))) {
                atomic_dec(&skb->users);
@@ -853,7 +853,7 @@ ctc_purge_skb_queue(struct sk_buff_head *q)
 static __inline__ int
 ctc_checkalloc_buffer(struct channel *ch, int warn)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if ((ch->trans_skb == NULL) ||
            (ch->flags & CHANNEL_FLAGS_BUFSIZE_CHANGED)) {
                if (ch->trans_skb != NULL)
@@ -923,7 +923,7 @@ ch_action_txdone(fsm_instance * fi, int event, void *arg)
        unsigned long duration;
        struct timespec done_stamp = xtime;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
 
        duration =
            (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 +
@@ -1006,7 +1006,7 @@ ch_action_txidle(fsm_instance * fi, int event, void *arg)
 {
        struct channel *ch = (struct channel *) arg;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        fsm_newstate(fi, CH_STATE_TXIDLE);
        fsm_event(((struct ctc_priv *) ch->netdev->priv)->fsm, DEV_EVENT_TXUP,
@@ -1033,7 +1033,7 @@ ch_action_rx(fsm_instance * fi, int event, void *arg)
        int check_len;
        int rc;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        if (len < 8) {
                ctc_pr_debug("%s: got packet with length %d < 8\n",
@@ -1104,7 +1104,7 @@ ch_action_firstio(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        int rc;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
 
        if (fsm_getstate(fi) == CH_STATE_TXIDLE)
                ctc_pr_debug("%s: remote side issued READ?, init ...\n", ch->id);
@@ -1180,7 +1180,7 @@ ch_action_rxidle(fsm_instance * fi, int event, void *arg)
        __u16 buflen;
        int rc;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        buflen = *((__u16 *) ch->trans_skb->data);
 #ifdef DEBUG
@@ -1220,7 +1220,7 @@ ch_action_setmode(fsm_instance * fi, int event, void *arg)
        int rc;
        unsigned long saveflags;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
        fsm_newstate(fi, CH_STATE_SETUPWAIT);
@@ -1252,7 +1252,7 @@ ch_action_start(fsm_instance * fi, int event, void *arg)
        int rc;
        struct net_device *dev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ch == NULL) {
                ctc_pr_warn("ch_action_start ch=NULL\n");
                return;
@@ -1332,7 +1332,7 @@ ch_action_haltio(fsm_instance * fi, int event, void *arg)
        int rc;
        int oldstate;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
        if (event == CH_EVENT_STOP)
@@ -1365,7 +1365,7 @@ ch_action_stopped(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        fsm_newstate(fi, CH_STATE_STOPPED);
        if (ch->trans_skb != NULL) {
@@ -1417,7 +1417,7 @@ ch_action_fail(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        fsm_newstate(fi, CH_STATE_NOTOP);
        if (CHANNEL_DIRECTION(ch->flags) == READ) {
@@ -1448,7 +1448,7 @@ ch_action_setuperr(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
        /**
         * Special case: Got UC_RCRESET on setmode.
         * This means that remote side isn't setup. In this case
@@ -1501,7 +1501,7 @@ ch_action_restart(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        ctc_pr_debug("%s: %s channel restart\n", dev->name,
                     (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
@@ -1536,7 +1536,7 @@ ch_action_rxiniterr(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
        if (event == CH_EVENT_TIMER) {
                fsm_deltimer(&ch->timer);
                ctc_pr_debug("%s: Timeout during RX init handshake\n", dev->name);
@@ -1565,7 +1565,7 @@ ch_action_rxinitfail(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
        fsm_newstate(fi, CH_STATE_RXERR);
        ctc_pr_warn("%s: RX initialization failed\n", dev->name);
        ctc_pr_warn("%s: RX <-> RX connection detected\n", dev->name);
@@ -1586,7 +1586,7 @@ ch_action_rxdisc(fsm_instance * fi, int event, void *arg)
        struct channel *ch2;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        ctc_pr_debug("%s: Got remote disconnect, re-initializing ...\n",
                     dev->name);
@@ -1647,7 +1647,7 @@ ch_action_txretry(fsm_instance * fi, int event, void *arg)
        struct net_device *dev = ch->netdev;
        unsigned long saveflags;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        if (ch->retry++ > 3) {
                ctc_pr_debug("%s: TX retry failed, restarting channel\n",
@@ -1705,7 +1705,7 @@ ch_action_iofatal(fsm_instance * fi, int event, void *arg)
        struct channel *ch = (struct channel *) arg;
        struct net_device *dev = ch->netdev;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_deltimer(&ch->timer);
        if (CHANNEL_DIRECTION(ch->flags) == READ) {
                ctc_pr_debug("%s: RX I/O error\n", dev->name);
@@ -1727,7 +1727,7 @@ ch_action_reinit(fsm_instance *fi, int event, void *arg)
        struct net_device *dev = ch->netdev;
        struct ctc_priv *privptr = dev->priv;
  
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        ch_action_iofatal(fi, event, arg);
        fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev);
 }
@@ -2021,7 +2021,7 @@ channel_get(enum channel_types type, char *id, int direction)
 {
        struct channel *ch = channels;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
 #ifdef DEBUG
        ctc_pr_debug("ctc: %s(): searching for ch with id %s and type %d\n",
                     __func__, id, type);
@@ -2117,7 +2117,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
        struct net_device *dev;
        struct ctc_priv *priv;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (__ctc_check_irb_error(cdev, irb))
                return;
 
@@ -2211,7 +2211,7 @@ dev_action_start(fsm_instance * fi, int event, void *arg)
        struct ctc_priv *privptr = dev->priv;
        int direction;
 
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
        fsm_deltimer(&privptr->restart_timer);
        fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX);
        for (direction = READ; direction <= WRITE; direction++) {
@@ -2234,7 +2234,7 @@ dev_action_stop(fsm_instance * fi, int event, void *arg)
        struct ctc_priv *privptr = dev->priv;
        int direction;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        fsm_newstate(fi, DEV_STATE_STOPWAIT_RXTX);
        for (direction = READ; direction <= WRITE; direction++) {
                struct channel *ch = privptr->channel[direction];
@@ -2247,7 +2247,7 @@ dev_action_restart(fsm_instance *fi, int event, void *arg)
        struct net_device *dev = (struct net_device *)arg;
        struct ctc_priv *privptr = dev->priv;
        
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        ctc_pr_debug("%s: Restarting\n", dev->name);
        dev_action_stop(fi, event, arg);
        fsm_event(privptr->fsm, DEV_EVENT_STOP, dev);
@@ -2269,7 +2269,7 @@ dev_action_chup(fsm_instance * fi, int event, void *arg)
        struct net_device *dev = (struct net_device *) arg;
        struct ctc_priv *privptr = dev->priv;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        switch (fsm_getstate(fi)) {
                case DEV_STATE_STARTWAIT_RXTX:
                        if (event == DEV_EVENT_RXUP)
@@ -2322,7 +2322,7 @@ dev_action_chdown(fsm_instance * fi, int event, void *arg)
        struct net_device *dev = (struct net_device *) arg;
        struct ctc_priv *privptr = dev->priv;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        switch (fsm_getstate(fi)) {
                case DEV_STATE_RUNNING:
                        if (privptr->protocol == CTC_PROTO_LINUX_TTY)
@@ -2424,7 +2424,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
        struct ll_header header;
        int rc = 0;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (fsm_getstate(ch->fsm) != CH_STATE_TXIDLE) {
                int l = skb->len + LL_HEADER_LENGTH;
 
@@ -2561,6 +2561,7 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
 static int
 ctc_open(struct net_device * dev)
 {
+       DBF_TEXT(trace, 5, __FUNCTION__);
        fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_START, dev);
        return 0;
 }
@@ -2576,6 +2577,7 @@ ctc_open(struct net_device * dev)
 static int
 ctc_close(struct net_device * dev)
 {
+       DBF_TEXT(trace, 5, __FUNCTION__);
        fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_STOP, dev);
        return 0;
 }
@@ -2597,7 +2599,7 @@ ctc_tx(struct sk_buff *skb, struct net_device * dev)
        int rc = 0;
        struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        /**
         * Some sanity checks ...
         */
@@ -2655,7 +2657,7 @@ ctc_change_mtu(struct net_device * dev, int new_mtu)
 {
        struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if ((new_mtu < 576) || (new_mtu > 65527) ||
            (new_mtu > (privptr->channel[READ]->max_bufsize -
                        LL_HEADER_LENGTH - 2)))
@@ -2700,7 +2702,7 @@ buffer_write(struct device *dev, const char *buf, size_t count)
        struct net_device *ndev;
        int bs1;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        priv = dev->driver_data;
        if (!priv)
                return -ENODEV;
@@ -2745,7 +2747,7 @@ loglevel_write(struct device *dev, const char *buf, size_t count)
        struct ctc_priv *priv;
        int ll1;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        priv = dev->driver_data;
        if (!priv)
                return -ENODEV;
@@ -2763,7 +2765,7 @@ ctc_print_statistics(struct ctc_priv *priv)
        char *sbuf;
        char *p;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (!priv)
                return;
        sbuf = (char *)kmalloc(2048, GFP_KERNEL);
@@ -2893,7 +2895,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
        if (!privptr)
                return NULL;
 
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
        if (alloc_device) {
                dev = kmalloc(sizeof (struct net_device), GFP_KERNEL);
                if (!dev)
@@ -2945,7 +2947,7 @@ ctc_proto_store(struct device *dev, const char *buf, size_t count)
        struct ctc_priv *priv;
        int value;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        pr_debug("%s() called\n", __FUNCTION__);
 
        priv = dev->driver_data;
@@ -3017,7 +3019,7 @@ ctc_probe_device(struct ccwgroup_device *cgdev)
        int rc;
 
        pr_debug("%s() called\n", __FUNCTION__);
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
 
        if (!get_device(&cgdev->dev))
                return -ENODEV;
@@ -3064,7 +3066,7 @@ ctc_new_device(struct ccwgroup_device *cgdev)
        int ret;
 
        pr_debug("%s() called\n", __FUNCTION__);
-       DBF_TEXT(setup, 2, __FUNCTION__);
+       DBF_TEXT(setup, 3, __FUNCTION__);
 
        privptr = cgdev->dev.driver_data;
        if (!privptr)
@@ -3158,7 +3160,7 @@ ctc_shutdown_device(struct ccwgroup_device *cgdev)
        struct ctc_priv *priv;
        struct net_device *ndev;
                
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        pr_debug("%s() called\n", __FUNCTION__);
 
        priv = cgdev->dev.driver_data;
@@ -3209,7 +3211,7 @@ ctc_remove_device(struct ccwgroup_device *cgdev)
        struct ctc_priv *priv;
 
        pr_debug("%s() called\n", __FUNCTION__);
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
 
        priv = cgdev->dev.driver_data;
        if (!priv)
@@ -3248,7 +3250,7 @@ ctc_exit(void)
 {
        unregister_cu3088_discipline(&ctc_group_driver);
        ctc_tty_cleanup();
-       unregister_dbf_views();
+       ctc_unregister_dbf_views();
        ctc_pr_info("CTC driver unloaded\n");
 }
 
@@ -3265,16 +3267,16 @@ ctc_init(void)
 
        print_banner();
 
-       ret = register_dbf_views();
+       ret = ctc_register_dbf_views();
        if (ret){
-               ctc_pr_crit("ctc_init failed with register_dbf_views rc = %d\n", ret);
+               ctc_pr_crit("ctc_init failed with ctc_register_dbf_views rc = %d\n", ret);
                return ret;
        }
        ctc_tty_init();
        ret = register_cu3088_discipline(&ctc_group_driver);
        if (ret) {
                ctc_tty_cleanup();
-               unregister_dbf_views();
+               ctc_unregister_dbf_views();
        }
        return ret;
 }
index 52d1da3..6290b5c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ctctty.c,v 1.21 2004/07/02 16:31:22 ptiedem Exp $
+ * $Id: ctctty.c,v 1.26 2004/08/04 11:06:55 mschwide Exp $
  *
  * CTC / ESCON network driver, tty interface.
  *
@@ -27,6 +27,7 @@
 #include <linux/tty.h>
 #include <linux/serial_reg.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 #include <asm/uaccess.h>
 #include <linux/devfs_fs_kernel.h>
 #include "ctctty.h"
@@ -104,7 +105,7 @@ ctc_tty_try_read(ctc_tty_info * info, struct sk_buff *skb)
        int len;
        struct tty_struct *tty;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if ((tty = info->tty)) {
                if (info->mcr & UART_MCR_RTS) {
                        c = TTY_FLIPBUF_SIZE - tty->flip.count;
@@ -134,7 +135,7 @@ ctc_tty_readmodem(ctc_tty_info *info)
        int ret = 1;
        struct tty_struct *tty;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if ((tty = info->tty)) {
                if (info->mcr & UART_MCR_RTS) {
                        int c = TTY_FLIPBUF_SIZE - tty->flip.count;
@@ -168,7 +169,7 @@ ctc_tty_setcarrier(struct net_device *netdev, int on)
 {
        int i;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if ((!driver) || ctc_tty_shuttingdown)
                return;
        for (i = 0; i < CTC_TTY_MAX_DEVICES; i++)
@@ -189,7 +190,7 @@ ctc_tty_netif_rx(struct sk_buff *skb)
        int i;
        ctc_tty_info *info = NULL;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (!skb)
                return;
        if ((!skb->dev) || (!driver) || ctc_tty_shuttingdown) {
@@ -254,7 +255,7 @@ ctc_tty_tint(ctc_tty_info * info)
        int wake = 1;
        int rc;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (!info->netdev) {
                if (skb)
                        kfree_skb(skb);
@@ -347,7 +348,7 @@ ctc_tty_inject(ctc_tty_info *info, char c)
        int skb_res;
        struct sk_buff *skb;
        
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_shuttingdown)
                return;
        skb_res = info->netdev->hard_header_len + sizeof(info->mcr) +
@@ -368,7 +369,7 @@ ctc_tty_inject(ctc_tty_info *info, char c)
 static void
 ctc_tty_transmit_status(ctc_tty_info *info)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (ctc_tty_shuttingdown)
                return;
        info->flags |= CTC_ASYNC_TX_LINESTAT;
@@ -382,7 +383,7 @@ ctc_tty_change_speed(ctc_tty_info * info)
        unsigned int quot;
        int i;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if (!info->tty || !info->tty->termios)
                return;
        cflag = info->tty->termios->c_cflag;
@@ -421,7 +422,7 @@ ctc_tty_change_speed(ctc_tty_info * info)
 static int
 ctc_tty_startup(ctc_tty_info * info)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if (info->flags & CTC_ASYNC_INITIALIZED)
                return 0;
 #ifdef CTC_DEBUG_MODEM_OPEN
@@ -464,7 +465,7 @@ ctc_tty_stopdev(unsigned long data)
 static void
 ctc_tty_shutdown(ctc_tty_info * info)
 {
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if (!(info->flags & CTC_ASYNC_INITIALIZED))
                return;
 #ifdef CTC_DEBUG_MODEM_OPEN
@@ -497,7 +498,7 @@ ctc_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int cou
        int total = 0;
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 5, __FUNCTION__);
        if (ctc_tty_shuttingdown)
                goto ex;
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_write"))
@@ -575,7 +576,7 @@ ctc_tty_flush_buffer(struct tty_struct *tty)
        ctc_tty_info *info;
        unsigned long flags;
 
-       DBF_TEXT(trace, 2, __FUNCTION__);
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (!tty)
                goto ex;
        spin_lock_irqsave(&ctc_tty_lock, flags);
@@ -601,6 +602,7 @@ ctc_tty_flush_chars(struct tty_struct *tty)
 {
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_shuttingdown)
                return;
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_flush_chars"))
@@ -623,6 +625,7 @@ ctc_tty_throttle(struct tty_struct *tty)
 {
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_throttle"))
                return;
        info->mcr &= ~UART_MCR_RTS;
@@ -636,6 +639,7 @@ ctc_tty_unthrottle(struct tty_struct *tty)
 {
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_unthrottle"))
                return;
        info->mcr |= UART_MCR_RTS;
@@ -667,6 +671,7 @@ ctc_tty_get_lsr_info(ctc_tty_info * info, uint __user *value)
        uint result;
        ulong flags;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        spin_lock_irqsave(&ctc_tty_lock, flags);
        status = info->lsr;
        spin_unlock_irqrestore(&ctc_tty_lock, flags);
@@ -684,6 +689,7 @@ static int ctc_tty_tiocmget(struct tty_struct *tty, struct file *file)
        uint result;
        ulong flags;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_ioctl"))
                return -ENODEV;
        if (tty->flags & (1 << TTY_IO_ERROR))
@@ -708,6 +714,7 @@ ctc_tty_tiocmset(struct tty_struct *tty, struct file *file,
 {
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_ioctl"))
                return -ENODEV;
        if (tty->flags & (1 << TTY_IO_ERROR))
@@ -736,6 +743,7 @@ ctc_tty_ioctl(struct tty_struct *tty, struct file *file,
        int error;
        int retval;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_ioctl"))
                return -ENODEV;
        if (tty->flags & (1 << TTY_IO_ERROR))
@@ -803,6 +811,8 @@ ctc_tty_set_termios(struct tty_struct *tty, struct termios *old_termios)
 {
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
        unsigned int cflag = tty->termios->c_cflag;
+
+       DBF_TEXT(trace, 4, __FUNCTION__);
        ctc_tty_change_speed(info);
 
        /* Handle transition to B0 */
@@ -840,6 +850,7 @@ ctc_tty_block_til_ready(struct tty_struct *tty, struct file *filp, ctc_tty_info
        unsigned long flags;
        int retval;
 
+       DBF_TEXT(trace, 4, __FUNCTION__);
        /*
         * If the device is in the middle of being closed, then block
         * until it's done, and then try again.
@@ -944,6 +955,7 @@ ctc_tty_open(struct tty_struct *tty, struct file *filp)
        int retval,
         line;
 
+       DBF_TEXT(trace, 3, __FUNCTION__);
        line = tty->index;
        if (line < 0 || line > CTC_TTY_MAX_DEVICES)
                return -ENODEV;
@@ -990,7 +1002,7 @@ ctc_tty_close(struct tty_struct *tty, struct file *filp)
        ctc_tty_info *info = (ctc_tty_info *) tty->driver_data;
        ulong flags;
        ulong timeout;
-
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if (!info || ctc_tty_paranoia_check(info, tty->name, "ctc_tty_close"))
                return;
        spin_lock_irqsave(&ctc_tty_lock, flags);
@@ -1042,9 +1054,8 @@ ctc_tty_close(struct tty_struct *tty, struct file *filp)
                 */
                timeout = jiffies + HZ;
                while (!(info->lsr & UART_LSR_TEMT)) {
-                       set_current_state(TASK_INTERRUPTIBLE);
                        spin_unlock_irqrestore(&ctc_tty_lock, flags);
-                       schedule_timeout(HZ/2);
+                       msleep(500);
                        spin_lock_irqsave(&ctc_tty_lock, flags);
                        if (time_after(jiffies,timeout))
                                break;
@@ -1080,6 +1091,7 @@ ctc_tty_hangup(struct tty_struct *tty)
 {
        ctc_tty_info *info = (ctc_tty_info *)tty->driver_data;
        unsigned long saveflags;
+       DBF_TEXT(trace, 3, __FUNCTION__);
        if (ctc_tty_paranoia_check(info, tty->name, "ctc_tty_hangup"))
                return;
        ctc_tty_shutdown(info);
@@ -1103,6 +1115,7 @@ ctc_tty_task(unsigned long arg)
        unsigned long saveflags;
        int again;
 
+       DBF_TEXT(trace, 3, __FUNCTION__);
        spin_lock_irqsave(&ctc_tty_lock, saveflags);
        if ((!ctc_tty_shuttingdown) && info) {
                again = ctc_tty_tint(info);
@@ -1140,6 +1153,7 @@ ctc_tty_init(void)
        ctc_tty_info *info;
        struct tty_driver *device;
 
+       DBF_TEXT(trace, 2, __FUNCTION__);
        driver = kmalloc(sizeof(ctc_tty_driver), GFP_KERNEL);
        if (driver == NULL) {
                printk(KERN_WARNING "Out of memory in ctc_tty_modem_init\n");
@@ -1199,6 +1213,7 @@ ctc_tty_register_netdev(struct net_device *dev) {
        char *err;
        char *p;
 
+       DBF_TEXT(trace, 2, __FUNCTION__);
        if ((!dev) || (!dev->name)) {
                printk(KERN_WARNING
                       "ctc_tty_register_netdev called "
@@ -1246,6 +1261,7 @@ ctc_tty_unregister_netdev(struct net_device *dev) {
        unsigned long saveflags;
        ctc_tty_info *info = NULL;
 
+       DBF_TEXT(trace, 2, __FUNCTION__);
        spin_lock_irqsave(&ctc_tty_lock, saveflags);
        for (i = 0; i < CTC_TTY_MAX_DEVICES; i++)
                if (driver->info[i].netdev == dev) {
@@ -1264,6 +1280,7 @@ void
 ctc_tty_cleanup(void) {
        unsigned long saveflags;
        
+       DBF_TEXT(trace, 2, __FUNCTION__);
        spin_lock_irqsave(&ctc_tty_lock, saveflags);
        ctc_tty_shuttingdown = 1;
        spin_unlock_irqrestore(&ctc_tty_lock, saveflags);
index 3fbb69d..8c63753 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: iucv.c,v 1.38 2004/07/09 15:59:53 mschwide Exp $
+ * $Id: iucv.c,v 1.40 2004/08/04 12:29:33 cborntra Exp $
  *
  * IUCV network driver
  *
@@ -29,7 +29,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.38 $
+ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.40 $
  *
  */
 \f
@@ -53,6 +53,7 @@
 #include <asm/io.h>
 #include <asm/s390_ext.h>
 #include <asm/ebcdic.h>
+#include <asm/smp.h>
 #include <asm/ccwdev.h> //for root device stuff
 
 /* FLAGS:
@@ -354,7 +355,7 @@ do { \
 static void
 iucv_banner(void)
 {
-       char vbuf[] = "$Revision: 1.38 $";
+       char vbuf[] = "$Revision: 1.40 $";
        char *version = vbuf;
 
        if ((version = strchr(version, ':'))) {
@@ -874,9 +875,6 @@ iucv_register_program (__u8 pgmname[16],
                iucv_remove_handler(new_handler);
                kfree(new_handler);
                switch(rc) {
-               case -ENODEV:
-                       err = "No CPU can be reserved";
-                       break;
                case 0x03:
                        err = "Directory error";
                        break;
index e29e6c6..cac5795 100644 (file)
@@ -11,7 +11,7 @@
  *                       Frank Pavlic (pavlic@de.ibm.com) and
  *                       Martin Schwidefsky <schwidefsky@de.ibm.com>
  *
- *    $Revision: 1.83 $         $Date: 2004/06/30 12:48:14 $
+ *    $Revision: 1.85 $         $Date: 2004/08/04 11:05:43 $
  *
  * 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
@@ -37,6 +37,7 @@
 #include <linux/inetdevice.h>
 #include <linux/in.h>
 #include <linux/igmp.h>
+#include <linux/delay.h>
 #include <net/arp.h>
 #include <net/ip.h>
 
@@ -58,7 +59,7 @@
 /**
  * initialization string for output
  */
-#define VERSION_LCS_C  "$Revision: 1.83 $"
+#define VERSION_LCS_C  "$Revision: 1.85 $"
 
 static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";
 static char debug_buffer[255];
@@ -1420,7 +1421,7 @@ lcs_resetcard(struct lcs_card *card)
                                   card->dev->name);
                        return 0;
                }
-               schedule_timeout(3 * HZ);
+               msleep(3000);
        }
        PRINT_ERR("Error in Reseting LCS card!\n");
        return -EIO;
index 484f718..e95272f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: netiucv.c,v 1.57 2004/06/30 09:26:40 braunu Exp $
+ * $Id: netiucv.c,v 1.63 2004/07/27 13:36:05 mschwide Exp $
  *
  * IUCV network driver
  *
@@ -30,7 +30,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV network driver $Revision: 1.57 $
+ * RELEASE-TAG: IUCV network driver $Revision: 1.63 $
  *
  */
 \f
@@ -69,6 +69,13 @@ MODULE_AUTHOR
 MODULE_DESCRIPTION ("Linux for S/390 IUCV network driver");
 
 \f
+#define PRINTK_HEADER " iucv: "       /* for debugging */
+
+static struct device_driver netiucv_driver = {
+       .name = "netiucv",
+       .bus  = &iucv_bus,
+};
+
 /**
  * Per connection profiling data
  */
@@ -108,7 +115,7 @@ struct iucv_connection {
 /**
  * Linked list of all connection structs.
  */
-static struct iucv_connection *connections;
+static struct iucv_connection *iucv_connections;
 
 /**
  * Representation of event-data for the
@@ -172,7 +179,7 @@ static __u8 iucvMagic[16] = {
  * match exactly as specified in order to give connection_pending()
  * control.
  */
-static __u8 mask[] = {
+static __u8 netiucv_mask[] = {
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
        0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
@@ -361,6 +368,58 @@ static const char *conn_state_names[] = {
 };
 
 \f
+/**
+ * Debug Facility Stuff
+ */
+static debug_info_t *iucv_dbf_setup = NULL;
+static debug_info_t *iucv_dbf_data = NULL;
+static debug_info_t *iucv_dbf_trace = NULL;
+
+DEFINE_PER_CPU(char[256], iucv_dbf_txt_buf);
+
+static void
+iucv_unregister_dbf_views(void)
+{
+       if (iucv_dbf_setup)
+               debug_unregister(iucv_dbf_setup);
+       if (iucv_dbf_data)
+               debug_unregister(iucv_dbf_data);
+       if (iucv_dbf_trace)
+               debug_unregister(iucv_dbf_trace);
+}
+static int
+iucv_register_dbf_views(void)
+{
+       iucv_dbf_setup = debug_register(IUCV_DBF_SETUP_NAME,
+                                       IUCV_DBF_SETUP_INDEX,
+                                       IUCV_DBF_SETUP_NR_AREAS,
+                                       IUCV_DBF_SETUP_LEN);
+       iucv_dbf_data = debug_register(IUCV_DBF_DATA_NAME,
+                                      IUCV_DBF_DATA_INDEX,
+                                      IUCV_DBF_DATA_NR_AREAS,
+                                      IUCV_DBF_DATA_LEN);
+       iucv_dbf_trace = debug_register(IUCV_DBF_TRACE_NAME,
+                                       IUCV_DBF_TRACE_INDEX,
+                                       IUCV_DBF_TRACE_NR_AREAS,
+                                       IUCV_DBF_TRACE_LEN);
+
+       if ((iucv_dbf_setup == NULL) || (iucv_dbf_data == NULL) ||
+           (iucv_dbf_trace == NULL)) {
+               iucv_unregister_dbf_views();
+               return -ENOMEM;
+       }
+       debug_register_view(iucv_dbf_setup, &debug_hex_ascii_view);
+       debug_set_level(iucv_dbf_setup, IUCV_DBF_SETUP_LEVEL);
+
+       debug_register_view(iucv_dbf_data, &debug_hex_ascii_view);
+       debug_set_level(iucv_dbf_data, IUCV_DBF_DATA_LEVEL);
+
+       debug_register_view(iucv_dbf_trace, &debug_hex_ascii_view);
+       debug_set_level(iucv_dbf_trace, IUCV_DBF_TRACE_LEVEL);
+
+       return 0;
+}
+
 /**
  * Callback-wrappers, called from lowlevel iucv layer.
  *****************************************************************************/
@@ -490,7 +549,7 @@ netiucv_unpack_skb(struct iucv_connection *conn, struct sk_buff *pskb)
                struct sk_buff *skb;
                ll_header *header = (ll_header *)pskb->data;
 
-               if (header->next == 0)
+               if (!header->next)
                        break;
 
                skb_pull(pskb, NETIUCV_HDRLEN);
@@ -498,19 +557,21 @@ netiucv_unpack_skb(struct iucv_connection *conn, struct sk_buff *pskb)
                offset += header->next;
                header->next -= NETIUCV_HDRLEN;
                if (skb_tailroom(pskb) < header->next) {
-                       printk(KERN_WARNING
-                              "%s: Illegal next field in iucv header: "
+                       PRINT_WARN("%s: Illegal next field in iucv header: "
                               "%d > %d\n",
                               dev->name, header->next, skb_tailroom(pskb));
+                       IUCV_DBF_TEXT_(data, 2, "Illegal next field: %d > %d\n",
+                               header->next, skb_tailroom(pskb));
                        return;
                }
                skb_put(pskb, header->next);
                pskb->mac.raw = pskb->data;
                skb = dev_alloc_skb(pskb->len);
                if (!skb) {
-                       printk(KERN_WARNING
-                              "%s Out of memory in netiucv_unpack_skb\n",
+                       PRINT_WARN("%s Out of memory in netiucv_unpack_skb\n",
                               dev->name);
+                       IUCV_DBF_TEXT(data, 2,
+                               "Out of memory in netiucv_unpack_skb\n");
                        privptr->stats.rx_dropped++;
                        return;
                }
@@ -538,31 +599,37 @@ conn_action_rx(fsm_instance *fi, int event, void *arg)
        struct iucv_event *ev = (struct iucv_event *)arg;
        struct iucv_connection *conn = ev->conn;
        iucv_MessagePending *eib = (iucv_MessagePending *)ev->data;
-       struct netiucv_priv *privptr = (struct netiucv_priv *)conn->netdev->priv;
+       struct netiucv_priv *privptr =(struct netiucv_priv *)conn->netdev->priv;
 
        __u32 msglen = eib->ln1msg2.ipbfln1f;
        int rc;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
 
        if (!conn->netdev) {
                /* FRITZ: How to tell iucv LL to drop the msg? */
-               printk(KERN_WARNING
-                      "Received data for unlinked connection\n"); 
+               PRINT_WARN("Received data for unlinked connection\n");
+               IUCV_DBF_TEXT(data, 2,
+                       "Received data for unlinked connection\n");
                return;
        }
        if (msglen > conn->max_buffsize) {
                /* FRITZ: How to tell iucv LL to drop the msg? */
                privptr->stats.rx_dropped++;
+               PRINT_WARN("msglen %d > max_buffsize %d\n",
+                       msglen, conn->max_buffsize);
+               IUCV_DBF_TEXT_(data, 2, "msglen %d > max_buffsize %d\n",
+                       msglen, conn->max_buffsize);
                return;
        }
        conn->rx_buff->data = conn->rx_buff->tail = conn->rx_buff->head;
        conn->rx_buff->len = 0;
        rc = iucv_receive(conn->pathid, eib->ipmsgid, eib->iptrgcls,
                          conn->rx_buff->data, msglen, NULL, NULL, NULL);
-       if (rc != 0 || msglen < 5) {
+       if (rc || msglen < 5) {
                privptr->stats.rx_errors++;
-               printk(KERN_INFO "iucv_receive returned %08x\n", rc);
+               PRINT_WARN("iucv_receive returned %08x\n", rc);
+               IUCV_DBF_TEXT_(data, 2, "rc %d from iucv_receive\n", rc);
                return;
        }
        netiucv_unpack_skb(conn, conn->rx_buff);
@@ -584,7 +651,7 @@ conn_action_txdone(fsm_instance *fi, int event, void *arg)
        unsigned long saveflags;
        ll_header header;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
 
        if (conn && conn->netdev && conn->netdev->priv)
                privptr = (struct netiucv_priv *)conn->netdev->priv;
@@ -634,13 +701,13 @@ conn_action_txdone(fsm_instance *fi, int event, void *arg)
                conn->prof.tx_pending++;
                if (conn->prof.tx_pending > conn->prof.tx_max_pending)
                        conn->prof.tx_max_pending = conn->prof.tx_pending;
-               if (rc != 0) {
+               if (rc) {
                        conn->prof.tx_pending--;
                        fsm_newstate(fi, CONN_STATE_IDLE);
                        if (privptr)
                                privptr->stats.tx_errors += txpackets;
-                       printk(KERN_INFO "iucv_send returned %08x\n",
-                               rc);
+                       PRINT_WARN("iucv_send returned %08x\n", rc);
+                       IUCV_DBF_TEXT_(data, 2, "rc %d from iucv_send\n", rc);
                } else {
                        if (privptr) {
                                privptr->stats.tx_packets += txpackets;
@@ -665,14 +732,14 @@ conn_action_connaccept(fsm_instance *fi, int event, void *arg)
        __u16 msglimit;
        __u8 udata[16];
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        rc = iucv_accept(eib->ippathid, NETIUCV_QUEUELEN_DEFAULT, udata, 0,
                         conn->handle, conn, NULL, &msglimit);
-       if (rc != 0) {
-               printk(KERN_WARNING
-                      "%s: IUCV accept failed with error %d\n",
+       if (rc) {
+               PRINT_WARN("%s: IUCV accept failed with error %d\n",
                       netdev->name, rc);
+               IUCV_DBF_TEXT_(setup, 2, "rc %d from iucv_accept", rc);
                return;
        }
        fsm_newstate(fi, CONN_STATE_IDLE);
@@ -690,13 +757,16 @@ conn_action_connreject(fsm_instance *fi, int event, void *arg)
        iucv_ConnectionPending *eib = (iucv_ConnectionPending *)ev->data;
        __u8 udata[16];
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        iucv_sever(eib->ippathid, udata);
        if (eib->ippathid != conn->pathid) {
-               printk(KERN_INFO
-                       "%s: IR Connection Pending; pathid %d does not match original pathid %d\n",
+               PRINT_INFO("%s: IR Connection Pending; "
+                       "pathid %d does not match original pathid %d\n",
                        netdev->name, eib->ippathid, conn->pathid);
+               IUCV_DBF_TEXT_(data, 2,
+                       "connreject: IR pathid %d, conn. pathid %d\n",
+                       eib->ippathid, conn->pathid);
                iucv_sever(conn->pathid, udata);
        }
 }
@@ -710,14 +780,17 @@ conn_action_connack(fsm_instance *fi, int event, void *arg)
        struct net_device *netdev = conn->netdev;
        struct netiucv_priv *privptr = (struct netiucv_priv *)netdev->priv;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        fsm_deltimer(&conn->timer);
        fsm_newstate(fi, CONN_STATE_IDLE);
        if (eib->ippathid != conn->pathid) {
-               printk(KERN_INFO
-                       "%s: IR Connection Complete; pathid %d does not match original pathid %d\n",
+               PRINT_INFO("%s: IR Connection Complete; "
+                       "pathid %d does not match original pathid %d\n",
                        netdev->name, eib->ippathid, conn->pathid);
+               IUCV_DBF_TEXT_(data, 2,
+                       "connack: IR pathid %d, conn. pathid %d\n",
+                       eib->ippathid, conn->pathid);
                conn->pathid = eib->ippathid;
        }
        netdev->tx_queue_len = eib->ipmsglim;
@@ -730,7 +803,7 @@ conn_action_conntimsev(fsm_instance *fi, int event, void *arg)
        struct iucv_connection *conn = (struct iucv_connection *)arg;
        __u8 udata[16];
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        fsm_deltimer(&conn->timer);
        iucv_sever(conn->pathid, udata);
@@ -746,12 +819,13 @@ conn_action_connsever(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = (struct netiucv_priv *)netdev->priv;
        __u8 udata[16];
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        fsm_deltimer(&conn->timer);
        iucv_sever(conn->pathid, udata);
-       printk(KERN_INFO "%s: Remote dropped connection\n",
-              netdev->name);
+       PRINT_INFO("%s: Remote dropped connection\n", netdev->name);
+       IUCV_DBF_TEXT(data, 2,
+               "conn_action_connsever: Remote dropped connection\n");
        fsm_newstate(fi, CONN_STATE_STARTWAIT);
        fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev);
 }
@@ -764,24 +838,28 @@ conn_action_start(fsm_instance *fi, int event, void *arg)
        __u16 msglimit;
        int rc;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
-       if (conn->handle == 0) {
+       if (!conn->handle) {
+               IUCV_DBF_TEXT(trace, 5, "calling iucv_register_program\n");
                conn->handle =
-                       iucv_register_program(iucvMagic, conn->userid, mask,
+                       iucv_register_program(iucvMagic, conn->userid,
+                                             netiucv_mask,
                                              &netiucv_ops, conn);
                fsm_newstate(fi, CONN_STATE_STARTWAIT);
-               if (conn->handle <= 0) {
+               if (!conn->handle) {
                        fsm_newstate(fi, CONN_STATE_REGERR);
-                       conn->handle = 0;
+                       conn->handle = NULL;
+                       IUCV_DBF_TEXT(setup, 2,
+                               "NULL from iucv_register_program\n");
                        return;
                }
 
-               pr_debug("%s('%s'): registered successfully\n",
+               PRINT_DEBUG("%s('%s'): registered successfully\n",
                         conn->netdev->name, conn->userid);
        }
 
-       pr_debug("%s('%s'): connecting ...\n",
+       PRINT_DEBUG("%s('%s'): connecting ...\n",
                 conn->netdev->name, conn->userid);
 
        /* We must set the state before calling iucv_connect because the callback
@@ -790,8 +868,8 @@ conn_action_start(fsm_instance *fi, int event, void *arg)
 
        fsm_newstate(fi, CONN_STATE_SETUPWAIT);
        rc = iucv_connect(&(conn->pathid), NETIUCV_QUEUELEN_DEFAULT, iucvMagic,
-                         conn->userid, iucv_host, 0, NULL, &msglimit, conn->handle,
-                         conn);
+                         conn->userid, iucv_host, 0, NULL, &msglimit,
+                         conn->handle, conn);
        switch (rc) {
                case 0:
                        conn->netdev->tx_queue_len = msglimit;
@@ -799,47 +877,45 @@ conn_action_start(fsm_instance *fi, int event, void *arg)
                                CONN_EVENT_TIMER, conn);
                        return;
                case 11:
-                       printk(KERN_NOTICE
-                              "%s: User %s is currently not available.\n",
+                       PRINT_INFO("%s: User %s is currently not available.\n",
                               conn->netdev->name,
                               netiucv_printname(conn->userid));
                        fsm_newstate(fi, CONN_STATE_STARTWAIT);
                        return;
                case 12:
-                       printk(KERN_NOTICE
-                              "%s: User %s is currently not ready.\n",
+                       PRINT_INFO("%s: User %s is currently not ready.\n",
                               conn->netdev->name,
                               netiucv_printname(conn->userid));
                        fsm_newstate(fi, CONN_STATE_STARTWAIT);
                        return;
                case 13:
-                       printk(KERN_WARNING
-                              "%s: Too many IUCV connections.\n",
+                       PRINT_WARN("%s: Too many IUCV connections.\n",
                               conn->netdev->name);
                        fsm_newstate(fi, CONN_STATE_CONNERR);
                        break;
                case 14:
-                       printk(KERN_WARNING
+                       PRINT_WARN(
                               "%s: User %s has too many IUCV connections.\n",
                               conn->netdev->name,
                               netiucv_printname(conn->userid));
                        fsm_newstate(fi, CONN_STATE_CONNERR);
                        break;
                case 15:
-                       printk(KERN_WARNING
+                       PRINT_WARN(
                               "%s: No IUCV authorization in CP directory.\n",
                               conn->netdev->name);
                        fsm_newstate(fi, CONN_STATE_CONNERR);
                        break;
                default:
-                       printk(KERN_WARNING
-                              "%s: iucv_connect returned error %d\n",
+                       PRINT_WARN("%s: iucv_connect returned error %d\n",
                               conn->netdev->name, rc);
                        fsm_newstate(fi, CONN_STATE_CONNERR);
                        break;
        }
+       IUCV_DBF_TEXT_(setup, 5, "iucv_connect rc is %d\n", rc);
+       IUCV_DBF_TEXT(trace, 5, "calling iucv_unregister_program\n");
        iucv_unregister_program(conn->handle);
-       conn->handle = 0;
+       conn->handle = NULL;
 }
 
 static void
@@ -861,14 +937,15 @@ conn_action_stop(fsm_instance *fi, int event, void *arg)
        struct net_device *netdev = conn->netdev;
        struct netiucv_priv *privptr = (struct netiucv_priv *)netdev->priv;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        fsm_deltimer(&conn->timer);
        fsm_newstate(fi, CONN_STATE_STOPPED);
        netiucv_purge_skb_queue(&conn->collect_queue);
        if (conn->handle)
+               IUCV_DBF_TEXT(trace, 5, "calling iucv_unregister_program\n");
                iucv_unregister_program(conn->handle);
-       conn->handle = 0;
+       conn->handle = NULL;
        netiucv_purge_skb_queue(&conn->commit_queue);
        fsm_event(privptr->fsm, DEV_EVENT_CONDOWN, netdev);
 }
@@ -880,9 +957,9 @@ conn_action_inval(fsm_instance *fi, int event, void *arg)
        struct iucv_connection *conn = ev->conn;
        struct net_device *netdev = conn->netdev;
 
-       printk(KERN_WARNING
-              "%s: Cannot connect without username\n",
+       PRINT_WARN("%s: Cannot connect without username\n",
               netdev->name);
+       IUCV_DBF_TEXT(data, 2, "conn_action_inval called\n");
 }
 
 static const fsm_node conn_fsm[] = {
@@ -938,7 +1015,7 @@ dev_action_start(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = dev->priv;
        struct iucv_event   ev;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        ev.conn = privptr->conn;
        fsm_newstate(fi, DEV_STATE_STARTWAIT);
@@ -959,7 +1036,7 @@ dev_action_stop(fsm_instance *fi, int event, void *arg)
        struct netiucv_priv *privptr = dev->priv;
        struct iucv_event   ev;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        ev.conn = privptr->conn;
 
@@ -981,19 +1058,22 @@ dev_action_connup(fsm_instance *fi, int event, void *arg)
        struct net_device   *dev = (struct net_device *)arg;
        struct netiucv_priv *privptr = dev->priv;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        switch (fsm_getstate(fi)) {
                case DEV_STATE_STARTWAIT:
                        fsm_newstate(fi, DEV_STATE_RUNNING);
-                       printk(KERN_INFO
-                              "%s: connected with remote side %s\n",
+                       PRINT_INFO("%s: connected with remote side %s\n",
                               dev->name, privptr->conn->userid);
+                       IUCV_DBF_TEXT(setup, 3,
+                               "connection is up and running\n");
                        break;
                case DEV_STATE_STOPWAIT:
-                       printk(KERN_INFO
-                              "%s: got connection UP event during shutdown!!\n",
+                       PRINT_INFO(
+                              "%s: got connection UP event during shutdown!\n",
                               dev->name);
+                       IUCV_DBF_TEXT(data, 2,
+                               "dev_action_connup: in DEV_STATE_STOPWAIT\n");
                        break;
        }
 }
@@ -1009,7 +1089,7 @@ dev_action_connup(fsm_instance *fi, int event, void *arg)
 static void
 dev_action_conndown(fsm_instance *fi, int event, void *arg)
 {
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        switch (fsm_getstate(fi)) {
                case DEV_STATE_RUNNING:
@@ -1017,6 +1097,7 @@ dev_action_conndown(fsm_instance *fi, int event, void *arg)
                        break;
                case DEV_STATE_STOPWAIT:
                        fsm_newstate(fi, DEV_STATE_STOPPED);
+                       IUCV_DBF_TEXT(setup, 3, "connection is down\n");
                        break;
        }
 }
@@ -1059,9 +1140,11 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
 
                spin_lock_irqsave(&conn->collect_lock, saveflags);
                if (conn->collect_len + l >
-                   (conn->max_buffsize - NETIUCV_HDRLEN))
+                   (conn->max_buffsize - NETIUCV_HDRLEN)) {
                        rc = -EBUSY;
-               else {
+                       IUCV_DBF_TEXT(data, 2,
+                               "EBUSY from netiucv_transmit_skb\n");
+               } else {
                        atomic_inc(&skb->users);
                        skb_queue_tail(&conn->collect_queue, skb);
                        conn->collect_len += l;
@@ -1080,9 +1163,9 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
                        nskb = alloc_skb(skb->len + NETIUCV_HDRLEN +
                                         NETIUCV_HDRLEN, GFP_ATOMIC | GFP_DMA);
                        if (!nskb) {
-                               printk(KERN_WARNING
-                                      "%s: Could not allocate tx_skb\n",
+                               PRINT_WARN("%s: Could not allocate tx_skb\n",
                                       conn->netdev->name);
+                               IUCV_DBF_TEXT(data, 2, "alloc_skb failed\n");
                                rc = -ENOMEM;
                                return rc;
                        } else {
@@ -1111,7 +1194,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
                conn->prof.tx_pending++;
                if (conn->prof.tx_pending > conn->prof.tx_max_pending)
                        conn->prof.tx_max_pending = conn->prof.tx_pending;
-               if (rc != 0) {
+               if (rc) {
                        struct netiucv_priv *privptr;
                        fsm_newstate(conn->fsm, CONN_STATE_IDLE);
                        conn->prof.tx_pending--;
@@ -1128,8 +1211,8 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
                                skb_pull(skb, NETIUCV_HDRLEN);
                                skb_trim(skb, skb->len - NETIUCV_HDRLEN);
                        }
-                       printk(KERN_INFO "iucv_send returned %08x\n",
-                               rc);
+                       PRINT_WARN("iucv_send returned %08x\n", rc);
+                       IUCV_DBF_TEXT_(data, 2, "rc %d from iucv_send\n", rc);
                } else {
                        if (copied)
                                dev_kfree_skb(skb);
@@ -1155,7 +1238,7 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
  */
 static int
 netiucv_open(struct net_device *dev) {
-       fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_START, dev);
+       fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_START,dev);
        return 0;
 }
 
@@ -1189,18 +1272,21 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
        int          rc = 0;
        struct netiucv_priv *privptr = dev->priv;
 
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        /**
         * Some sanity checks ...
         */
        if (skb == NULL) {
-               printk(KERN_WARNING "%s: NULL sk_buff passed\n", dev->name);
+               PRINT_WARN("%s: NULL sk_buff passed\n", dev->name);
+               IUCV_DBF_TEXT(data, 2, "netiucv_tx: skb is NULL\n");
                privptr->stats.tx_dropped++;
                return 0;
        }
-       if (skb_headroom(skb) < (NETIUCV_HDRLEN)) {
-               printk(KERN_WARNING
-                      "%s: Got sk_buff with head room < %ld bytes\n",
+       if (skb_headroom(skb) < NETIUCV_HDRLEN) {
+               PRINT_WARN("%s: Got sk_buff with head room < %ld bytes\n",
                       dev->name, NETIUCV_HDRLEN);
+               IUCV_DBF_TEXT(data, 2,
+                       "netiucv_tx: skb_headroom < NETIUCV_HDRLEN\n");
                dev_kfree_skb(skb);
                privptr->stats.tx_dropped++;
                return 0;
@@ -1219,11 +1305,12 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
                return 0;
        }
 
-       if (netiucv_test_and_set_busy(dev))
+       if (netiucv_test_and_set_busy(dev)) {
+               IUCV_DBF_TEXT(data, 2, "EBUSY from netiucv_tx\n");
                return -EBUSY;
-
+       }
        dev->trans_start = jiffies;
-       if (netiucv_transmit_skb(privptr->conn, skb) != 0)
+       if (netiucv_transmit_skb(privptr->conn, skb))
                rc = 1;
        netiucv_clear_busy(dev);
        return rc;
@@ -1239,6 +1326,7 @@ static int netiucv_tx(struct sk_buff *skb, struct net_device *dev)
 static struct net_device_stats *
 netiucv_stats (struct net_device * dev)
 {
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return &((struct netiucv_priv *)dev->priv)->stats;
 }
 
@@ -1254,8 +1342,11 @@ netiucv_stats (struct net_device * dev)
 static int
 netiucv_change_mtu (struct net_device * dev, int new_mtu)
 {
-       if ((new_mtu < 576) || (new_mtu > NETIUCV_MTU_MAX))
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       if ((new_mtu < 576) || (new_mtu > NETIUCV_MTU_MAX)) {
+               IUCV_DBF_TEXT(setup, 2, "given MTU out of valid range\n");
                return -EINVAL;
+       }
        dev->mtu = new_mtu;
        return 0;
 }
@@ -1269,6 +1360,7 @@ user_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%s\n", netiucv_printname(priv->conn->userid));
 }
 
@@ -1282,9 +1374,11 @@ user_write (struct device *dev, const char *buf, size_t count)
        char    username[10];
        int     i;
 
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        if (count>9) {
-               printk(KERN_WARNING
-                       "netiucv: username too long (%d)!\n", (int)count);
+               PRINT_WARN("netiucv: username too long (%d)!\n", (int)count);
+               IUCV_DBF_TEXT_(setup, 2,
+                       "%d is length of username\n", (int)count);
                return -EINVAL;
        }
 
@@ -1296,8 +1390,11 @@ user_write (struct device *dev, const char *buf, size_t count)
                        /* trailing lf, grr */
                        break;
                } else {
-                       printk(KERN_WARNING
-                               "netiucv: Invalid character in username!\n");
+                       PRINT_WARN("netiucv: Invalid char %c in username!\n",
+                               *p);
+                       IUCV_DBF_TEXT_(setup, 2,
+                               "username: invalid character %c\n",
+                               *p);
                        return -EINVAL;
                }
        }
@@ -1305,14 +1402,14 @@ user_write (struct device *dev, const char *buf, size_t count)
                username[i++] = ' ';
        username[9] = '\0';
 
-       if (memcmp(username, priv->conn->userid, 8) != 0) {
+       if (memcmp(username, priv->conn->userid, 8)) {
                /* username changed */
                if (ndev->flags & (IFF_UP | IFF_RUNNING)) {
-                       printk(KERN_WARNING
+                       PRINT_WARN(
                                "netiucv: device %s active, connected to %s\n",
                                dev->bus_id, priv->conn->userid);
-                       printk(KERN_WARNING
-                               "netiucv: user cannot be updated\n");
+                       PRINT_WARN("netiucv: user cannot be updated\n");
+                       IUCV_DBF_TEXT(setup, 2, "user_write: device active\n");
                        return -EBUSY;
                }
        }
@@ -1329,6 +1426,7 @@ buffer_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%d\n", priv->conn->max_buffsize);
 }
 
@@ -1340,28 +1438,42 @@ buffer_write (struct device *dev, const char *buf, size_t count)
        char         *e;
        int          bs1;
 
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        if (count >= 39)
                return -EINVAL;
 
        bs1 = simple_strtoul(buf, &e, 0);
 
        if (e && (!isspace(*e))) {
-               printk(KERN_WARNING
-                       "netiucv: Invalid character in buffer!\n");
+               PRINT_WARN("netiucv: Invalid character in buffer!\n");
+               IUCV_DBF_TEXT_(setup, 2, "buffer_write: invalid char %c\n", *e);
                return -EINVAL;
        }
        if (bs1 > NETIUCV_BUFSIZE_MAX) {
-               printk(KERN_WARNING
-                       "netiucv: Given buffer size %d too large.\n",
+               PRINT_WARN("netiucv: Given buffer size %d too large.\n",
+                       bs1);
+               IUCV_DBF_TEXT_(setup, 2,
+                       "buffer_write: buffer size %d too large\n",
                        bs1);
-
                return -EINVAL;
        }
        if ((ndev->flags & IFF_RUNNING) &&
-           (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2)))
+           (bs1 < (ndev->mtu + NETIUCV_HDRLEN + 2))) {
+               PRINT_WARN("netiucv: Given buffer size %d too small.\n",
+                       bs1);
+               IUCV_DBF_TEXT_(setup, 2,
+                       "buffer_write: buffer size %d too small\n",
+                       bs1);
                return -EINVAL;
-       if (bs1 < (576 + NETIUCV_HDRLEN + NETIUCV_HDRLEN))
+       }
+       if (bs1 < (576 + NETIUCV_HDRLEN + NETIUCV_HDRLEN)) {
+               PRINT_WARN("netiucv: Given buffer size %d too small.\n",
+                       bs1);
+               IUCV_DBF_TEXT_(setup, 2,
+                       "buffer_write: buffer size %d too small\n",
+                       bs1);
                return -EINVAL;
+       }
 
        priv->conn->max_buffsize = bs1;
        if (!(ndev->flags & IFF_RUNNING))
@@ -1377,7 +1489,8 @@ static ssize_t
 dev_fsm_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm));
 }
 
@@ -1387,7 +1500,8 @@ static ssize_t
 conn_fsm_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm));
 }
 
@@ -1397,7 +1511,8 @@ static ssize_t
 maxmulti_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.maxmulti);
 }
 
@@ -1405,7 +1520,8 @@ static ssize_t
 maxmulti_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.maxmulti = 0;
        return count;
 }
@@ -1416,7 +1532,8 @@ static ssize_t
 maxcq_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.maxcqueue);
 }
 
@@ -1425,6 +1542,7 @@ maxcq_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
        
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.maxcqueue = 0;
        return count;
 }
@@ -1435,7 +1553,8 @@ static ssize_t
 sdoio_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.doios_single);
 }
 
@@ -1444,6 +1563,7 @@ sdoio_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
        
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.doios_single = 0;
        return count;
 }
@@ -1454,7 +1574,8 @@ static ssize_t
 mdoio_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.doios_multi);
 }
 
@@ -1463,6 +1584,7 @@ mdoio_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
        
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        priv->conn->prof.doios_multi = 0;
        return count;
 }
@@ -1473,7 +1595,8 @@ static ssize_t
 txlen_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.txlen);
 }
 
@@ -1482,6 +1605,7 @@ txlen_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
        
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.txlen = 0;
        return count;
 }
@@ -1492,7 +1616,8 @@ static ssize_t
 txtime_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
-       
+
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_time);
 }
 
@@ -1501,6 +1626,7 @@ txtime_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
        
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.tx_time = 0;
        return count;
 }
@@ -1512,6 +1638,7 @@ txpend_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_pending);
 }
 
@@ -1520,6 +1647,7 @@ txpend_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.tx_pending = 0;
        return count;
 }
@@ -1531,6 +1659,7 @@ txmpnd_show (struct device *dev, char *buf)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 5, __FUNCTION__);
        return sprintf(buf, "%ld\n", priv->conn->prof.tx_max_pending);
 }
 
@@ -1539,6 +1668,7 @@ txmpnd_write (struct device *dev, const char *buf, size_t count)
 {
        struct netiucv_priv *priv = dev->driver_data;
 
+       IUCV_DBF_TEXT(trace, 4, __FUNCTION__);
        priv->conn->prof.tx_max_pending = 0;
        return count;
 }
@@ -1579,8 +1709,7 @@ netiucv_add_files(struct device *dev)
 {
        int ret;
 
-       pr_debug("%s() called\n", __FUNCTION__);
-
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        ret = sysfs_create_group(&dev->kobj, &netiucv_attr_group);
        if (ret)
                return ret;
@@ -1593,7 +1722,7 @@ netiucv_add_files(struct device *dev)
 static inline void
 netiucv_remove_files(struct device *dev)
 {
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        sysfs_remove_group(&dev->kobj, &netiucv_stat_attr_group);
        sysfs_remove_group(&dev->kobj, &netiucv_attr_group);
 }
@@ -1606,7 +1735,7 @@ netiucv_register_device(struct net_device *ndev)
        int ret;
 
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        if (dev) {
                memset(dev, 0, sizeof(struct device));
@@ -1621,6 +1750,7 @@ netiucv_register_device(struct net_device *ndev)
                 * but legitime ...).
                 */
                dev->release = (void (*)(struct device *))kfree;
+               dev->driver = &netiucv_driver;
        } else
                return -ENOMEM;
 
@@ -1631,8 +1761,8 @@ netiucv_register_device(struct net_device *ndev)
        ret = netiucv_add_files(dev);
        if (ret)
                goto out_unreg;
-       dev->driver_data = priv;
        priv->dev = dev;
+       dev->driver_data = priv;
        return 0;
 
 out_unreg:
@@ -1643,19 +1773,19 @@ out_unreg:
 static void
 netiucv_unregister_device(struct device *dev)
 {
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        netiucv_remove_files(dev);
        device_unregister(dev);
 }
 
 /**
  * Allocate and initialize a new connection structure.
- * Add it to the list of connections;
+ * Add it to the list of netiucv connections;
  */
 static struct iucv_connection *
 netiucv_new_connection(struct net_device *dev, char *username)
 {
-       struct iucv_connection **clist = &connections;
+       struct iucv_connection **clist = &iucv_connections;
        struct iucv_connection *conn =
                (struct iucv_connection *)
                kmalloc(sizeof(struct iucv_connection), GFP_KERNEL);
@@ -1706,23 +1836,22 @@ netiucv_new_connection(struct net_device *dev, char *username)
 
 /**
  * Release a connection structure and remove it from the
- * list of connections.
+ * list of netiucv connections.
  */
 static void
 netiucv_remove_connection(struct iucv_connection *conn)
 {
-       struct iucv_connection **clist = &connections;
-
-       pr_debug("%s() called\n", __FUNCTION__);
+       struct iucv_connection **clist = &iucv_connections;
 
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        if (conn == NULL)
                return;
        while (*clist) {
                if (*clist == conn) {
                        *clist = conn->next;
-                       if (conn->handle != 0) {
+                       if (conn->handle) {
                                iucv_unregister_program(conn->handle);
-                               conn->handle = 0;
+                               conn->handle = NULL;
                        }
                        fsm_deltimer(&conn->timer);
                        kfree_fsm(conn->fsm);
@@ -1742,7 +1871,7 @@ netiucv_free_netdevice(struct net_device *dev)
 {
        struct netiucv_priv *privptr;
 
-       pr_debug("%s() called\n", __FUNCTION__);
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
        if (!dev)
                return;
@@ -1753,7 +1882,7 @@ netiucv_free_netdevice(struct net_device *dev)
                        netiucv_remove_connection(privptr->conn);
                if (privptr->fsm)
                        kfree_fsm(privptr->fsm);
-               privptr->conn = 0; privptr->fsm = 0;
+               privptr->conn = NULL; privptr->fsm = NULL;
                /* privptr gets freed by free_netdev() */
        }
        free_netdev(dev);
@@ -1795,12 +1924,16 @@ netiucv_init_netdevice(char *username)
                           netiucv_setup_netdevice);
        if (!dev)
                return NULL;
+       if (dev_alloc_name(dev, dev->name) < 0) {
+               free_netdev(dev);
+               return NULL;
+       }
 
-        privptr = (struct netiucv_priv *)dev->priv;
+       privptr = (struct netiucv_priv *)dev->priv;
        privptr->fsm = init_fsm("netiucvdev", dev_state_names,
                                dev_event_names, NR_DEV_STATES, NR_DEV_EVENTS,
                                dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
-       if (privptr->fsm == NULL) {
+       if (!privptr->fsm) {
                free_netdev(dev);
                return NULL;
        }
@@ -1808,6 +1941,7 @@ netiucv_init_netdevice(char *username)
        if (!privptr->conn) {
                kfree_fsm(privptr->fsm);
                free_netdev(dev);
+               IUCV_DBF_TEXT(setup, 2, "NULL from netiucv_new_connection\n");
                return NULL;
        }
        fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
@@ -1823,9 +1957,10 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)
        int i, ret;
        struct net_device *dev;
 
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        if (count>9) {
-               printk(KERN_WARNING
-                      "netiucv: username too long (%d)!\n", (int)count);
+               PRINT_WARN("netiucv: username too long (%d)!\n", (int)count);
+               IUCV_DBF_TEXT(setup, 2, "conn_write: too long\n");
                return -EINVAL;
        }
 
@@ -1836,8 +1971,9 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)
                        /* trailing lf, grr */
                        break;
                } else {
-                       printk(KERN_WARNING
-                              "netiucv: Invalid character in username!\n");
+                       PRINT_WARN("netiucv: Invalid character in username!\n");
+                       IUCV_DBF_TEXT_(setup, 2,
+                               "conn_write: invalid character %c\n", *p);
                        return -EINVAL;
                }
        }
@@ -1846,30 +1982,36 @@ conn_write(struct device_driver *drv, const char *buf, size_t count)
        username[9] = '\0';
        dev = netiucv_init_netdevice(username);
        if (!dev) {
-               printk(KERN_WARNING
+               PRINT_WARN(
                       "netiucv: Could not allocate network device structure "
                       "for user '%s'\n", netiucv_printname(username));
+               IUCV_DBF_TEXT(setup, 2, "NULL from netiucv_init_netdevice\n");
                return -ENODEV;
        }
-       
-       if ((ret = register_netdev(dev))) {
-               goto out_free_ndev;
-       }
 
        if ((ret = netiucv_register_device(dev))) {
-               unregister_netdev(dev);
+               IUCV_DBF_TEXT_(setup, 2,
+                       "ret %d from netiucv_register_device\n", ret);
                goto out_free_ndev;
        }
 
        /* sysfs magic */
-       SET_NETDEV_DEV(dev, (struct device*)((struct netiucv_priv*)dev->priv)->dev);
-       printk(KERN_INFO "%s: '%s'\n", dev->name, netiucv_printname(username));
+       SET_NETDEV_DEV(dev,
+                       (struct device*)((struct netiucv_priv*)dev->priv)->dev);
+
+       if ((ret = register_netdev(dev))) {
+               netiucv_unregister_device((struct device*)
+                       ((struct netiucv_priv*)dev->priv)->dev);
+               goto out_free_ndev;
+       }
+
+       PRINT_INFO("%s: '%s'\n", dev->name, netiucv_printname(username));
        
        return count;
 
 out_free_ndev:
-       printk(KERN_WARNING
-                      "netiucv: Could not register '%s'\n", dev->name);
+       PRINT_WARN("netiucv: Could not register '%s'\n", dev->name);
+       IUCV_DBF_TEXT(setup, 2, "conn_write: could not register\n");
        netiucv_free_netdevice(dev);
        return ret;
 }
@@ -1879,7 +2021,7 @@ DRIVER_ATTR(connection, 0200, NULL, conn_write);
 static ssize_t
 remove_write (struct device_driver *drv, const char *buf, size_t count)
 {
-       struct iucv_connection **clist = &connections;
+       struct iucv_connection **clist = &iucv_connections;
         struct net_device *ndev;
         struct netiucv_priv *priv;
         struct device *dev;
@@ -1887,7 +2029,7 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
         char *p;
         int i;
 
-        pr_debug("%s() called\n", __FUNCTION__);
+        IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
 
         if (count >= IFNAMSIZ)
                 count = IFNAMSIZ-1;
@@ -1912,34 +2054,29 @@ remove_write (struct device_driver *drv, const char *buf, size_t count)
                         continue;
                 }
                 if (ndev->flags & (IFF_UP | IFF_RUNNING)) {
-                        printk(KERN_WARNING
+                        PRINT_WARN(
                                 "netiucv: net device %s active with peer %s\n",
                                 ndev->name, priv->conn->userid);
-                        printk(KERN_WARNING
-                                "netiucv: %s cannot be removed\n",
+                        PRINT_WARN("netiucv: %s cannot be removed\n",
                                 ndev->name);
+                       IUCV_DBF_TEXT(data, 2, "remove_write: still active\n");
                         return -EBUSY;
                 }
                 unregister_netdev(ndev);
                 netiucv_unregister_device(dev);
                 return count;
         }
-        printk(KERN_WARNING
-                "netiucv: net device %s unknown\n", name);
+        PRINT_WARN("netiucv: net device %s unknown\n", name);
+       IUCV_DBF_TEXT(data, 2, "remove_write: unknown device\n");
         return -EINVAL;
 }
 
 DRIVER_ATTR(remove, 0200, NULL, remove_write);
 
-static struct device_driver netiucv_driver = {
-       .name = "netiucv",
-       .bus  = &iucv_bus,
-};
-
 static void
 netiucv_banner(void)
 {
-       char vbuf[] = "$Revision: 1.57 $";
+       char vbuf[] = "$Revision: 1.63 $";
        char *version = vbuf;
 
        if ((version = strchr(version, ':'))) {
@@ -1948,14 +2085,15 @@ netiucv_banner(void)
                        *p = '\0';
        } else
                version = " ??? ";
-       printk(KERN_INFO "NETIUCV driver Version%s initialized\n", version);
+       PRINT_INFO("NETIUCV driver Version%s initialized\n", version);
 }
 
 static void __exit
 netiucv_exit(void)
 {
-       while (connections) {
-               struct net_device *ndev = connections->netdev;
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
+       while (iucv_connections) {
+               struct net_device *ndev = iucv_connections->netdev;
                struct netiucv_priv *priv = (struct netiucv_priv*)ndev->priv;
                struct device *dev = priv->dev;
 
@@ -1966,8 +2104,9 @@ netiucv_exit(void)
        driver_remove_file(&netiucv_driver, &driver_attr_connection);
        driver_remove_file(&netiucv_driver, &driver_attr_remove);
        driver_unregister(&netiucv_driver);
+       iucv_unregister_dbf_views();
 
-       printk(KERN_INFO "NETIUCV driver unloaded\n");
+       PRINT_INFO("NETIUCV driver unloaded\n");
        return;
 }
 
@@ -1976,20 +2115,31 @@ netiucv_init(void)
 {
        int ret;
        
+       ret = iucv_register_dbf_views();
+       if (ret) {
+               PRINT_WARN("netiucv_init failed, "
+                       "iucv_register_dbf_views rc = %d\n", ret);
+               return ret;
+       }
+       IUCV_DBF_TEXT(trace, 3, __FUNCTION__);
        ret = driver_register(&netiucv_driver);
-       if (ret != 0) {
-               printk(KERN_ERR "NETIUCV: failed to register driver.\n");
+       if (ret) {
+               PRINT_ERR("NETIUCV: failed to register driver.\n");
+               IUCV_DBF_TEXT_(setup, 2, "ret %d from driver_register\n", ret);
+               iucv_unregister_dbf_views();
                return ret;
        }
 
        /* Add entry for specifying connections. */
        ret = driver_create_file(&netiucv_driver, &driver_attr_connection);
-       if (ret == 0) {
+       if (!ret) {
                ret = driver_create_file(&netiucv_driver, &driver_attr_remove);
                netiucv_banner();
        } else {
-               printk(KERN_ERR "NETIUCV: failed to add driver attribute.\n");
+               PRINT_ERR("NETIUCV: failed to add driver attribute.\n");
+               IUCV_DBF_TEXT_(setup, 2, "ret %d from driver_create_file\n", ret);
                driver_unregister(&netiucv_driver);
+               iucv_unregister_dbf_views();
        }
        return ret;
 }
index dc5a6f9..eaae2af 100644 (file)
@@ -23,7 +23,7 @@
 
 #include "qeth_mpc.h"
 
-#define VERSION_QETH_H                 "$Revision: 1.111 $"
+#define VERSION_QETH_H                 "$Revision: 1.113 $"
 
 #ifdef CONFIG_QETH_IPV6
 #define QETH_VERSION_IPV6      ":IPv6"
@@ -150,6 +150,8 @@ qeth_hex_dump(unsigned char *buf, size_t len)
 #define SENSE_RESETTING_EVENT_BYTE 1
 #define SENSE_RESETTING_EVENT_FLAG 0x80
 
+#define atomic_swap(a,b) xchg((int *)a.counter, b)
+
 /*
  * Common IO related definitions
  */
@@ -425,12 +427,18 @@ struct qeth_qdio_out_buffer {
 
 struct qeth_card;
 
+enum qeth_out_q_states {
+       QETH_OUT_Q_UNLOCKED,
+       QETH_OUT_Q_LOCKED,
+       QETH_OUT_Q_LOCKED_FLUSH,
+};
+
 struct qeth_qdio_out_q {
        struct qdio_buffer qdio_bufs[QDIO_MAX_BUFFERS_PER_Q];
        struct qeth_qdio_out_buffer bufs[QDIO_MAX_BUFFERS_PER_Q];
        int queue_no;
        struct qeth_card *card;
-       spinlock_t lock;
+       atomic_t state;
        volatile int do_pack;
        /*
         * index of buffer to be filled by driver; state EMPTY or PACKING
index 9e45195..5c9a51c 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef __QETH_FS_H__
 #define __QETH_FS_H__
 
-#define VERSION_QETH_FS_H "$Revision: 1.8 $"
+#define VERSION_QETH_FS_H "$Revision: 1.9 $"
 
 extern const char *VERSION_QETH_PROC_C;
 extern const char *VERSION_QETH_SYS_C;
@@ -138,6 +138,8 @@ qeth_get_cardname_short(struct qeth_card *card)
                                return "HSTR";
                        case QETH_LINK_TYPE_GBIT_ETH:
                                return "OSD_1000";
+                       case QETH_LINK_TYPE_10GBIT_ETH:
+                               return "OSD_10GIG";
                        case QETH_LINK_TYPE_LANE_ETH100:
                                return "OSD_FE_LANE";
                        case QETH_LINK_TYPE_LANE_TR:
index 0f75e58..17f0f67 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * linux/drivers/s390/net/qeth_main.c ($Revision: 1.125 $)
+ * linux/drivers/s390/net/qeth_main.c ($Revision: 1.130 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  *
@@ -12,7 +12,7 @@
  *                       Frank Pavlic (pavlic@de.ibm.com) and
  *                       Thomas Spatzier <tspat@de.ibm.com>
  *
- *    $Revision: 1.125 $        $Date: 2004/06/29 17:28:24 $
+ *    $Revision: 1.130 $        $Date: 2004/08/05 11:21:50 $
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -78,7 +78,7 @@ qeth_eyecatcher(void)
 #include "qeth_mpc.h"
 #include "qeth_fs.h"
 
-#define VERSION_QETH_C "$Revision: 1.125 $"
+#define VERSION_QETH_C "$Revision: 1.130 $"
 static const char *version = "qeth S/390 OSA-Express driver";
 
 /**
@@ -1801,7 +1801,7 @@ qeth_send_control_data(struct qeth_card *card, int len,
        }
        add_timer(&timer);
        wait_event(reply->wait_q, reply->received);
-       del_timer(&timer);
+       del_timer_sync(&timer);
        rc = reply->rc;
        qeth_put_reply(reply);
        return rc;
@@ -2105,7 +2105,7 @@ qeth_get_next_skb(struct qeth_card *card, struct qdio_buffer *buffer,
                                QETH_DBF_TEXT(qerr,2,"unexeob");
                                QETH_DBF_TEXT_(qerr,2,"%s",CARD_BUS_ID(card));
                                QETH_DBF_HEX(misc,4,buffer,sizeof(*buffer));
-                               dev_kfree_skb_irq(skb);
+                               dev_kfree_skb_any(skb);
                                card->stats.rx_errors++;
                                return NULL;
                        }
@@ -2297,7 +2297,7 @@ qeth_process_inbound_buffer(struct qeth_card *card,
                qeth_rebuild_skb(card, skb, hdr);
                /* is device UP ? */
                if (!(card->dev->flags & IFF_UP)){
-                       dev_kfree_skb_irq(skb);
+                       dev_kfree_skb_any(skb);
                        continue;
                }
                skb->dev = card->dev;
@@ -2311,16 +2311,16 @@ qeth_process_inbound_buffer(struct qeth_card *card,
 static inline struct qeth_buffer_pool_entry *
 qeth_get_buffer_pool_entry(struct qeth_card *card)
 {
-       struct qeth_buffer_pool_entry *entry, *tmp;
+       struct qeth_buffer_pool_entry *entry;
 
        QETH_DBF_TEXT(trace, 6, "gtbfplen");
-       entry = NULL;
-       list_for_each_entry_safe(entry, tmp,
-                                &card->qdio.in_buf_pool.entry_list, list){
+       if (!list_empty(&card->qdio.in_buf_pool.entry_list)) {
+               entry = list_entry(card->qdio.in_buf_pool.entry_list.next,
+                               struct qeth_buffer_pool_entry, list);
                list_del_init(&entry->list);
-               break;
+               return entry;
        }
-       return entry;
+       return NULL;
 }
 
 static inline void
@@ -2367,7 +2367,7 @@ qeth_clear_output_buffer(struct qeth_qdio_out_q *queue,
                buf->buffer->element[i].flags = 0;
                while ((skb = skb_dequeue(&buf->skb_list))){
                        atomic_dec(&skb->users);
-                       dev_kfree_skb_irq(skb);
+                       dev_kfree_skb_any(skb);
                }
        }
        buf->next_element_to_fill = 0;
@@ -2588,14 +2588,9 @@ qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int,
                QETH_DBF_TEXT(trace, 2, "flushbuf");
                QETH_DBF_TEXT_(trace, 2, " err%d", rc);
                queue->card->stats.tx_errors += count;
-               /* ok, since do_QDIO went wrong the buffers have not been given
-                * to the hardware. they still belong to us, so we can clear
-                * them and reuse then, i.e. set back next_buf_to_fill*/
-               for (i = index; i < index + count; ++i) {
-                       buf = &queue->bufs[i % QDIO_MAX_BUFFERS_PER_Q];
-                       qeth_clear_output_buffer(queue, buf);
-               }
-               queue->next_buf_to_fill = index;
+               /* this must not happen under normal circumstances. if it
+                * happens something is really wrong -> recover */
+               qeth_schedule_recovery(queue->card);
                return;
        }
        atomic_add(count, &queue->used_buffers);
@@ -2605,16 +2600,12 @@ qeth_flush_buffers(struct qeth_qdio_out_q *queue, int under_int,
 }
 
 /*
- * switches between PACKING and non-PACKING state if needed.
- * has to be called holding queue->lock
+ * Switched to packing state if the number of used buffers on a queue
+ * reaches a certain limit.
  */
-static inline int
-qeth_switch_packing_state(struct qeth_qdio_out_q *queue)
+static inline void
+qeth_switch_to_packing_if_needed(struct qeth_qdio_out_q *queue)
 {
-       struct qeth_qdio_out_buffer *buffer;
-       int flush_count = 0;
-
-       QETH_DBF_TEXT(trace, 6, "swipack");
        if (!queue->do_pack) {
                if (atomic_read(&queue->used_buffers)
                    >= QETH_HIGH_WATERMARK_PACK){
@@ -2625,7 +2616,22 @@ qeth_switch_packing_state(struct qeth_qdio_out_q *queue)
 #endif
                        queue->do_pack = 1;
                }
-       } else {
+       }
+}
+
+/*
+ * Switches from packing to non-packing mode. If there is a packing
+ * buffer on the queue this buffer will be prepared to be flushed.
+ * In that case 1 is returned to inform the caller. If no buffer
+ * has to be flushed, zero is returned.
+ */
+static inline int
+qeth_switch_to_nonpacking_if_needed(struct qeth_qdio_out_q *queue)
+{
+       struct qeth_qdio_out_buffer *buffer;
+       int flush_count = 0;
+
+       if (queue->do_pack) {
                if (atomic_read(&queue->used_buffers)
                    <= QETH_LOW_WATERMARK_PACK) {
                        /* switch PACKING -> non-PACKING */
@@ -2650,21 +2656,62 @@ qeth_switch_packing_state(struct qeth_qdio_out_q *queue)
        return flush_count;
 }
 
-static inline void
-qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue, int under_int)
+/*
+ * Called to flush a packing buffer if no more pci flags are on the queue.
+ * Checks if there is a packing buffer and prepares it to be flushed.
+ * In that case returns 1, otherwise zero.
+ */
+static inline int
+qeth_flush_buffers_on_no_pci(struct qeth_qdio_out_q *queue)
 {
        struct qeth_qdio_out_buffer *buffer;
-       int index;
 
-       index = queue->next_buf_to_fill;
-       buffer = &queue->bufs[index];
+       buffer = &queue->bufs[queue->next_buf_to_fill];
        if((atomic_read(&buffer->state) == QETH_QDIO_BUF_EMPTY) &&
           (buffer->next_element_to_fill > 0)){
                /* it's a packing buffer */
                atomic_set(&buffer->state, QETH_QDIO_BUF_PRIMED);
                queue->next_buf_to_fill =
                        (queue->next_buf_to_fill + 1) % QDIO_MAX_BUFFERS_PER_Q;
-               qeth_flush_buffers(queue, under_int, index, 1);
+               return 1;
+       }
+       return 0;
+}
+
+static inline void
+qeth_check_outbound_queue(struct qeth_qdio_out_q *queue)
+{
+       int index;
+       int flush_cnt = 0;
+
+       /*
+        * check if weed have to switch to non-packing mode or if
+        * we have to get a pci flag out on the queue
+        */
+       if ((atomic_read(&queue->used_buffers) <= QETH_LOW_WATERMARK_PACK) ||
+           !atomic_read(&queue->set_pci_flags_count)){
+               if (atomic_swap(&queue->state, QETH_OUT_Q_LOCKED_FLUSH) ==
+                               QETH_OUT_Q_UNLOCKED) {
+                       /*
+                        * If we get in here, there was no action in
+                        * do_send_packet. So, we check if there is a
+                        * packing buffer to be flushed here.
+                        */
+                       /* TODO: try if we get a performance improvement
+                        * by calling netif_stop_queue here */
+                       /* save start index for flushing */
+                       index = queue->next_buf_to_fill;
+                       flush_cnt += qeth_switch_to_nonpacking_if_needed(queue);
+                       if (!flush_cnt &&
+                           !atomic_read(&queue->set_pci_flags_count))
+                               flush_cnt +=
+                                       qeth_flush_buffers_on_no_pci(queue);
+                       /* were done with updating critical queue members */
+                       atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
+                       /* flushing can be done outside the lock */
+                       if (flush_cnt)
+                               qeth_flush_buffers(queue, 1, index, flush_cnt);
+               }
        }
 }
 
@@ -2710,6 +2757,8 @@ qeth_qdio_output_handler(struct ccw_device * ccwdev, unsigned int status,
                qeth_clear_output_buffer(queue, buffer);
        }
        atomic_sub(count, &queue->used_buffers);
+       /* check if we need to do something on this outbound queue */
+       qeth_check_outbound_queue(queue);
 
        netif_wake_queue(card->dev);
 #ifdef CONFIG_QETH_PERF_STATS
@@ -2981,7 +3030,8 @@ qeth_init_qdio_queues(struct qeth_card *card)
                card->qdio.out_qs[i]->do_pack = 0;
                atomic_set(&card->qdio.out_qs[i]->used_buffers,0);
                atomic_set(&card->qdio.out_qs[i]->set_pci_flags_count, 0);
-               spin_lock_init(&card->qdio.out_qs[i]->lock);
+               atomic_set(&card->qdio.out_qs[i]->state,
+                          QETH_OUT_Q_UNLOCKED);
        }
        return 0;
 }
@@ -3295,12 +3345,12 @@ qeth_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        card->perf_stats.outbound_start_time = qeth_get_micros();
 #endif
        /*
-        * dev_queue_xmit should ensure that we are called packet
-        * after packet
+        * We only call netif_stop_queue in case of errors. Since we've
+        * got our own synchronization on queues we can keep the stack's
+        * queue running.
         */
-       netif_stop_queue(dev);
-       if (!(rc = qeth_send_packet(card, skb)))
-               netif_wake_queue(dev);
+       if ((rc = qeth_send_packet(card, skb)))
+               netif_stop_queue(dev);
 
 #ifdef CONFIG_QETH_PERF_STATS
        card->perf_stats.outbound_time += qeth_get_micros() -
@@ -3714,7 +3764,11 @@ qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue,
 
        QETH_DBF_TEXT(trace, 6, "dosndpfa");
 
-       spin_lock(&queue->lock);
+       /* spin until we get the queue ... */
+       while (atomic_compare_and_swap(QETH_OUT_Q_UNLOCKED,
+                                      QETH_OUT_Q_LOCKED,
+                                      &queue->state));
+       /* ... now we've got the queue */
        index = queue->next_buf_to_fill;
        buffer = &queue->bufs[queue->next_buf_to_fill];
        /*
@@ -3723,14 +3777,14 @@ qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue,
         */
        if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY) {
                card->stats.tx_dropped++;
-               spin_unlock(&queue->lock);
+               atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
                return -EBUSY;
        }
        queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) %
                                  QDIO_MAX_BUFFERS_PER_Q;
+       atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
        qeth_fill_buffer(queue, buffer, (char *)hdr, skb);
        qeth_flush_buffers(queue, 0, index, 1);
-       spin_unlock(&queue->lock);
        return 0;
 }
 
@@ -3746,7 +3800,10 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
 
        QETH_DBF_TEXT(trace, 6, "dosndpkt");
 
-       spin_lock(&queue->lock);
+       /* spin until we get the queue ... */
+       while (atomic_compare_and_swap(QETH_OUT_Q_UNLOCKED,
+                                      QETH_OUT_Q_LOCKED,
+                                      &queue->state));
        start_index = queue->next_buf_to_fill;
        buffer = &queue->bufs[queue->next_buf_to_fill];
        /*
@@ -3755,9 +3812,11 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
         */
        if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){
                card->stats.tx_dropped++;
-               spin_unlock(&queue->lock);
+               atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED);
                return -EBUSY;
        }
+       /* check if we need to switch packing state of this queue */
+       qeth_switch_to_packing_if_needed(queue);
        if (queue->do_pack){
                /* does packet fit in current buffer? */
                if((QETH_MAX_BUFFER_ELEMENTS(card) -
@@ -3772,11 +3831,10 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
                        /* we did a step forward, so check buffer state again */
                        if (atomic_read(&buffer->state) != QETH_QDIO_BUF_EMPTY){
                                card->stats.tx_dropped++;
-                               qeth_flush_buffers(queue, 0, start_index, 1);
-                               spin_unlock(&queue->lock);
                                /* return EBUSY because we sent old packet, not
                                 * the current one */
-                               return -EBUSY;
+                               rc = -EBUSY;
+                               goto out;
                        }
                }
        }
@@ -3787,16 +3845,27 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue,
                queue->next_buf_to_fill = (queue->next_buf_to_fill + 1) %
                        QDIO_MAX_BUFFERS_PER_Q;
        }
-       /* check if we need to switch packing state of this queue */
-       flush_count += qeth_switch_packing_state(queue);
-
+       /*
+        * queue->state will go from LOCKED -> UNLOCKED or from
+        * LOCKED_FLUSH -> LOCKED if output_handler wanted to 'notify' us
+        * (switch packing state or flush buffer to get another pci flag out).
+        * In that case we will enter this loop
+        */
+       while (atomic_dec_return(&queue->state)){
+               /* check if we can go back to non-packing state */
+               flush_count += qeth_switch_to_nonpacking_if_needed(queue);
+               /*
+                * check if we need to flush a packing buffer to get a pci
+                * flag out on the queue
+                */
+               if (!flush_count && !atomic_read(&queue->set_pci_flags_count))
+                       flush_count += qeth_flush_buffers_on_no_pci(queue);
+       }
+       /* at this point the queue is UNLOCKED again */
+out:
        if (flush_count)
                qeth_flush_buffers(queue, 0, start_index, flush_count);
 
-       if (!atomic_read(&queue->set_pci_flags_count))
-               qeth_flush_buffers_on_no_pci(queue, 0);
-
-       spin_unlock(&queue->lock);
        return rc;
 }
 
@@ -3853,7 +3922,8 @@ qeth_mdio_read(struct net_device *dev, int phy_id, int regnum)
        switch(regnum){
        case MII_BMCR: /* Basic mode control register */
                rc = BMCR_FULLDPLX;
-               if(card->info.link_type != QETH_LINK_TYPE_GBIT_ETH)
+               if ((card->info.link_type != QETH_LINK_TYPE_GBIT_ETH)&&
+                   (card->info.link_type != QETH_LINK_TYPE_10GBIT_ETH))
                        rc |= BMCR_SPEED100;
                break;
        case MII_BMSR: /* Basic mode status register */
index 910c5f5..902f441 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *
- * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.32 $)
+ * linux/drivers/s390/net/qeth_sys.c ($Revision: 1.33 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  * This file contains code related to sysfs.
@@ -20,7 +20,7 @@
 #include "qeth_mpc.h"
 #include "qeth_fs.h"
 
-const char *VERSION_QETH_SYS_C = "$Revision: 1.32 $";
+const char *VERSION_QETH_SYS_C = "$Revision: 1.33 $";
 
 /*****************************************************************************/
 /*                                                                           */
@@ -476,7 +476,7 @@ qeth_dev_add_hhlen_store(struct device *dev, const char *buf, size_t count)
            (card->state != CARD_STATE_RECOVER))
                return -EPERM;
 
-       i = simple_strtoul(buf, &tmp, 16);
+       i = simple_strtoul(buf, &tmp, 10);
        if ((i < 0) || (i > MAX_ADD_HHLEN)) {
                PRINT_WARN("add_hhlen out of range\n");
                return -EINVAL;
index 939bbad..dad0289 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_AUX_REVISION "$Revision: 1.114 $"
+#define ZFCP_AUX_REVISION "$Revision: 1.115 $"
 
 #include "zfcp_ext.h"
 
@@ -41,8 +41,6 @@ static char *device;
 /* written against the module interface */
 static int __init  zfcp_module_init(void);
 
-int zfcp_reboot_handler(struct notifier_block *, unsigned long, void *);
-
 /* FCP related */
 static void zfcp_ns_gid_pn_handler(unsigned long);
 
@@ -338,9 +336,6 @@ zfcp_module_init(void)
        /* initialise configuration rw lock */
        rwlock_init(&zfcp_data.config_lock);
 
-       zfcp_data.reboot_notifier.notifier_call = zfcp_reboot_handler;
-       register_reboot_notifier(&zfcp_data.reboot_notifier);
-
        /* save address of data structure managing the driver module */
        zfcp_data.scsi_host_template.module = THIS_MODULE;
 
@@ -357,7 +352,6 @@ zfcp_module_init(void)
        goto out;
 
  out_ccw_register:
-       unregister_reboot_notifier(&zfcp_data.reboot_notifier);
        misc_deregister(&zfcp_cfdc_misc);
  out_misc_register:
 #ifdef CONFIG_S390_SUPPORT
@@ -369,23 +363,6 @@ zfcp_module_init(void)
        return retval;
 }
 
-/*
- * This function is called automatically by the kernel whenever a reboot or a 
- * shut-down is initiated and zfcp is still loaded
- *
- * locks:       zfcp_data.config_sema is taken prior to shutting down the module
- *              and removing all structures
- * returns:     NOTIFY_DONE in all cases
- */
-int
-zfcp_reboot_handler(struct notifier_block *notifier, unsigned long code,
-                   void *ptr)
-{
-       zfcp_ccw_unregister();
-       return NOTIFY_DONE;
-}
-
-
 /*
  * function:    zfcp_cfdc_dev_ioctl
  *
index 84a5e37..001d806 100644 (file)
@@ -26,7 +26,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_CCW_C_REVISION "$Revision: 1.55 $"
+#define ZFCP_CCW_C_REVISION "$Revision: 1.56 $"
 
 #include "zfcp_ext.h"
 
@@ -37,6 +37,7 @@ static void zfcp_ccw_remove(struct ccw_device *);
 static int zfcp_ccw_set_online(struct ccw_device *);
 static int zfcp_ccw_set_offline(struct ccw_device *);
 static int zfcp_ccw_notify(struct ccw_device *, int);
+static void zfcp_ccw_shutdown(struct device *);
 
 static struct ccw_device_id zfcp_ccw_device_id[] = {
        {CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE,
@@ -59,6 +60,9 @@ static struct ccw_driver zfcp_ccw_driver = {
        .set_online  = zfcp_ccw_set_online,
        .set_offline = zfcp_ccw_set_offline,
        .notify      = zfcp_ccw_notify,
+       .driver      = {
+               .shutdown = zfcp_ccw_shutdown,
+       },
 };
 
 MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id);
@@ -287,4 +291,19 @@ zfcp_ccw_unregister(void)
        ccw_driver_unregister(&zfcp_ccw_driver);
 }
 
+/**
+ * zfcp_ccw_shutdown - gets called on reboot/shutdown
+ *
+ * Makes sure that QDIO queues are down when the system gets stopped.
+ */
+static void
+zfcp_ccw_shutdown(struct device *dev)
+{
+       struct zfcp_adapter *adapter;
+
+       adapter = dev_get_drvdata(dev);
+       zfcp_erp_adapter_shutdown(adapter, 0);
+       zfcp_erp_wait(adapter);
+}
+
 #undef ZFCP_LOG_AREA
index 19fe276..dda20bf 100644 (file)
@@ -33,7 +33,7 @@
 #define ZFCP_DEF_H
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_DEF_REVISION "$Revision: 1.75 $"
+#define ZFCP_DEF_REVISION "$Revision: 1.81 $"
 
 /*************************** INCLUDES *****************************************/
 
@@ -42,6 +42,7 @@
 #include <linux/miscdevice.h>
 #include <linux/major.h>
 #include <linux/blkdev.h>
+#include <linux/delay.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_tcq.h>
 #include <scsi/scsi_cmnd.h>
@@ -55,7 +56,6 @@
 #include <asm/qdio.h>
 #include <asm/debug.h>
 #include <asm/ebcdic.h>
-#include <linux/reboot.h>
 #include <linux/mempool.h>
 #include <linux/syscalls.h>
 #include <linux/ioctl.h>
@@ -70,7 +70,7 @@
 /********************* GENERAL DEFINES *********************************/
 
 /* zfcp version number, it consists of major, minor, and patch-level number */
-#define ZFCP_VERSION           "4.0.0"
+#define ZFCP_VERSION           "4.1.3"
 
 static inline void *
 zfcp_sg_to_address(struct scatterlist *list)
@@ -1074,8 +1074,6 @@ struct zfcp_data {
                                                       lists */
        struct semaphore        config_sema;        /* serialises configuration
                                                       changes */
-       struct notifier_block   reboot_notifier;     /* used to register cleanup
-                                                       functions */
        atomic_t                loglevel;            /* current loglevel */
        char                    init_busid[BUS_ID_SIZE];
        wwn_t                   init_wwpn;
@@ -1125,32 +1123,6 @@ extern void _zfcp_hex_dump(char *, int);
                if (ZFCP_LOG_CHECK(level)) { \
                        _zfcp_hex_dump(addr, count); \
                }
-/*
- * Not yet optimal but useful:
- * Waits until the condition is met or the timeout occurs.
- * The condition may be a function call. This allows to
- * execute some additional instructions in addition
- * to a simple condition check.
- * The timeout is modified on exit and holds the remaining time.
- * Thus it is zero if a timeout ocurred, i.e. the condition was 
- * not met in the specified interval.
- */
-#define __ZFCP_WAIT_EVENT_TIMEOUT(timeout, condition) \
-do { \
-       set_current_state(TASK_UNINTERRUPTIBLE); \
-       while (!(condition) && timeout) \
-               timeout = schedule_timeout(timeout); \
-       current->state = TASK_RUNNING; \
-} while (0);
-
-#define ZFCP_WAIT_EVENT_TIMEOUT(waitqueue, timeout, condition) \
-do { \
-       wait_queue_t entry; \
-       init_waitqueue_entry(&entry, current); \
-       add_wait_queue(&waitqueue, &entry); \
-       __ZFCP_WAIT_EVENT_TIMEOUT(timeout, condition) \
-       remove_wait_queue(&waitqueue, &entry); \
-} while (0);
 
 #define zfcp_get_busid_by_adapter(adapter) (adapter->ccw_device->dev.bus_id)
 #define zfcp_get_busid_by_port(port) (zfcp_get_busid_by_adapter(port->adapter))
index a927b91..e076677 100644 (file)
@@ -31,7 +31,7 @@
 #define ZFCP_LOG_AREA                  ZFCP_LOG_AREA_ERP
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_ERP_REVISION "$Revision: 1.56 $"
+#define ZFCP_ERP_REVISION "$Revision: 1.61 $"
 
 #include "zfcp_ext.h"
 
@@ -436,8 +436,8 @@ zfcp_els_handler(unsigned long data)
        int retval = 0;
 
        if (send_els->status != 0) {
-               ZFCP_LOG_NORMAL("ELS request timed out, physical port reopen "
-                               "of port 0x%016Lx on adapter %s failed\n",
+               ZFCP_LOG_NORMAL("ELS request timed out, force physical port "
+                               "reopen of port 0x%016Lx on adapter %s\n",
                                port->wwpn, zfcp_get_busid_by_port(port));
                debug_text_event(port->adapter->erp_dbf, 3, "forcreop");
                retval = zfcp_erp_port_forced_reopen(port, 0);
@@ -2170,7 +2170,6 @@ static int
 zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
 {
        int retval;
-       unsigned long timeout;
        struct zfcp_adapter *adapter = erp_action->adapter;
 
        retval = zfcp_erp_adapter_strategy_close(erp_action);
@@ -2187,14 +2186,7 @@ zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
                ZFCP_LOG_INFO("Waiting to allow the adapter %s "
                              "to recover itself\n",
                              zfcp_get_busid_by_adapter(adapter));
-               /*
-                * SUGGESTION: substitute by
-                * timeout = ZFCP_TYPE2_RECOVERY_TIME;
-                * __ZFCP_WAIT_EVENT_TIMEOUT(timeout, 0);
-                */
-               timeout = ZFCP_TYPE2_RECOVERY_TIME;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(timeout);
+               msleep(jiffies_to_msecs(ZFCP_TYPE2_RECOVERY_TIME));
        }
 
        return retval;
@@ -2370,10 +2362,8 @@ zfcp_erp_adapter_strategy_open_qdio(struct zfcp_erp_action *erp_action)
  failed_qdio_activate:
        debug_text_event(adapter->erp_dbf, 3, "qdio_down1a");
        while (qdio_shutdown(adapter->ccw_device,
-                            QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ);
-       }
+                            QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
+               msleep(1000);
        debug_text_event(adapter->erp_dbf, 3, "qdio_down1b");
 
  failed_qdio_establish:
@@ -2419,10 +2409,8 @@ zfcp_erp_adapter_strategy_close_qdio(struct zfcp_erp_action *erp_action)
 
        debug_text_event(adapter->erp_dbf, 3, "qdio_down2a");
        while (qdio_shutdown(adapter->ccw_device,
-                            QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ);
-       }
+                            QDIO_FLAG_CLEANUP_USING_CLEAR) == -EINPROGRESS)
+               msleep(1000);
        debug_text_event(adapter->erp_dbf, 3, "qdio_down2b");
 
        /*
@@ -2533,8 +2521,7 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
                        ZFCP_LOG_DEBUG("host connection still initialising... "
                                       "waiting and retrying...\n");
                        /* sleep a little bit before retry */
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(ZFCP_EXCHANGE_CONFIG_DATA_SLEEP);
+                       msleep(jiffies_to_msecs(ZFCP_EXCHANGE_CONFIG_DATA_SLEEP));
                }
        } while ((retries--) &&
                 atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
index 67a8202..79451af 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_FSF_C_REVISION "$Revision: 1.49 $"
+#define ZFCP_FSF_C_REVISION "$Revision: 1.55 $"
 
 #include "zfcp_ext.h"
 
@@ -180,8 +180,7 @@ zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter)
                ZFCP_LOG_DEBUG("fsf req list of adapter %s not yet empty\n",
                               zfcp_get_busid_by_adapter(adapter));
                /* wait for woken intiators to clean up their requests */
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(ZFCP_FSFREQ_CLEANUP_TIMEOUT);
+               msleep(jiffies_to_msecs(ZFCP_FSFREQ_CLEANUP_TIMEOUT));
        }
 
        /* consistency check */
@@ -2620,6 +2619,7 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
 {
        int retval = 0;
        unsigned long lock_flags;
+       volatile struct qdio_buffer_element *sbale;
 
        /* setup new FSF request */
        retval = zfcp_fsf_req_create(erp_action->adapter,
@@ -2636,6 +2636,11 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
                goto out;
        }
 
+       sbale = zfcp_qdio_sbale_req(erp_action->fsf_req,
+                                   erp_action->fsf_req->sbal_curr, 0);
+       sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
+       sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
+
        /* mark port as being closed */
        atomic_set_mask(ZFCP_STATUS_PORT_PHYS_CLOSING,
                        &erp_action->port->status);
@@ -4717,14 +4722,14 @@ zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter, int req_flags,
                      unsigned long *lock_flags)
 {
         int condition;
-        unsigned long timeout = ZFCP_SBAL_TIMEOUT;
         struct zfcp_qdio_queue *req_queue = &adapter->request_queue;
 
         if (unlikely(req_flags & ZFCP_WAIT_FOR_SBAL)) {
-                ZFCP_WAIT_EVENT_TIMEOUT(adapter->request_wq, timeout,
-                                        (condition =
-                                         (zfcp_fsf_req_create_sbal_check)
-                                         (lock_flags, req_queue, 1)));
+                wait_event_interruptible_timeout(adapter->request_wq,
+                                                (condition =
+                                                 zfcp_fsf_req_create_sbal_check
+                                                 (lock_flags, req_queue, 1)),
+                                                ZFCP_SBAL_TIMEOUT);
                 if (!condition) {
                         return -EIO;
                }
@@ -4788,6 +4793,7 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
 
        if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status)) {
                write_unlock_irqrestore(&req_queue->queue_lock, *lock_flags);
+               ret = -EIO;
                goto failed_sbals;
        }
 
index e0ace93..11a27c1 100644 (file)
@@ -26,7 +26,7 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.40 $"
+#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.41 $"
 
 #include "zfcp_ext.h"
 
@@ -125,7 +125,7 @@ zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count)
        struct zfcp_unit *unit;
        fcp_lun_t fcp_lun;
        char *endp;
-       int retval = -EINVAL;
+       int retval = 0;
 
        down(&zfcp_data.config_sema);
 
@@ -136,8 +136,10 @@ zfcp_sysfs_unit_remove_store(struct device *dev, const char *buf, size_t count)
        }
 
        fcp_lun = simple_strtoull(buf, &endp, 0);
-       if ((endp + 1) < (buf + count))
+       if ((endp + 1) < (buf + count)) {
+               retval = -EINVAL;
                goto out;
+       }
 
        write_lock_irq(&zfcp_data.config_lock);
        unit = zfcp_get_unit_by_lun(port, fcp_lun);
index 3237554..ad870a3 100644 (file)
@@ -324,7 +324,7 @@ static int wd_open(struct inode *inode, struct file *f)
                wd_dev.initialized = 1;
        }
 
-       return(0);
+       return(nonseekable_open(inode, f));
 }
 
 static int wd_release(struct inode *inode, struct file *file)
@@ -419,9 +419,6 @@ static ssize_t wd_write(struct file         *file,
                return(-EINVAL);
        }
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                wd_pingtimer(pTimer);
                return 1;
index 70ae314..cd6e2d3 100644 (file)
@@ -1181,8 +1181,7 @@ static void __exit envctrl_cleanup(void)
                        if (!found)
                                break;
 
-                       current->state = TASK_INTERRUPTIBLE;
-                       schedule_timeout(HZ);
+                       msleep(1000);
                }
                kenvctrld_task = NULL;
        }
index 0e8d06e..7f8e109 100644 (file)
@@ -116,6 +116,7 @@ static void riowd_starttimer(void)
 
 static int riowd_open(struct inode *inode, struct file *filp)
 {
+       nonseekable_open(inode, filp);
        return 0;
 }
 
@@ -184,9 +185,6 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
 
 static ssize_t riowd_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
 {
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (count) {
                riowd_pingtimer();
                return 1;
index 925061c..c095308 100644 (file)
@@ -121,7 +121,6 @@ void __init dvma_init(struct sbus_bus *sbus)
 void __init sun4_dvma_init(void)
 {
        struct sbus_dma *dma;
-       struct sbus_dma *dchain;
        struct resource r;
 
        if(sun4_dma_physaddr) {
index 1b5938f..1495f0f 100644 (file)
@@ -1527,7 +1527,7 @@ NCR_700_intr(int irq, void *dev_id, struct pt_regs *regs)
 
                        /* clear all the negotiated parameters */
                        __shost_for_each_device(SDp, host)
-                               SDp->hostdata = 0;
+                               SDp->hostdata = NULL;
                        
                        /* clear all the slots and their pending commands */
                        for(i = 0; i < NCR_700_COMMAND_SLOTS_PER_HOST; i++) {
index b69f1e4..7118659 100644 (file)
@@ -491,7 +491,7 @@ config SCSI_SATA_VITESSE
 
 config SCSI_BUSLOGIC
        tristate "BusLogic SCSI support"
-       depends on (PCI || ISA || MCA) && SCSI
+       depends on (PCI || ISA || MCA) && SCSI && (BROKEN || !SPARC64)
        ---help---
          This is support for BusLogic MultiMaster and FlashPoint SCSI Host
          Adapters. Consult the SCSI-HOWTO, available from
@@ -547,7 +547,7 @@ config SCSI_DTC3280
 
 config SCSI_EATA
        tristate "EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards) support"
-       depends on (ISA || EISA || PCI) && SCSI
+       depends on (ISA || EISA || PCI) && SCSI && (BROKEN || !SPARC64)
        ---help---
          This driver supports all EATA/DMA-compliant SCSI host adapters.  DPT
          ISA and all EISA I/O addresses are probed looking for the "EATA"
@@ -641,7 +641,7 @@ config SCSI_FD_MCS
 
 config SCSI_GDTH
        tristate "Intel/ICP (former GDT SCSI Disk Array) RAID Controller support"
-       depends on (ISA || EISA || PCI) && SCSI
+       depends on (ISA || EISA || PCI) && SCSI && (BROKEN || !SPARC64)
        ---help---
          Formerly called GDT SCSI Disk Array Controller Support.
 
index 2592b6f..8b077f2 100644 (file)
@@ -1313,7 +1313,7 @@ extern struct aac_common aac_config;
  *     only used for debugging.
  */
  
-#if DBG
+#ifdef DBG
 #define        FIB_COUNTER_INCREMENT(counter)          (counter)++
 #else
 #define        FIB_COUNTER_INCREMENT(counter)          
index 66e3ffe..d11f869 100644 (file)
@@ -422,7 +422,7 @@ MODULE_DEVICE_TABLE(isapnp, id_table);
 #endif /* !PCMCIA */
 
 static int registered_count=0;
-static struct Scsi_Host *aha152x_host[2] = {0, 0};
+static struct Scsi_Host *aha152x_host[2];
 static Scsi_Host_Template aha152x_driver_template;
 
 /*
@@ -647,20 +647,20 @@ static struct {
        void            (*end)(struct Scsi_Host *);
        int             spio;
 } states[] = {
-       { "idle",       0,              0,              0,              0},
-       { "unknown",    0,              0,              0,              0},
-       { "seldo",      0,              seldo_run,      0,              0},
-       { "seldi",      0,              seldi_run,      0,              0},
-       { "selto",      0,              selto_run,      0,              0},
-       { "busfree",    0,              busfree_run,    0,              0},
+       { "idle",       NULL,           NULL,           NULL,           0},
+       { "unknown",    NULL,           NULL,           NULL,           0},
+       { "seldo",      NULL,           seldo_run,      NULL,           0},
+       { "seldi",      NULL,           seldi_run,      NULL,           0},
+       { "selto",      NULL,           selto_run,      NULL,           0},
+       { "busfree",    NULL,           busfree_run,    NULL,           0},
        { "msgo",       msgo_init,      msgo_run,       msgo_end,       1},
        { "cmd",        cmd_init,       cmd_run,        cmd_end,        1},
-       { "msgi",       0,              msgi_run,       msgi_end,       1},
-       { "status",     0,              status_run,     0,              1},
+       { "msgi",       NULL,           msgi_run,       msgi_end,       1},
+       { "status",     NULL,           status_run,     NULL,           1},
        { "datai",      datai_init,     datai_run,      datai_end,      0},
        { "datao",      datao_init,     datao_run,      datao_end,      0},
-       { "parerr",     0,              parerr_run,     0,              0},
-       { "rsti",       0,              rsti_run,       0,              0},
+       { "parerr",     NULL,           parerr_run,     NULL,           0},
+       { "rsti",       NULL,           rsti_run,       NULL,           0},
 };
 
 /* setup & interrupt */
@@ -756,7 +756,7 @@ static inline struct Scsi_Host *lookup_irq(int irqno)
                if(aha152x_host[i] && aha152x_host[i]->irq==irqno)
                        return aha152x_host[i];
 
-       return 0;
+       return NULL;
 }
 
 static irqreturn_t swintr(int irqno, void *dev_id, struct pt_regs *regs)
@@ -892,7 +892,7 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
                goto out_host_put;
        }
 
-       if( scsi_add_host(shpnt, 0) ) {
+       if( scsi_add_host(shpnt, NULL) ) {
                free_irq(shpnt->irq, shpnt);
                printk(KERN_ERR "aha152x%d: failed to add host.\n", shpnt->host_no);
                goto out_host_put;
@@ -905,10 +905,10 @@ struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *setup)
        return shpnt;
 
 out_host_put:
-       aha152x_host[registered_count]=0;
+       aha152x_host[registered_count]=NULL;
        scsi_host_put(shpnt);
 
-       return 0;
+       return NULL;
 }
 
 void aha152x_release(struct Scsi_Host *shpnt)
@@ -1011,7 +1011,7 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct semaphore *sem, int p
                }
        }
 
-       SCNEXT(SCpnt)           = 0;
+       SCNEXT(SCpnt)           = NULL;
        SCSEM(SCpnt)            = sem;
 
        /* setup scratch area
@@ -1068,7 +1068,7 @@ static int aha152x_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
        }
 #endif
 
-       return aha152x_internal_queue(SCpnt, 0, 0, done);
+       return aha152x_internal_queue(SCpnt, NULL, 0, done);
 }
 
 
@@ -1119,7 +1119,7 @@ static int aha152x_abort(Scsi_Cmnd *SCpnt)
                DO_UNLOCK(flags);
 
                kfree(SCpnt->host_scribble);
-               SCpnt->host_scribble=0;
+               SCpnt->host_scribble=NULL;
 
                return SUCCESS;
        } 
@@ -1184,7 +1184,7 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
 
        SCpnt->cmd_len         = 0;
        SCpnt->use_sg          = 0;
-       SCpnt->request_buffer  = 0;
+       SCpnt->request_buffer  = NULL;
        SCpnt->request_bufflen = 0;
 
        init_timer(&timer);
@@ -1209,7 +1209,7 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
                if (!HOSTDATA(shpnt)->commands)
                        SETPORT(PORTA, 0);
                kfree(SCpnt->host_scribble);
-               SCpnt->host_scribble=0;
+               SCpnt->host_scribble=NULL;
 
                ret = SUCCESS;
        } else {
@@ -1241,7 +1241,7 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
                        next = SCNEXT(ptr);
                } else {
                        printk(DEBUG_LEAD "queue corrupted at %p\n", CMDINFO(ptr), ptr);
-                       next = 0;
+                       next = NULL;
                }
 
                if (!ptr->device->soft_reset) {
@@ -1249,7 +1249,7 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
                        remove_SC(SCs, ptr);
                        HOSTDATA(shpnt)->commands--;
                        kfree(ptr->host_scribble);
-                       ptr->host_scribble=0;
+                       ptr->host_scribble=NULL;
                }
 
                ptr = next;
@@ -1386,7 +1386,7 @@ static int aha152x_biosparam(struct scsi_device *sdev, struct block_device *bdev
                                       "aha152x: unable to verify geometry for disk with >1GB.\n"
                                       "         Using default translation. Please verify yourself.\n"
                                       "         Perhaps you need to enable extended translation in the driver.\n"
-                                      "         See /usr/src/linux/Documentation/scsi/aha152x.txt for details.\n");
+                                      "         See Documentation/scsi/aha152x.txt for details.\n");
                        }
                } else {
                        info_array[0] = info[0];
@@ -1415,7 +1415,7 @@ static void done(struct Scsi_Host *shpnt, int error)
                        printk(ERR_LEAD "there's already a completed command %p - will cause abort\n", CMDINFO(CURRENT_SC), DONE_SC);
 
                DONE_SC = CURRENT_SC;
-               CURRENT_SC = 0;
+               CURRENT_SC = NULL;
                DONE_SC->result = error;
        } else
                printk(KERN_ERR "aha152x: done() called outside of command\n");
@@ -1538,7 +1538,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 #endif
                        append_SC(&DISCONNECTED_SC, CURRENT_SC);
                        CURRENT_SC->SCp.phase |= 1 << 16;
-                       CURRENT_SC = 0;
+                       CURRENT_SC = NULL;
 
                } else {
                        done(shpnt, DID_ERROR << 16);
@@ -1586,7 +1586,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 
                        if(!(DONE_SC->SCp.Status & not_issued)) {
                                Scsi_Cmnd *ptr = DONE_SC;
-                               DONE_SC=0;
+                               DONE_SC=NULL;
 #if 0
                                DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));
 #endif
@@ -1603,7 +1603,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                                ptr->request_bufflen = sizeof(ptr->sense_buffer);
                        
                                DO_UNLOCK(flags);
-                               aha152x_internal_queue(ptr, 0, check_condition, ptr->scsi_done);
+                               aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);
                                DO_LOCK(flags);
 #if 0
                        } else {
@@ -1619,7 +1619,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                        int lun=DONE_SC->device->lun & 0x7;
 #endif
                        Scsi_Cmnd *ptr = DONE_SC;
-                       DONE_SC=0;
+                       DONE_SC=NULL;
 
                        /* turn led off, when no commands are in the driver */
                        HOSTDATA(shpnt)->commands--;
@@ -1628,7 +1628,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
 
                        if(ptr->scsi_done != reset_done) {
                                kfree(ptr->host_scribble);
-                               ptr->host_scribble=0;
+                               ptr->host_scribble=NULL;
                        }
 
                        DO_UNLOCK(flags);
@@ -1638,7 +1638,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                        DO_LOCK(flags);
                }
 
-               DONE_SC=0;
+               DONE_SC=NULL;
 #if defined(AHA152X_STAT)
        } else {
                HOSTDATA(shpnt)->busfree_without_done_command++;
@@ -1780,7 +1780,7 @@ static void seldi_run(struct Scsi_Host *shpnt)
                append_SC(&ISSUE_SC, CURRENT_SC);
                DO_UNLOCK(flags);
 
-               CURRENT_SC = 0;
+               CURRENT_SC = NULL;
        }
 
        if(!DISCONNECTED_SC) {
@@ -2503,7 +2503,7 @@ static void rsti_run(struct Scsi_Host *shpnt)
                        remove_SC(&DISCONNECTED_SC, ptr);
 
                        kfree(ptr->host_scribble);
-                       ptr->host_scribble=0;
+                       ptr->host_scribble=NULL;
 
                        ptr->result =  DID_RESET << 16;
                        ptr->scsi_done(ptr);
@@ -2976,7 +2976,7 @@ static void show_queues(struct Scsi_Host *shpnt)
                printk(KERN_DEBUG "none\n");
 
        printk(KERN_DEBUG "disconnected_SC:\n");
-       for (ptr = DISCONNECTED_SC; ptr; ptr = SCDATA(ptr) ? SCNEXT(ptr) : 0)
+       for (ptr = DISCONNECTED_SC; ptr; ptr = SCDATA(ptr) ? SCNEXT(ptr) : NULL)
                show_command(ptr);
 
        disp_ports(shpnt);
@@ -3454,7 +3454,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
 
        if(thislength<0) {
                DPRINTK(debug_procinfo, KERN_DEBUG "aha152x_proc_info: output too short\n");
-               *start = 0;
+               *start = NULL;
                return 0;
        }
 
@@ -3638,7 +3638,7 @@ static int __init aha152x_init(void)
        aha152x_config conf;
 #endif
 #ifdef __ISAPNP__
-       struct pnp_dev *dev=0, *pnpdev[2] = {0, 0};
+       struct pnp_dev *dev=NULL, *pnpdev[2] = {NULL, NULL};
 #endif
 
        if ( setup_count ) {
@@ -3901,7 +3901,7 @@ static int __init aha152x_init(void)
 #if defined(__ISAPNP__)
                        } else if( pnpdev[i] ) {
                                HOSTDATA(shpnt)->pnpdev=pnpdev[i];
-                               pnpdev[i]=0;
+                               pnpdev[i]=NULL;
 #endif
                        }
                } else {
@@ -3923,7 +3923,7 @@ static void __exit aha152x_exit(void)
 
        for(i=0; i<ARRAY_SIZE(setup); i++) {
                aha152x_release(aha152x_host[i]);
-               aha152x_host[i]=0;
+               aha152x_host[i]=NULL;
        }
 }
 
index ba86965..4c5e9c3 100644 (file)
@@ -545,7 +545,7 @@ static void aha1542_intr_handle(struct Scsi_Host *shost, void *dev_id, struct pt
                my_done = SCtmp->scsi_done;
                if (SCtmp->host_scribble) {
                        kfree(SCtmp->host_scribble);
-                       SCtmp->host_scribble = 0;
+                       SCtmp->host_scribble = NULL;
                }
                /* Fetch the sense data, and tuck it away, in the required slot.  The
                   Adaptec automatically fetches it, and there is no guarantee that
index def8067..3d61496 100644 (file)
@@ -4881,7 +4881,7 @@ aic7xxx_handle_seqint(struct aic7xxx_host *p, unsigned char intstat)
     }
     break;
 
-#if AIC7XXX_NOT_YET 
+#ifdef AIC7XXX_NOT_YET 
     case TRACEPOINT2:
       {
         printk(INFO_LEAD "Tracepoint #2 reached.\n", p->host_no,
@@ -9335,7 +9335,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
                 printk(KERN_INFO "aic7xxx: MMAPed I/O failed, reverting to "
                                  "Programmed I/O.\n");
                 iounmap((void *) (((unsigned long) temp_p->maddr) & PAGE_MASK));
-                temp_p->maddr = 0;
+                temp_p->maddr = NULL;
                 if(temp_p->base == 0)
                 {
                   printk("aic7xxx: <%s> at PCI %d/%d/%d\n", 
@@ -9743,7 +9743,7 @@ skip_pci_controller:
     temp_p->pause = hcntrl | PAUSE | INTEN;
     temp_p->base = base;
     temp_p->mbase = 0;
-    temp_p->maddr = 0;
+    temp_p->maddr = NULL;
     temp_p->pci_bus = 0;
     temp_p->pci_device_fn = slot;
     aic_outb(temp_p, hcntrl | PAUSE, HCNTRL);
index ae2ac0a..77cf39f 100644 (file)
@@ -1643,13 +1643,13 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
        u32 reply_size = 0;
        u32 __user *user_msg = arg;
        u32 __user * user_reply = NULL;
-       ulong sg_list[pHba->sg_tablesize];
+       void *sg_list[pHba->sg_tablesize];
        u32 sg_offset = 0;
        u32 sg_count = 0;
        int sg_index = 0;
        u32 i = 0;
        u32 rcode = 0;
-       ulong p = 0;
+       void *p = NULL;
        ulong flags = 0;
 
        memset(&msg, 0, MAX_MESSAGE_SIZE*4);
@@ -1705,8 +1705,8 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
                        }
                        sg_size = sg[i].flag_count & 0xffffff;      
                        /* Allocate memory for the transfer */
-                       p = (ulong)kmalloc(sg_size, GFP_KERNEL|ADDR32);
-                       if(p == 0) {
+                       p = kmalloc(sg_size, GFP_KERNEL|ADDR32);
+                       if(!p) {
                                printk(KERN_DEBUG"%s: Could not allocate SG buffer - size = %d buffer number %d of %d\n",
                                                pHba->name,sg_size,i,sg_count);
                                rcode = -ENOMEM;
@@ -1716,14 +1716,14 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
                        /* Copy in the user's SG buffer if necessary */
                        if(sg[i].flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR*/) {
                                // TODO 64bit fix
-                               if (copy_from_user((void*)p,(void*)sg[i].addr_bus, sg_size)) {
+                               if (copy_from_user(p,(void __user *)sg[i].addr_bus, sg_size)) {
                                        printk(KERN_DEBUG"%s: Could not copy SG buf %d FROM user\n",pHba->name,i);
                                        rcode = -EFAULT;
                                        goto cleanup;
                                }
                        }
                        //TODO 64bit fix
-                       sg[i].addr_bus = (u32)virt_to_bus((void*)p);
+                       sg[i].addr_bus = (u32)virt_to_bus(p);
                }
        }
 
@@ -1778,8 +1778,8 @@ static int adpt_i2o_passthru(adpt_hba* pHba, u32 __user *arg)
                        if(! (sg[j].flag_count & 0x4000000 /*I2O_SGL_FLAGS_DIR*/)) {
                                sg_size = sg[j].flag_count & 0xffffff; 
                                // TODO 64bit fix
-                               if (copy_to_user((void*)sg[j].addr_bus,(void*)sg_list[j], sg_size)) {
-                                       printk(KERN_WARNING"%s: Could not copy %lx TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus);
+                               if (copy_to_user((void __user *)sg[j].addr_bus,sg_list[j], sg_size)) {
+                                       printk(KERN_WARNING"%s: Could not copy %p TO user %x\n",pHba->name, sg_list[j], sg[j].addr_bus);
                                        rcode = -EFAULT;
                                        goto cleanup;
                                }
@@ -1807,7 +1807,7 @@ cleanup:
        while(sg_index) {
                if(sg_list[--sg_index]) {
                        if (rcode != -ETIME && rcode != -EINTR)
-                               kfree((void*)(sg_list[sg_index]));
+                               kfree(sg_list[sg_index]);
                }
        }
        return rcode;
index 3c5151c..e2c07fc 100644 (file)
@@ -840,7 +840,7 @@ static void find_pio_EISA(struct get_conf *buf)
        u32 base;
        int i;
 
-#if CHECKPAL
+#ifdef CHECKPAL
        u8 pal1, pal2, pal3;
 #endif
 
@@ -848,7 +848,7 @@ static void find_pio_EISA(struct get_conf *buf)
                if (EISAbases[i]) {     /* Still a possibility ?          */
 
                        base = 0x1c88 + (i * 0x1000);
-#if CHECKPAL
+#ifdef CHECKPAL
                        pal1 = inb((u16) base - 8);
                        pal2 = inb((u16) base - 7);
                        pal3 = inb((u16) base - 6);
@@ -868,7 +868,7 @@ static void find_pio_EISA(struct get_conf *buf)
                                }
                                /* Nothing found here so we take it from the list */
                                EISAbases[i] = 0;
-#if CHECKPAL
+#ifdef CHECKPAL
                        }
 #endif
                }
@@ -929,7 +929,7 @@ static void find_pio_PCI(struct get_conf *buf)
                                        EISAbases[x] = 0;
                                }
                        }
-#if CHECK_BLINK
+#ifdef CHECK_BLINK
                        else if (check_blink_state(base)) {
                                printk("eata_pio: HBA is in BLINK state.\n" "Consult your HBAs manual to correct this.\n");
                        }
index 356919f..ae47612 100644 (file)
@@ -85,7 +85,6 @@ struct fastlane_dma_registers {
 
 static int  dma_bytes_sent(struct NCR_ESP *esp, int fifo_count);
 static int  dma_can_transfer(struct NCR_ESP *esp, Scsi_Cmnd *sp);
-static inline void dma_clear(struct NCR_ESP *esp);
 static void dma_dump_state(struct NCR_ESP *esp);
 static void dma_init_read(struct NCR_ESP *esp, __u32 addr, int length);
 static void dma_init_write(struct NCR_ESP *esp, __u32 vaddr, int length);
@@ -110,6 +109,21 @@ static volatile unsigned char cmd_buffer[16];
                                 * via PIO.
                                 */
 
+static inline void dma_clear(struct NCR_ESP *esp)
+{
+       struct fastlane_dma_registers *dregs =
+               (struct fastlane_dma_registers *) (esp->dregs);
+       unsigned long *t;
+
+       ctrl_data = (ctrl_data & FASTLANE_DMA_MASK);
+       dregs->ctrl_reg = ctrl_data;
+
+       t = (unsigned long *)(esp->edev);
+
+       dregs->clear_strobe = 0;
+       *t = 0 ;
+}
+
 /***************************************************************** Detection */
 int __init fastlane_esp_detect(Scsi_Host_Template *tpnt)
 {
@@ -297,21 +311,6 @@ static void dma_init_write(struct NCR_ESP *esp, __u32 addr, int length)
        dregs->ctrl_reg = ctrl_data;
 }
 
-static inline void dma_clear(struct NCR_ESP *esp)
-{
-       struct fastlane_dma_registers *dregs = 
-               (struct fastlane_dma_registers *) (esp->dregs);
-       unsigned long *t;
-
-       ctrl_data = (ctrl_data & FASTLANE_DMA_MASK);
-       dregs->ctrl_reg = ctrl_data;
-
-       t = (unsigned long *)(esp->edev);
-
-       dregs->clear_strobe = 0;
-       *t = 0 ;
-}
-
 
 static void dma_ints_off(struct NCR_ESP *esp)
 {
index 3b749dd..6529f0c 100644 (file)
@@ -681,6 +681,7 @@ static int fdomain_get_irq( int base )
 
 static int fdomain_isa_detect( int *irq, int *iobase )
 {
+#ifndef PCMCIA
    int i, j;
    int base = 0xdeadbeef;
    int flag = 0;
@@ -786,6 +787,9 @@ static int fdomain_isa_detect( int *irq, int *iobase )
    *iobase = base;
 
    return 1;                   /* success */
+#else
+   return 0;
+#endif
 }
 
 /* PCI detection function: int fdomain_pci_bios_detect(int* irq, int*
index 02055ff..bcf97ec 100644 (file)
@@ -355,7 +355,7 @@ int __init generic_NCR5380_detect(Scsi_Host_Template * tpnt)
                if (!(overrides[current_override].NCR5380_map_name))
                        continue;
 
-               ports = 0;
+               ports = NULL;
                switch (overrides[current_override].board) {
                case BOARD_NCR5380:
                        flags = FLAG_NO_PSEUDO_DMA;
index 811c66d..2d05c14 100644 (file)
@@ -717,10 +717,16 @@ static ide_driver_t idescsi_driver = {
        .drives                 = LIST_HEAD_INIT(idescsi_driver.drives),
 };
 
+static int ide_scsi_warned;
+
 static int idescsi_ide_open(struct inode *inode, struct file *filp)
 {
        ide_drive_t *drive = inode->i_bdev->bd_disk->private_data;
        drive->usage++;
+       if (!ide_scsi_warned++) {
+               printk(KERN_WARNING "ide-scsi: Warning this device driver is only intended for specialist devices.\n");
+               printk(KERN_WARNING "ide-scsi: Do not use for cd burning, use /dev/hdX directly instead.\n");
+       }
        return 0;
 }
 
@@ -735,7 +741,7 @@ static int idescsi_ide_ioctl(struct inode *inode, struct file *file,
                        unsigned int cmd, unsigned long arg)
 {
        struct block_device *bdev = inode->i_bdev;
-       return generic_ide_ioctl(bdev, cmd, arg);
+       return generic_ide_ioctl(file, bdev, cmd, arg);
 }
 
 static struct block_device_operations idescsi_ops = {
index 1bf4218..915d593 100644 (file)
@@ -1118,6 +1118,12 @@ static int device_check(imm_struct *dev)
        return -ENODEV;
 }
 
+static int imm_adjust_queue(struct scsi_device *device)
+{
+       blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
+       return 0;
+}
+
 static struct scsi_host_template imm_template = {
        .module                 = THIS_MODULE,
        .proc_name              = "imm",
@@ -1133,6 +1139,7 @@ static struct scsi_host_template imm_template = {
        .cmd_per_lun            = 1,
        .use_clustering         = ENABLE_CLUSTERING,
        .can_queue              = 1,
+       .slave_alloc            = imm_adjust_queue,
 };
 
 /***************************************************************************
index 46d18e3..2597da1 100644 (file)
 static char *setup_args[] = { "", "", "", "", "", "", "", "", "" };
 
 /* filled in by 'insmod' */
-static char *setup_strings = 0;
+static char *setup_strings;
 
-#ifdef MODULE_PARM
 MODULE_PARM(setup_strings, "s");
-#endif
 
 static inline uchar read_3393(struct IN2000_hostdata *hostdata, uchar reg_num)
 {
@@ -470,7 +468,7 @@ static void in2000_execute(struct Scsi_Host *instance)
         */
 
        cmd = (Scsi_Cmnd *) hostdata->input_Q;
-       prev = 0;
+       prev = NULL;
        while (cmd) {
                if (!(hostdata->busy[cmd->device->id] & (1 << cmd->device->lun)))
                        break;
@@ -1704,7 +1702,7 @@ static int in2000_abort(Scsi_Cmnd * cmd)
  */
 
        tmp = (Scsi_Cmnd *) hostdata->input_Q;
-       prev = 0;
+       prev = NULL;
        while (tmp) {
                if (tmp == cmd) {
                        if (prev)
@@ -1925,7 +1923,7 @@ static int __init in2000_detect(Scsi_Host_Template * tpnt)
  */
 
        if (!done_setup && setup_strings)
-               in2000_setup(setup_strings, 0);
+               in2000_setup(setup_strings, NULL);
 
        detect_count = 0;
        for (bios = 0; bios_tab[bios]; bios++) {
index 15d0654..7f2d11d 100644 (file)
@@ -2578,6 +2578,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
 
        case ATA_PROT_DMA:
        case ATA_PROT_ATAPI_DMA:
+       case ATA_PROT_ATAPI:
                /* check status of DMA engine */
                host_stat = ata_bmdma_status(ap);
                VPRINTK("BUS_DMA (host_stat 0x%X)\n", host_stat);
@@ -3251,10 +3252,10 @@ void ata_pci_remove_one (struct pci_dev *pdev)
        }
 
        free_irq(host_set->irq, host_set);
-       if (host_set->mmio_base)
-               iounmap(host_set->mmio_base);
        if (host_set->ops->host_stop)
                host_set->ops->host_stop(host_set);
+       if (host_set->mmio_base)
+               iounmap(host_set->mmio_base);
 
        for (i = 0; i < host_set->n_ports; i++) {
                ap = host_set->ports[i];
index 0f814ca..3fcefa3 100644 (file)
@@ -4520,7 +4520,7 @@ void ncr_complete (struct ncb *np, struct ccb *cp)
        */
 
        if (cp == tp->nego_cp)
-               tp->nego_cp = 0;
+               tp->nego_cp = NULL;
 
        /*
        **      If auto-sense performed, change scsi status.
@@ -4538,7 +4538,7 @@ void ncr_complete (struct ncb *np, struct ccb *cp)
                if (cp == lp->held_ccb) {
                        xpt_que_splice(&lp->skip_ccbq, &lp->wait_ccbq);
                        xpt_que_init(&lp->skip_ccbq);
-                       lp->held_ccb = 0;
+                       lp->held_ccb = NULL;
                }
        }
 
@@ -5646,7 +5646,7 @@ static void ncr_log_hard_error(struct ncb *np, u16 sist, u_char dstat)
        } else {
                script_ofs      = dsp;
                script_size     = 0;
-               script_base     = 0;
+               script_base     = NULL;
                script_name     = "mem";
        }
 
@@ -6125,7 +6125,7 @@ static void ncr_int_ma (struct ncb *np)
        if (!(cmd & 6)) {
                cp = np->header.cp;
                if (CCB_PHYS(cp, phys) != dsa)
-                       cp = 0;
+                       cp = NULL;
        } else {
                cp  = np->ccb;
                while (cp && (CCB_PHYS (cp, phys) != dsa))
@@ -6136,7 +6136,7 @@ static void ncr_int_ma (struct ncb *np)
        **      try to find the interrupted script command,
        **      and the address at which to continue.
        */
-       vdsp    = 0;
+       vdsp    = NULL;
        nxtdsp  = 0;
        if      (dsp >  np->p_script &&
                 dsp <= np->p_script + sizeof(struct script)) {
@@ -6533,7 +6533,7 @@ void ncr_int_sir (struct ncb *np)
        u_char scntl3;
        u_char chg, ofs, per, fak, wide;
        u_char num = INB (nc_dsps);
-       struct ccb *cp=0;
+       struct ccb *cp=NULL;
        u_long  dsa    = INL (nc_dsa);
        u_char  target = INB (nc_sdid) & 0x0f;
        struct tcb *tp     = &np->target[target];
@@ -7046,7 +7046,7 @@ static    struct ccb *ncr_get_ccb (struct ncb *np, u_char tn, u_char ln)
                        if (cp->magic) {
                                PRINT_LUN(np, tn, ln);
                                printk ("ccb free list corrupted (@%p)\n", cp);
-                               cp = 0;
+                               cp = NULL;
                        }
                        else {
                                xpt_insque_tail(qp, &lp->wait_ccbq);
@@ -7232,7 +7232,7 @@ static void ncr_alloc_ccb(struct ncb *np, u_char tn, u_char ln)
 {
        struct tcb *tp = &np->target[tn];
        struct lcb *lp = tp->lp[ln];
-       struct ccb *cp = 0;
+       struct ccb *cp = NULL;
 
        /*
        **      Allocate memory for this CCB.
@@ -8095,7 +8095,7 @@ irqreturn_t ncr53c8xx_intr(int irq, void *dev_id, struct pt_regs * regs)
      NCR_LOCK_NCB(np, flags);
      ncr_exception(np);
      done_list     = np->done_list;
-     np->done_list = 0;
+     np->done_list = NULL;
      NCR_UNLOCK_NCB(np, flags);
 
      if (DEBUG_FLAGS & DEBUG_TINY) printk ("]\n");
@@ -8121,7 +8121,7 @@ static void ncr53c8xx_timeout(unsigned long npref)
      NCR_LOCK_NCB(np, flags);
      ncr_timeout(np);
      done_list     = np->done_list;
-     np->done_list = 0;
+     np->done_list = NULL;
      NCR_UNLOCK_NCB(np, flags);
 
      if (done_list) {
@@ -8154,7 +8154,7 @@ int ncr53c8xx_bus_reset(struct scsi_cmnd *cmd)
        sts = ncr_reset_bus(np, cmd, 1);
 
        done_list     = np->done_list;
-       np->done_list = 0;
+       np->done_list = NULL;
        NCR_UNLOCK_NCB(np, flags);
 
        ncr_flush_done_cmds(done_list);
@@ -8195,7 +8195,7 @@ int ncr53c8xx_abort(struct scsi_cmnd *cmd)
        sts = ncr_abort_command(np, cmd);
 out:
        done_list     = np->done_list;
-       np->done_list = 0;
+       np->done_list = NULL;
        NCR_UNLOCK_NCB(np, flags);
 
        ncr_flush_done_cmds(done_list);
@@ -8226,7 +8226,7 @@ static void insert_into_waiting_list(struct ncb *np, struct scsi_cmnd *cmd)
 #ifdef DEBUG_WAITING_LIST
        printk("%s: cmd %lx inserted into waiting list\n", ncr_name(np), (u_long) cmd);
 #endif
-       cmd->next_wcmd = 0;
+       cmd->next_wcmd = NULL;
        if (!(wcmd = np->waiting_list)) np->waiting_list = cmd;
        else {
                while ((wcmd->next_wcmd) != 0)
@@ -8243,7 +8243,7 @@ static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *n
                if (cmd == *pcmd) {
                        if (to_remove) {
                                *pcmd = (struct scsi_cmnd *) cmd->next_wcmd;
-                               cmd->next_wcmd = 0;
+                               cmd->next_wcmd = NULL;
                        }
 #ifdef DEBUG_WAITING_LIST
        printk("%s: cmd %lx retrieved from waiting list\n", ncr_name(np), (u_long) cmd);
@@ -8252,7 +8252,7 @@ static struct scsi_cmnd *retrieve_from_waiting_list(int to_remove, struct ncb *n
                }
                pcmd = (struct scsi_cmnd **) &(*pcmd)->next_wcmd;
        }
-       return 0;
+       return NULL;
 }
 
 static void process_waiting_list(struct ncb *np, int sts)
@@ -8260,14 +8260,14 @@ static void process_waiting_list(struct ncb *np, int sts)
        struct scsi_cmnd *waiting_list, *wcmd;
 
        waiting_list = np->waiting_list;
-       np->waiting_list = 0;
+       np->waiting_list = NULL;
 
 #ifdef DEBUG_WAITING_LIST
        if (waiting_list) printk("%s: waiting_list=%lx processing sts=%d\n", ncr_name(np), (u_long) waiting_list, sts);
 #endif
        while ((wcmd = waiting_list) != 0) {
                waiting_list = (struct scsi_cmnd *) wcmd->next_wcmd;
-               wcmd->next_wcmd = 0;
+               wcmd->next_wcmd = NULL;
                if (sts == DID_OK) {
 #ifdef DEBUG_WAITING_LIST
        printk("%s: cmd %lx trying to requeue\n", ncr_name(np), (u_long) wcmd);
@@ -8535,7 +8535,7 @@ static int ncr53c8xx_proc_info(struct Scsi_Host *host, char *buffer, char **star
                        int length, int func)
 {
        struct host_data *host_data;
-       struct ncb *ncb = 0;
+       struct ncb *ncb = NULL;
        int retv;
 
 #ifdef DEBUG_PROC_INFO
@@ -8579,7 +8579,7 @@ printk("ncr53c8xx_proc_info: hostno=%d, func=%d\n", host->host_no, func);
 **==========================================================
 */
 #ifdef MODULE
-char *ncr53c8xx = 0;   /* command line passed by insmod */
+char *ncr53c8xx;       /* command line passed by insmod */
 MODULE_PARM(ncr53c8xx, "s");
 #endif
 
@@ -8617,8 +8617,8 @@ struct Scsi_Host * __init ncr_attach(struct scsi_host_template *tpnt,
                                        int unit, struct ncr_device *device)
 {
        struct host_data *host_data;
-       struct ncb *np = 0;
-       struct Scsi_Host *instance = 0;
+       struct ncb *np = NULL;
+       struct Scsi_Host *instance = NULL;
        u_long flags = 0;
        int i;
 
index bbbdec2..b43feb9 100644 (file)
@@ -1604,7 +1604,7 @@ static int nsp32_proc_info(
        thislength = pos - (buffer + offset);
 
        if(thislength < 0) {
-               *start = 0;
+               *start = NULL;
                 return 0;
         }
 
index 9d0cab9..fb74a2f 100644 (file)
@@ -3185,12 +3185,6 @@ static ssize_t osst_write(struct file * filp, const char __user * buf, size_t co
                goto out;
        }
        
-       if (ppos != &filp->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               retval = (-ENXIO);
-               goto out;
-       }
-
        if (STp->ready != ST_READY) {
                if (STp->ready == ST_NO_TAPE)
                        retval = (-ENOMEDIUM);
@@ -3512,12 +3506,6 @@ static ssize_t osst_read(struct file * filp, char __user * buf, size_t count, lo
                goto out;
        }
        
-       if (ppos != &filp->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               retval = (-ENXIO);
-               goto out;
-       }
-
        if (STp->ready != ST_READY) {
                if (STp->ready == ST_NO_TAPE)
                        retval = (-ENOMEDIUM);
@@ -4254,6 +4242,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp)
        int            dev  = TAPE_NR(inode);
        int            mode = TAPE_MODE(inode);
 
+       nonseekable_open(inode, filp);
        write_lock(&os_scsi_tapes_lock);
        if (dev >= osst_max_dev || os_scsi_tapes == NULL ||
            (STp = os_scsi_tapes[dev]) == NULL || !STp->device) {
index ae98131..917a208 100644 (file)
@@ -3667,7 +3667,7 @@ static request_t *
 qla1280_req_pkt(struct scsi_qla_host *ha)
 {
        struct device_reg *reg = ha->iobase;
-       request_t *pkt = 0;
+       request_t *pkt = NULL;
        int cnt;
        uint32_t timer;
 
@@ -3774,7 +3774,7 @@ qla1280_isr(struct scsi_qla_host *ha, struct list_head *done_q)
 {
        struct device_reg *reg = ha->iobase;
        struct response *pkt;
-       struct srb *sp = 0;
+       struct srb *sp = NULL;
        uint16_t mailbox[MAILBOX_REGISTER_COUNT];
        uint16_t *wptr;
        uint32_t index;
@@ -3832,11 +3832,11 @@ qla1280_isr(struct scsi_qla_host *ha, struct list_head *done_q)
                                if (index < MAX_OUTSTANDING_COMMANDS)
                                        sp = ha->outstanding_cmds[index];
                                else
-                                       sp = 0;
+                                       sp = NULL;
 
                                if (sp) {
                                        /* Free outstanding command slot. */
-                                       ha->outstanding_cmds[index] = 0;
+                                       ha->outstanding_cmds[index] = NULL;
 
                                        /* Save ISP completion status */
                                        CMD_RESULT(sp->cmd) = 0;
@@ -4095,7 +4095,7 @@ qla1280_status_entry(struct scsi_qla_host *ha, struct response *pkt,
        }
 
        /* Free outstanding command slot. */
-       ha->outstanding_cmds[handle] = 0;
+       ha->outstanding_cmds[handle] = NULL;
 
        cmd = sp->cmd;
 
@@ -4188,11 +4188,11 @@ qla1280_error_entry(struct scsi_qla_host *ha, struct response *pkt,
        if (handle < MAX_OUTSTANDING_COMMANDS)
                sp = ha->outstanding_cmds[handle];
        else
-               sp = 0;
+               sp = NULL;
 
        if (sp) {
                /* Free outstanding command slot. */
-               ha->outstanding_cmds[handle] = 0;
+               ha->outstanding_cmds[handle] = NULL;
 
                /* Bad payload or header */
                if (pkt->entry_status & (BIT_3 + BIT_2)) {
index 1458404..f9284fd 100644 (file)
@@ -686,7 +686,7 @@ qla2x00_process_completed_request(struct scsi_qla_host *ha, uint32_t index)
        sp = ha->outstanding_cmds[index];
        if (sp) {
                /* Free outstanding command slot. */
-               ha->outstanding_cmds[index] = 0;
+               ha->outstanding_cmds[index] = NULL;
 
                if (ha->actthreads)
                        ha->actthreads--;
@@ -836,7 +836,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
        /* Validate handle. */
        if (pkt->handle < MAX_OUTSTANDING_COMMANDS) {
                sp = ha->outstanding_cmds[pkt->handle];
-               ha->outstanding_cmds[pkt->handle] = 0;
+               ha->outstanding_cmds[pkt->handle] = NULL;
        } else
                sp = NULL;
 
@@ -1320,7 +1320,7 @@ qla2x00_error_entry(scsi_qla_host_t *ha, sts_entry_t *pkt)
 
        if (sp) {
                /* Free outstanding command slot. */
-               ha->outstanding_cmds[pkt->handle] = 0;
+               ha->outstanding_cmds[pkt->handle] = NULL;
                if (ha->actthreads)
                        ha->actthreads--;
                sp->lun_queue->out_cnt--;
@@ -1383,7 +1383,7 @@ qla2x00_ms_entry(scsi_qla_host_t *ha, ms_iocb_entry_t *pkt)
        CMD_ENTRY_STATUS(sp->cmd) = pkt->entry_status;
 
        /* Free outstanding command slot. */
-       ha->outstanding_cmds[pkt->handle1] = 0;
+       ha->outstanding_cmds[pkt->handle1] = NULL;
 
        add_to_done_queue(ha, sp);
 }
index 75c8067..8fd4590 100644 (file)
@@ -594,7 +594,7 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        return scsi_ioctl(sdp, cmd, p);
                default:
-                       error = scsi_cmd_ioctl(disk, cmd, p);
+                       error = scsi_cmd_ioctl(filp, disk, cmd, p);
                        if (error != -ENOTTY)
                                return error;
        }
index 4c77efc..80dbb14 100644 (file)
@@ -234,6 +234,7 @@ sg_open(struct inode *inode, struct file *filp)
        int res;
        int retval;
 
+       nonseekable_open(inode, filp);
        SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
        sdp = sg_get_dev(dev);
        if ((!sdp) || (!sdp->device))
@@ -349,7 +350,6 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
                return -ENXIO;
        SCSI_LOG_TIMEOUT(3, printk("sg_read: %s, count=%d\n",
                                   sdp->disk->disk_name, (int) count));
-       if (ppos != &filp->f_pos) ;     /* FIXME: Hmm.  Seek to the right place, or fail?  */
        if ((k = verify_area(VERIFY_WRITE, buf, count)))
                return k;
        if (sfp->force_packid && (count >= SZ_SG_HEADER)) {
@@ -507,7 +507,6 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        if (!((filp->f_flags & O_NONBLOCK) ||
              scsi_block_when_processing_errors(sdp->device)))
                return -ENXIO;
-       if (ppos != &filp->f_pos) ;     /* FIXME: Hmm.  Seek to the right place, or fail?  */
 
        if ((k = verify_area(VERIFY_READ, buf, count)))
                return k;       /* protects following copy_from_user()s + get_user()s */
index ba7b032..b80aa28 100644 (file)
@@ -504,7 +504,7 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
                 case SCSI_IOCTL_GET_BUS_NUMBER:
                         return scsi_ioctl(sdev, cmd, (void __user *)arg);
        }
-       return cdrom_ioctl(&cd->cdi, inode, cmd, arg);
+       return cdrom_ioctl(file, &cd->cdi, inode, cmd, arg);
 }
 
 static int sr_block_media_changed(struct gendisk *disk)
@@ -775,9 +775,6 @@ static void get_capabilities(struct scsi_cd *cd)
                ""
        };
 
-       /* Set read only initially */
-       set_disk_ro(cd->disk, 1);
-
        /* allocate a request for the TEST_UNIT_READY */
        SRpnt = scsi_allocate_request(cd->device, GFP_KERNEL);
        if (!SRpnt) {
@@ -885,7 +882,6 @@ static void get_capabilities(struct scsi_cd *cd)
        if ((cd->cdi.mask & (CDC_DVD_RAM | CDC_MRW_W | CDC_RAM)) !=
                        (CDC_DVD_RAM | CDC_MRW_W | CDC_RAM)) {
                cd->device->writeable = 1;
-               set_disk_ro(cd->disk, 0);
        }
 
        scsi_release_request(SRpnt);
index 24a3c49..5fa0153 100644 (file)
@@ -1001,6 +1001,7 @@ static int st_open(struct inode *inode, struct file *filp)
        int dev = TAPE_NR(inode);
        char *name;
 
+       nonseekable_open(inode, filp);
        write_lock(&st_dev_arr_lock);
        if (dev >= st_dev_max || scsi_tapes == NULL ||
            ((STp = scsi_tapes[dev]) == NULL)) {
@@ -1203,7 +1204,7 @@ static int st_release(struct inode *inode, struct file *filp)
 }
 \f
 /* The checks common to both reading and writing */
-static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t *ppos)
+static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count)
 {
        ssize_t retval = 0;
 
@@ -1218,12 +1219,6 @@ static ssize_t rw_checks(Scsi_Tape *STp, struct file *filp, size_t count, loff_t
                goto out;
        }
 
-       if (ppos != &filp->f_pos) {
-               /* "A request was outside the capabilities of the device." */
-               retval = (-ENXIO);
-               goto out;
-       }
-
        if (STp->ready != ST_READY) {
                if (STp->ready == ST_NO_TAPE)
                        retval = (-ENOMEDIUM);
@@ -1367,7 +1362,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        if (down_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
-       retval = rw_checks(STp, filp, count, ppos);
+       retval = rw_checks(STp, filp, count);
        if (retval || count == 0)
                goto out;
 
@@ -1833,7 +1828,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
        if (down_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
-       retval = rw_checks(STp, filp, count, ppos);
+       retval = rw_checks(STp, filp, count);
        if (retval || count == 0)
                goto out;
 
@@ -3413,7 +3408,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
                case SCSI_IOCTL_GET_BUS_NUMBER:
                        break;
                default:
-                       i = scsi_cmd_ioctl(STp->disk, cmd_in, p);
+                       i = scsi_cmd_ioctl(file, STp->disk, cmd_in, p);
                        if (i != -ENOTTY)
                                return i;
                        break;
@@ -3974,7 +3969,7 @@ static int st_remove(struct device *dev)
        for (i = 0; i < st_dev_max; i++) {
                tpnt = scsi_tapes[i];
                if (tpnt != NULL && tpnt->device == SDp) {
-                       scsi_tapes[i] = 0;
+                       scsi_tapes[i] = NULL;
                        st_nr_dev--;
                        write_unlock(&st_dev_arr_lock);
                        devfs_unregister_tape(tpnt->disk->number);
index 7b1aaa5..6408020 100644 (file)
@@ -210,7 +210,7 @@ static inline struct xpt_quehead *xpt_remque_head(struct xpt_quehead *head)
        if (elem != head)
                __xpt_que_del(head, elem->flink);
        else
-               elem = 0;
+               elem = NULL;
        return elem;
 }
 
@@ -375,7 +375,7 @@ static void *___m_alloc(m_pool_s *mp, int size)
        m_link_s *h = mp->h;
 
        if (size > (PAGE_SIZE << MEMO_PAGE_ORDER))
-               return 0;
+               return NULL;
 
        while (size > s) {
                s <<= 1;
@@ -387,7 +387,7 @@ static void *___m_alloc(m_pool_s *mp, int size)
                if (s == (PAGE_SIZE << MEMO_PAGE_ORDER)) {
                        h[j].next = (m_link_s *) M_GETP();
                        if (h[j].next)
-                               h[j].next->next = 0;
+                               h[j].next->next = NULL;
                        break;
                }
                ++j;
@@ -400,7 +400,7 @@ static void *___m_alloc(m_pool_s *mp, int size)
                        j -= 1;
                        s >>= 1;
                        h[j].next = (m_link_s *) (a+s);
-                       h[j].next->next = 0;
+                       h[j].next->next = NULL;
                }
        }
 #ifdef DEBUG
@@ -503,7 +503,7 @@ static void ___mp0_freep(m_pool_s *mp, m_addr_t m)
        --mp->nump;
 }
 
-static m_pool_s mp0 = {0, ___mp0_getp, ___mp0_freep};
+static m_pool_s mp0 = {NULL, ___mp0_getp, ___mp0_freep};
 
 /*
  * DMAable pools.
@@ -595,7 +595,7 @@ static void *__m_calloc_dma(m_bush_t bush, int size, char *name)
 {
        u_long flags;
        struct m_pool *mp;
-       void *m = 0;
+       void *m = NULL;
 
        NCR_LOCK_DRIVER(flags);
        mp = ___get_dma_pool(bush);
@@ -629,7 +629,7 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)
        u_long flags;
        m_pool_s *mp;
        int hc = VTOB_HASH_CODE(m);
-       m_vtob_s *vp = 0;
+       m_vtob_s *vp = NULL;
        m_addr_t a = ((m_addr_t) m) & ~MEMO_CLUSTER_MASK;
 
        NCR_LOCK_DRIVER(flags);
index 239d5c0..1b324b8 100644 (file)
@@ -1215,7 +1215,7 @@ static void dc390_dumpinfo (struct dc390_acb* pACB, struct dc390_dcb* pDCB, stru
     pdev = pACB->pdev;
     pci_read_config_word(pdev, PCI_STATUS, &pstat);
     printk ("DC390: Register dump: PCI Status: %04x\n", pstat);
-    printk ("DC390: In case of driver trouble read linux/Documentation/scsi/tmscsim.txt\n");
+    printk ("DC390: In case of driver trouble read Documentation/scsi/tmscsim.txt\n");
 }
 
 
index 918e7f4..cb0a05d 100644 (file)
@@ -948,9 +948,9 @@ static int ultrastor_abort(Scsi_Cmnd *SCpnt)
        return SCSI_ABORT_NOT_RUNNING;
 
     if (config.mscp[mscp_index].SCint != SCpnt) panic("Bad abort");
-    config.mscp[mscp_index].SCint = 0;
+    config.mscp[mscp_index].SCint = NULL;
     done = config.mscp[mscp_index].done;
-    config.mscp[mscp_index].done = 0;
+    config.mscp[mscp_index].done = NULL;
     SCpnt->result = DID_ABORT << 16;
     
     /* Take the host lock to guard against scsi layer re-entry */
@@ -1000,9 +1000,9 @@ static int ultrastor_host_reset(Scsi_Cmnd * SCpnt)
          {
            config.mscp[i].SCint->result = DID_RESET << 16;
            config.mscp[i].done(config.mscp[i].SCint);
-           config.mscp[i].done = 0;
+           config.mscp[i].done = NULL;
          }
-       config.mscp[i].SCint = 0;
+       config.mscp[i].SCint = NULL;
       }
 #endif
 
@@ -1083,7 +1083,7 @@ static void ultrastor_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        if (icm_status == 3) {
            void (*done)(Scsi_Cmnd *) = mscp->done;
            if (done) {
-               mscp->done = 0;
+               mscp->done = NULL;
                mscp->SCint->result = DID_ABORT << 16;
                done(mscp->SCint);
            }
@@ -1114,7 +1114,7 @@ static void ultrastor_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        once we call done, we may get another command queued before this
        interrupt service routine can return. */
     done = mscp->done;
-    mscp->done = 0;
+    mscp->done = NULL;
 
     /* Let the higher levels know that we're done */
     switch (mscp->adapter_status)
@@ -1138,7 +1138,7 @@ static void ultrastor_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
     SCtmp->result = status | mscp->target_status;
 
-    SCtmp->host_scribble = 0;
+    SCtmp->host_scribble = NULL;
 
     /* Free up mscp block for next command */
 #if ULTRASTOR_MAX_CMDS == 1
index 8639c7d..34b3677 100644 (file)
@@ -574,8 +574,7 @@ titan_400l_800l_setup(struct pci_dev *dev, struct pci_board *board,
 
 static int __devinit pci_xircom_init(struct pci_dev *dev)
 {
-       __set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ/10);
+       msleep(100);
        return 0;
 }
 
index 30bc80a..74a0b9c 100644 (file)
@@ -10,6 +10,7 @@ menu "Serial drivers"
 # The new 8250/16550 serial drivers
 config SERIAL_8250
        tristate "8250/16550 and compatible serial support"
+       depends on (BROKEN || !SPARC64)
        select SERIAL_CORE
        ---help---
          This selects whether you want to include the driver for the standard
@@ -337,20 +338,6 @@ config SERIAL_UART00_CONSOLE
          your boot loader (lilo or loadlin) about how to pass options to the
          kernel at boot time.)
 
-config SERIAL_MPSC
-       bool "Marvell MPSC serial port support"
-       depends on PPC32 && MV64X60
-       select SERIAL_CORE
-       help
-         Say Y here if you want to use the Marvell MPSC serial controller.
-
-config SERIAL_MPSC_CONSOLE
-       bool "Support for console on Marvell MPSC serial port"
-       depends on SERIAL_MPSC
-       select SERIAL_CORE_CONSOLE
-       help
-         Say Y here if you want to support a serial console on a Marvell MPSC.
-
 config SERIAL_PXA
        bool "PXA serial port support"
        depends on ARM && ARCH_PXA
@@ -691,5 +678,40 @@ config SERIAL_CPM_SMC2
        help
          Select the is option to use SMC2 as a serial port
 
-endmenu
+config SERIAL_SGI_L1_CONSOLE
+       bool "SGI Altix L1 serial console support"
+       depends on IA64_GENERIC || IA64_SGI_SN2
+       select SERIAL_CORE
+       help
+               If you have an SGI Altix and you would like to use the system
+               controller serial port as your console (you want this!),
+               say Y.  Otherwise, say N.
 
+config SERIAL_MPC52xx
+       tristate "Freescale MPC52xx family PSC serial support"
+       depends on PPC_MPC52xx
+       select SERIAL_CORE
+       help
+         This drivers support the MPC52xx PSC serial ports. If you would
+         like to use them, you must answer Y or M to this option. Not that
+         for use as console, it must be included in kernel and not as a
+         module.
+
+config SERIAL_MPC52xx_CONSOLE
+       bool "Console on a Freescale MPC52xx family PSC serial port"
+       depends on SERIAL_MPC52xx=y
+       select SERIAL_CORE_CONSOLE
+       help
+         Select this options if you'd like to use one of the PSC serial port
+         of the Freescale MPC52xx family as a console.
+
+config SERIAL_MPC52xx_CONSOLE_BAUD
+       int "Freescale MPC52xx family PSC serial port baud"
+       depends on SERIAL_MPC52xx_CONSOLE=y
+       default "9600"
+       help
+         Select the MPC52xx console baud rate.
+         This value is only used if the bootloader doesn't pass in the
+         console baudrate
+
+endmenu
index f7d3577..dbe2e5f 100644 (file)
@@ -4,8 +4,6 @@
 #  $Id: Makefile,v 1.8 2002/07/21 21:32:30 rmk Exp $
 #
 
-obj-$(CONFIG_SERIAL_MPSC) += mpsc/
-
 serial-8250-y :=
 serial-8250-$(CONFIG_SERIAL_8250_ACPI) += 8250_acpi.o
 serial-8250-$(CONFIG_GSC) += 8250_gsc.o
@@ -40,4 +38,6 @@ obj-$(CONFIG_SERIAL_AU1X00) += au1x00_uart.o
 obj-$(CONFIG_SERIAL_DZ) += dz.o
 obj-$(CONFIG_SERIAL_SH_SCI) += sh-sci.o
 obj-$(CONFIG_SERIAL_BAST_SIO) += bast_sio.o
+obj-$(CONFIG_SERIAL_SGI_L1_CONSOLE) += sn_console.o
 obj-$(CONFIG_SERIAL_CPM) += cpm_uart/
+obj-$(CONFIG_SERIAL_MPC52xx) += mpc52xx_uart.o
diff --git a/drivers/serial/mpsc/Makefile b/drivers/serial/mpsc/Makefile
deleted file mode 100644 (file)
index 7d9054d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# Make file for the Marvell MPSC driver.
-#
-
-obj-$(CONFIG_SERIAL_MPSC)      += mpsc.o
-obj-$(CONFIG_PPC32)            += mpsc_ppc32.o
diff --git a/drivers/serial/mpsc/mpsc.c b/drivers/serial/mpsc/mpsc.c
deleted file mode 100644 (file)
index de7f97c..0000000
+++ /dev/null
@@ -1,1455 +0,0 @@
-/*
- * drivers/serial/mpsc/mpsc.c
- *
- * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240,
- * GT64260, MV64340, MV64360, GT96100, ... ).
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * Based on an old MPSC driver that was in the linuxppc tree.  It appears to
- * have been created by Chris Zankel (formerly of MontaVista) but there
- * is no proper Copyright so I'm not sure.  Parts were, apparently, also
- * taken from PPCBoot (now U-Boot).  Also based on drivers/serial/8250.c
- * by Russell King.
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-/*
- * The MPSC interface is much like a typical network controller's interface.
- * That is, you set up separate rings of descriptors for transmitting and
- * receiving data.  There is also a pool of buffers with (one buffer per
- * descriptor) that incoming data are dma'd into or outgoing data are dma'd
- * out of.
- *
- * The MPSC requires two other controllers to be able to work.  The Baud Rate
- * Generator (BRG) provides a clock at programmable frequencies which determines
- * the baud rate.  The Serial DMA Controller (SDMA) takes incoming data from the
- * MPSC and DMA's it into memory or DMA's outgoing data and passes it to the
- * MPSC.  It is actually the SDMA interrupt that the driver uses to keep the
- * transmit and receive "engines" going (i.e., indicate data has been
- * transmitted or received).
- *
- * NOTES:
- *
- * 1) Some chips have an erratum where several regs cannot be
- * read.  To work around that, we keep a local copy of those regs in
- * 'mpsc_port_info_t' and use the *_M macros when accessing those regs.
- *
- * 2) Some chips have an erratum where the chip will hang when the SDMA ctlr
- * accesses system mem in a cache coherent region.  This *should* be a
- * show-stopper when coherency is turned on but it seems to work okay as
- * long as there are no snoop hits.  Therefore, there are explicit cache
- * management macros in addition to the dma_* calls--the dma_* calls don't
- * do cache mgmt on coherent systems--to manage the cache ensuring there
- * are no snoop hits.
- *
- * 3) AFAICT, hardware flow control isn't supported by the controller --MAG.
- */
-
-#include "mpsc.h"
-
-/*
- * Define how this driver is known to the outside (we've been assigned a
- * range on the "Low-density serial ports" major).
- */
-#define MPSC_MAJOR             204
-#define MPSC_MINOR_START       5       /* XXXX */
-#define        MPSC_DRIVER_NAME        "MPSC"
-#define        MPSC_DEVFS_NAME         "ttym/"
-#define        MPSC_DEV_NAME           "ttyM"
-#define        MPSC_VERSION            "1.00"
-
-static mpsc_port_info_t        mpsc_ports[MPSC_NUM_CTLRS];
-
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
-/*
- ******************************************************************************
- *
- * Baud Rate Generator Routines (BRG)
- *
- ******************************************************************************
- */
-static void
-mpsc_brg_init(mpsc_port_info_t *pi, u32 clk_src)
-{
-       if (pi->brg_can_tune) {
-               MPSC_MOD_FIELD_M(pi, brg, BRG_BCR, 1, 25, 0);
-       }
-
-       MPSC_MOD_FIELD_M(pi, brg, BRG_BCR, 4, 18, clk_src);
-       MPSC_MOD_FIELD(pi, brg, BRG_BTR, 16, 0, 0);
-       return;
-}
-
-static void
-mpsc_brg_enable(mpsc_port_info_t *pi)
-{
-       MPSC_MOD_FIELD_M(pi, brg, BRG_BCR, 1, 16, 1);
-       return;
-}
-
-static void
-mpsc_brg_disable(mpsc_port_info_t *pi)
-{
-       MPSC_MOD_FIELD_M(pi, brg, BRG_BCR, 1, 16, 0);
-       return;
-}
-
-static inline void
-mpsc_set_baudrate(mpsc_port_info_t *pi, u32 baud)
-{
-       /*
-        * To set the baud, we adjust the CDV field in the BRG_BCR reg.
-        * From manual: Baud = clk / ((CDV+1)*2) ==> CDV = (clk / (baud*2)) - 1.
-        * However, the input clock is divided by 16 in the MPSC b/c of how
-        * 'MPSC_MMCRH' was set up so we have to divide 'clk' used in our
-        * calculation by 16 to account for that.  So the real calculation
-        * that accounts for the way the mpsc is set up is:
-        * CDV = (clk / (baud*32)) - 1 ==> CDV = (clk / (baud << 5)) -1.
-        */
-       u32     cdv = (pi->port.uartclk/(baud << 5)) - 1;
-
-       mpsc_brg_disable(pi);
-       MPSC_MOD_FIELD_M(pi, brg, BRG_BCR, 16, 0, cdv);
-       mpsc_brg_enable(pi);
-
-       return;
-}
-
-/*
- ******************************************************************************
- *
- * Serial DMA Routines (SDMA)
- *
- ******************************************************************************
- */
-
-static void
-mpsc_sdma_burstsize(mpsc_port_info_t *pi, u32 burst_size)
-{
-       u32     v;
-
-       DBG("mpsc_sdma_burstsize[%d]: burst_size: %d\n",
-               pi->port.line, burst_size);
-
-       burst_size >>= 3; /* Divide by 8 b/c reg values are 8-byte chunks */
-
-       if (burst_size < 2) v = 0x0;            /* 1 64-bit word */
-       else if (burst_size < 4) v = 0x1;       /* 2 64-bit words */
-       else if (burst_size < 8) v = 0x2;       /* 4 64-bit words */
-       else v = 0x3;                           /* 8 64-bit words */
-
-       MPSC_MOD_FIELD(pi, sdma, SDMA_SDC, 2, 12, v);
-       return;
-}
-
-static void
-mpsc_sdma_init(mpsc_port_info_t *pi, u32 burst_size)
-{
-       DBG("mpsc_sdma_init[%d]: burst_size: %d\n", pi->port.line, burst_size);
-
-       MPSC_MOD_FIELD(pi, sdma, SDMA_SDC, 10, 0, 0x03f);
-       mpsc_sdma_burstsize(pi, burst_size);
-       return;
-}
-
-static inline u32
-mpsc_sdma_intr_mask(mpsc_port_info_t *pi, u32 mask)
-{
-       u32     old, v;
-
-       DBG("mpsc_sdma_intr_mask[%d]: mask: 0x%x\n", pi->port.line, mask);
-
-       old = v = MPSC_READ_M(pi, sdma_intr, SDMA_INTR_MASK);
-       mask &= 0xf;
-       if (pi->port.line) mask <<= 8;
-       v &= ~mask;
-       MPSC_WRITE_M(pi, sdma_intr, SDMA_INTR_MASK, v);
-
-       if (pi->port.line) old >>= 8;
-       return old & 0xf;
-}
-
-static inline void
-mpsc_sdma_intr_unmask(mpsc_port_info_t *pi, u32 mask)
-{
-       u32     v;
-
-       DBG("mpsc_sdma_intr_unmask[%d]: clk_src: 0x%x\n", pi->port.line, mask);
-
-       v = MPSC_READ_M(pi, sdma_intr, SDMA_INTR_MASK);
-       mask &= 0xf;
-       if (pi->port.line) mask <<= 8;
-       v |= mask;
-       MPSC_WRITE_M(pi, sdma_intr, SDMA_INTR_MASK, v);
-       return;
-}
-
-static inline void
-mpsc_sdma_intr_ack(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_sdma_intr_ack[%d]: Acknowledging IRQ\n", pi->port.line);
-       MPSC_WRITE(pi, sdma_intr, SDMA_INTR_CAUSE, 0);
-       return;
-}
-
-static inline void
-mpsc_sdma_set_rx_ring(mpsc_port_info_t *pi, mpsc_rx_desc_t *rxre_p)
-{
-       DBG("mpsc_sdma_set_rx_ring[%d]: rxre_p: 0x%x\n",
-               pi->port.line, (uint)rxre_p);
-
-       MPSC_WRITE(pi, sdma, SDMA_SCRDP, (u32)rxre_p);
-       return;
-}
-
-static inline void
-mpsc_sdma_set_tx_ring(mpsc_port_info_t *pi, volatile mpsc_tx_desc_t *txre_p)
-{
-       MPSC_WRITE(pi, sdma, SDMA_SFTDP, (int)txre_p);
-       MPSC_WRITE(pi, sdma, SDMA_SCTDP, (int)txre_p);
-       return;
-}
-
-static inline void
-mpsc_sdma_cmd(mpsc_port_info_t *pi, u32 val)
-{
-       u32     v;
-
-       v = MPSC_READ(pi, sdma, SDMA_SDCM);
-       if (val)
-               v |= val;
-       else
-               v = 0;
-       MPSC_WRITE(pi, sdma, SDMA_SDCM, v);
-       return;
-}
-
-static inline void
-mpsc_sdma_start_tx(mpsc_port_info_t *pi, volatile mpsc_tx_desc_t *txre_p)
-{
-       mpsc_sdma_set_tx_ring(pi, txre_p);
-       mpsc_sdma_cmd(pi, SDMA_SDCM_TXD);
-       return;
-}
-
-static inline void
-mpsc_sdma_stop(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_sdma_stop[%d]: Stopping SDMA\n", pi->port.line);
-
-       /* Abort any SDMA transfers */
-       mpsc_sdma_cmd(pi, 0);
-       mpsc_sdma_cmd(pi, SDMA_SDCM_AR | SDMA_SDCM_AT);
-
-       /* Clear the SDMA current and first TX and RX pointers */
-       mpsc_sdma_set_tx_ring(pi, 0);
-       mpsc_sdma_set_rx_ring(pi, 0);
-       /* udelay(100); XXXX was in original gt64260 driver */
-
-       /* Disable interrupts */
-       mpsc_sdma_intr_mask(pi, 0xf);
-       mpsc_sdma_intr_ack(pi);
-        udelay(1000);
-
-       return;
-}
-
-/*
- ******************************************************************************
- *
- * Multi-Protocol Serial Controller Routines (MPSC)
- *
- ******************************************************************************
- */
-
-static void
-mpsc_hw_init(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_hw_init[%d]: Initializing hardware\n", pi->port.line);
-
-       /* Set up clock routing */
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_MRR, 3, 0, 0);
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_MRR, 3, 6, 0);
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_RCRR, 4, 0, 0);
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_RCRR, 4, 8, 1);
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_TCRR, 4, 0, 0);
-       MPSC_MOD_FIELD_M(pi, mpsc_routing, MPSC_TCRR, 4, 8, 1);
-
-       /* Put MPSC in UART mode & enabel Tx/Rx egines */
-       MPSC_WRITE(pi, mpsc, MPSC_MMCRL, 0x000004c4);
-
-       /* No preamble, 16x divider, low-latency,  */
-       MPSC_WRITE(pi, mpsc, MPSC_MMCRH, 0x04400400);
-
-       MPSC_WRITE_M(pi, mpsc, MPSC_CHR_1, 0);
-       MPSC_WRITE_M(pi, mpsc, MPSC_CHR_2, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_3, pi->mpsc_max_idle);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_4, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_5, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_6, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_7, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_8, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_9, 0);
-       MPSC_WRITE(pi, mpsc, MPSC_CHR_10, 0);
-
-       return;
-}
-
-static inline void
-mpsc_enter_hunt(mpsc_port_info_t *pi)
-{
-       u32     v;
-
-       DBG("mpsc_enter_hunt[%d]: Hunting...\n", pi->port.line);
-
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_CHR_2, 1, 31, 1);
-
-       if (pi->mirror_regs) {
-               udelay(100);
-       }
-       else
-               do {
-                       v = MPSC_READ_M(pi, mpsc, MPSC_CHR_2);
-               } while (v & MPSC_CHR_2_EH);
-
-       return;
-}
-
-static void
-mpsc_freeze(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_freeze[%d]: Freezing\n", pi->port.line);
-
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_MPCR, 1, 9, 1);
-       return;
-}
-
-static inline void
-mpsc_unfreeze(mpsc_port_info_t *pi)
-{
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_MPCR, 1, 9, 0);
-
-       DBG("mpsc_unfreeze[%d]: Unfrozen\n", pi->port.line);
-       return;
-}
-
-static inline void
-mpsc_set_char_length(mpsc_port_info_t *pi, u32 len)
-{
-       DBG("mpsc_set_char_length[%d]: char len: %d\n", pi->port.line, len);
-
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_MPCR, 2, 12, len);
-       return;
-}
-
-static inline void
-mpsc_set_stop_bit_length(mpsc_port_info_t *pi, u32 len)
-{
-       DBG("mpsc_set_stop_bit_length[%d]: stop bits: %d\n",pi->port.line,len);
-
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_MPCR, 1, 14, len);
-       return;
-}
-
-static inline void
-mpsc_set_parity(mpsc_port_info_t *pi, u32 p)
-{
-       DBG("mpsc_set_parity[%d]: parity bits: 0x%x\n", pi->port.line, p);
-
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_CHR_2, 2, 2, p);        /* TPM */
-       MPSC_MOD_FIELD_M(pi, mpsc, MPSC_CHR_2, 2, 18, p);       /* RPM */
-       return;
-}
-
-/*
- ******************************************************************************
- *
- * Driver Init Routines
- *
- ******************************************************************************
- */
-
-static void
-mpsc_init_hw(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_init_hw[%d]: Initializing\n", pi->port.line);
-
-       mpsc_brg_init(pi, pi->brg_clk_src);
-       mpsc_brg_enable(pi);
-       mpsc_sdma_init(pi, dma_get_cache_alignment());/* burst a cacheline */
-       mpsc_sdma_stop(pi); 
-       mpsc_hw_init(pi);
-
-       return;
-}
-
-static int
-mpsc_alloc_ring_mem(mpsc_port_info_t *pi)
-{
-       int     rc = 0;
-       static void mpsc_free_ring_mem(mpsc_port_info_t *pi);
-
-       DBG("mpsc_alloc_ring_mem[%d]: Allocating ring mem\n", pi->port.line);
-
-       pi->desc_region_size = MPSC_TXR_SIZE + MPSC_RXR_SIZE +
-               (2 * MPSC_DESC_ALIGN);
-       pi->buf_region_size = MPSC_TXB_SIZE + MPSC_RXB_SIZE +
-               (2 * MPSC_BUF_ALIGN);
-
-       if (!pi->desc_region) {
-               if (!dma_supported(pi->port.dev, 0xffffffff)) {
-                       printk(KERN_ERR "MPSC: inadequate DMA support\n");
-                       rc = -ENXIO;
-               }
-               else if ((pi->desc_region = dma_alloc_coherent(pi->port.dev,
-                       pi->desc_region_size, &pi->desc_region_p,
-                       GFP_KERNEL)) == NULL) {
-
-                       printk(KERN_ERR "MPSC: can't alloc Desc region\n");
-                       rc = -ENOMEM;
-               }
-               else if ((pi->buf_region = kmalloc(pi->buf_region_size,
-                       GFP_KERNEL)) == NULL) {
-
-                       printk(KERN_ERR "MPSC: can't alloc bufs\n");
-                       mpsc_free_ring_mem(pi);
-                       rc = -ENOMEM;
-               }
-       }
-
-       return rc;
-}
-
-static void
-mpsc_free_ring_mem(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_free_ring_mem[%d]: Freeing ring mem\n", pi->port.line);
-
-       if (pi->desc_region) {
-               MPSC_CACHE_INVALIDATE(pi, pi->desc_region,
-                       pi->desc_region + pi->desc_region_size);
-               dma_free_coherent(pi->port.dev, pi->desc_region_size,
-                       pi->desc_region, pi->desc_region_p);
-               pi->desc_region = NULL;
-               pi->desc_region_p = (dma_addr_t)NULL;
-       }
-
-       if (pi->buf_region) {
-               MPSC_CACHE_INVALIDATE(pi, pi->buf_region,
-                       pi->buf_region + pi->buf_region_size);
-               kfree(pi->buf_region);
-               pi->buf_region = NULL;
-       }
-
-       return;
-}
-
-static void
-mpsc_init_rings(mpsc_port_info_t *pi)
-{
-       mpsc_rx_desc_t  *rxre, *rxre_p;
-       mpsc_tx_desc_t  *txre, *txre_p;
-       u32             bp_p, save_first, i;
-       u8              *bp;
-
-       DBG("mpsc_init_rings[%d]: Initializing rings\n", pi->port.line);
-
-       BUG_ON((pi->desc_region == NULL) || (pi->buf_region == NULL));
-
-       memset(pi->desc_region, 0, pi->desc_region_size);
-       memset(pi->buf_region, 0, pi->buf_region_size);
-
-       pi->rxr = (mpsc_rx_desc_t *)ALIGN((u32)pi->desc_region,
-               (u32)MPSC_DESC_ALIGN);
-       pi->rxr_p = (mpsc_rx_desc_t *)ALIGN((u32)pi->desc_region_p,
-               (u32)MPSC_DESC_ALIGN);
-       pi->rxb = (u8 *)ALIGN((u32)pi->buf_region, (u32)MPSC_BUF_ALIGN);
-       pi->rxb_p = __pa(pi->rxb);
-
-       rxre = pi->rxr;
-       rxre_p = pi->rxr_p;
-       save_first = (u32)rxre_p;
-       bp = pi->rxb;
-       bp_p = pi->rxb_p;
-       for (i=0; i<MPSC_RXR_ENTRIES; i++,rxre++,rxre_p++) {
-               rxre->bufsize = cpu_to_be16(MPSC_RXBE_SIZE);
-               rxre->bytecnt = cpu_to_be16(0);
-               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O |
-                       SDMA_DESC_CMDSTAT_EI | SDMA_DESC_CMDSTAT_F |
-                       SDMA_DESC_CMDSTAT_L);
-               rxre->link = cpu_to_be32(rxre_p + 1);
-               rxre->buf_ptr = cpu_to_be32(bp_p);
-               MPSC_CACHE_FLUSH(pi, rxre, rxre + 1);
-               dma_map_single(pi->port.dev, bp, MPSC_RXBE_SIZE,
-                       DMA_FROM_DEVICE);
-               MPSC_CACHE_INVALIDATE(pi, bp, bp + MPSC_RXBE_SIZE);
-               bp += MPSC_RXBE_SIZE;
-               bp_p += MPSC_RXBE_SIZE;
-       }
-       (--rxre)->link = cpu_to_be32(save_first); /* Wrap last back to first */
-       MPSC_CACHE_FLUSH(pi, rxre, rxre + 1);
-
-       pi->txr = (mpsc_tx_desc_t *)ALIGN((u32)&pi->rxr[MPSC_RXR_ENTRIES],
-               (u32)MPSC_DESC_ALIGN);
-       pi->txr_p = (mpsc_tx_desc_t *)ALIGN((u32)&pi->rxr_p[MPSC_RXR_ENTRIES],
-               (u32)MPSC_DESC_ALIGN);
-       pi->txb = (u8 *)ALIGN((u32)(pi->rxb + MPSC_RXB_SIZE),
-               (u32)MPSC_BUF_ALIGN);
-       pi->txb_p = __pa(pi->txb);
-
-       txre = pi->txr;
-       txre_p = pi->txr_p;
-       save_first = (u32)txre_p;
-       bp = pi->txb;
-       bp_p = pi->txb_p;
-       for (i=0; i<MPSC_TXR_ENTRIES; i++,txre++,txre_p++) {
-               txre->link = cpu_to_be32(txre_p + 1);
-               txre->buf_ptr = cpu_to_be32(bp_p);
-               MPSC_CACHE_FLUSH(pi, txre, txre + 1);
-               dma_map_single(pi->port.dev, bp, MPSC_TXBE_SIZE, DMA_TO_DEVICE);
-               bp += MPSC_TXBE_SIZE;
-               bp_p += MPSC_TXBE_SIZE;
-       }
-       (--txre)->link = cpu_to_be32(save_first); /* Wrap last back to first */
-       MPSC_CACHE_FLUSH(pi, txre, txre + 1);
-
-       return;
-}
-
-static void
-mpsc_uninit_rings(mpsc_port_info_t *pi)
-{
-       u32             bp_p, i;
-
-       DBG("mpsc_uninit_rings[%d]: Uninitializing rings\n", pi->port.line);
-
-       BUG_ON((pi->desc_region == NULL) || (pi->buf_region == NULL));
-
-       bp_p = pi->rxb_p;
-       for (i=0; i<MPSC_RXR_ENTRIES; i++) {
-               dma_unmap_single(pi->port.dev, bp_p, MPSC_RXBE_SIZE,
-                       DMA_FROM_DEVICE);
-               bp_p += MPSC_RXBE_SIZE;
-       }
-       pi->rxr = NULL;
-       pi->rxr_p = NULL;
-       pi->rxr_posn = 0;
-       pi->rxb = NULL;
-       pi->rxb_p = 0;
-
-       bp_p = pi->txb_p;
-       for (i=0; i<MPSC_TXR_ENTRIES; i++) {
-               dma_unmap_single(pi->port.dev, bp_p, MPSC_TXBE_SIZE,
-                       DMA_TO_DEVICE);
-               bp_p += MPSC_TXBE_SIZE;
-       }
-       pi->txr = NULL;
-       pi->txr_p = NULL;
-       pi->txr_posn = 0;
-       pi->txb = NULL;
-       pi->txb_p = 0;
-
-       return;
-}
-
-static int
-mpsc_make_ready(mpsc_port_info_t *pi)
-{
-       int     rc;
-
-       DBG("mpsc_make_ready[%d]: Making cltr ready\n", pi->port.line);
-
-       if (!pi->ready) {
-               mpsc_init_hw(pi);
-               if ((rc = mpsc_alloc_ring_mem(pi)))
-                       return rc;
-               mpsc_init_rings(pi);
-               pi->ready = 1;
-       }
-
-       return 0;
-}
-
-/*
- ******************************************************************************
- *
- * Interrupt Handling Routines
- *
- ******************************************************************************
- */
-
-static inline void
-mpsc_rx_intr(mpsc_port_info_t *pi, struct pt_regs *regs)
-{
-       volatile mpsc_rx_desc_t *rxre = &pi->rxr[pi->rxr_posn];
-       struct tty_struct       *tty = pi->port.info->tty;
-       u32                     cmdstat, bytes_in;
-       u8                      *bp;
-       dma_addr_t              bp_p;
-       static void mpsc_start_rx(mpsc_port_info_t *pi);
-
-       DBG("mpsc_rx_intr[%d]: Handling Rx intr\n", pi->port.line);
-
-       /*
-        * Loop through Rx descriptors handling ones that have been completed.
-        */
-       MPSC_CACHE_INVALIDATE(pi, rxre, rxre + 1);
-
-       while (!((cmdstat = be32_to_cpu(rxre->cmdstat)) & SDMA_DESC_CMDSTAT_O)){
-               bytes_in = be16_to_cpu(rxre->bytecnt);
-
-               if (unlikely((tty->flip.count + bytes_in) >= TTY_FLIPBUF_SIZE)){
-                       tty->flip.work.func((void *)tty);
-
-                       if ((tty->flip.count + bytes_in) >= TTY_FLIPBUF_SIZE) {
-                               /* Take what we can, throw away the rest */
-                               bytes_in = TTY_FLIPBUF_SIZE - tty->flip.count;
-                               cmdstat &= ~SDMA_DESC_CMDSTAT_PE;
-                       }
-               }
-
-               bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE);
-               bp_p = pi->txb_p + (pi->rxr_posn * MPSC_RXBE_SIZE);
-
-               dma_sync_single_for_cpu(pi->port.dev, bp_p, MPSC_RXBE_SIZE,
-                       DMA_FROM_DEVICE);
-               MPSC_CACHE_INVALIDATE(pi, bp, bp + MPSC_RXBE_SIZE);
-
-               /*
-                * Other than for parity error, the manual provides little
-                * info on what data will be in a frame flagged by any of
-                * these errors.  For parity error, it is the last byte in
-                * the buffer that had the error.  As for the rest, I guess
-                * we'll assume there is no data in the buffer.
-                * If there is...it gets lost.
-                */
-               if (cmdstat & (SDMA_DESC_CMDSTAT_BR | SDMA_DESC_CMDSTAT_FR |
-                       SDMA_DESC_CMDSTAT_OR)) {
-
-                       pi->port.icount.rx++;
-
-                       if (cmdstat & SDMA_DESC_CMDSTAT_BR) { /* Break */
-                               pi->port.icount.brk++;
-
-                               if (uart_handle_break(&pi->port))
-                                       goto next_frame;
-                       }
-                       else if (cmdstat & SDMA_DESC_CMDSTAT_FR) /* Framing */
-                               pi->port.icount.frame++;
-                       else if (cmdstat & SDMA_DESC_CMDSTAT_OR) /* Overrun */
-                               pi->port.icount.overrun++;
-
-                       cmdstat &= pi->port.read_status_mask;
-
-                       if (!(cmdstat & pi->port.ignore_status_mask)) {
-                               if (cmdstat & SDMA_DESC_CMDSTAT_BR)
-                                       *tty->flip.flag_buf_ptr = TTY_BREAK;
-                               else if (cmdstat & SDMA_DESC_CMDSTAT_FR)
-                                       *tty->flip.flag_buf_ptr = TTY_FRAME;
-                               else if (cmdstat & SDMA_DESC_CMDSTAT_OR)
-                                       *tty->flip.flag_buf_ptr = TTY_OVERRUN;
-
-                               tty->flip.flag_buf_ptr++;
-                               *tty->flip.char_buf_ptr = '\0';
-                               tty->flip.char_buf_ptr++;
-                               tty->flip.count++;
-                       }
-               }
-               else {
-                       if (uart_handle_sysrq_char(&pi->port, *bp, regs)) {
-                               bp++;
-                               bytes_in--;
-                       }
-
-                       memcpy(tty->flip.char_buf_ptr, bp, bytes_in);
-                       memset(tty->flip.flag_buf_ptr, TTY_NORMAL, bytes_in);
-
-                       tty->flip.char_buf_ptr += bytes_in;
-                       tty->flip.flag_buf_ptr += bytes_in;
-                       tty->flip.count += bytes_in;
-                       pi->port.icount.rx += bytes_in;
-
-                       cmdstat &= SDMA_DESC_CMDSTAT_PE;
-
-                       if (cmdstat) {  /* Parity */
-                               pi->port.icount.parity++;
-
-                               if (!(cmdstat & pi->port.read_status_mask))
-                                       *(tty->flip.flag_buf_ptr-1) = TTY_FRAME;
-                       }
-               }
-
-next_frame:
-               dma_sync_single_for_device(pi->port.dev, bp_p,
-                       MPSC_RXBE_SIZE, DMA_FROM_DEVICE);
-               rxre->bytecnt = cpu_to_be16(0);
-               wmb(); /* ensure other writes done before cmdstat update */
-               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O |
-                       SDMA_DESC_CMDSTAT_EI | SDMA_DESC_CMDSTAT_F |
-                       SDMA_DESC_CMDSTAT_L);
-               MPSC_CACHE_FLUSH(pi, rxre, rxre + 1);
-
-               /* Advance to next descriptor */
-               pi->rxr_posn = (pi->rxr_posn + 1) & (MPSC_RXR_ENTRIES - 1);
-               rxre = &pi->rxr[pi->rxr_posn];
-               MPSC_CACHE_INVALIDATE(pi, rxre, rxre + 1);
-       }
-
-       /* Restart rx engine, if its stopped */
-       if ((MPSC_READ(pi, sdma, SDMA_SDCM) & SDMA_SDCM_ERD) == 0) {
-               mpsc_start_rx(pi);
-       }
-
-       tty_flip_buffer_push(tty);
-       return;
-}
-
-static inline void
-mpsc_send_tx_data(mpsc_port_info_t *pi, volatile mpsc_tx_desc_t *txre,
-       volatile mpsc_tx_desc_t *txre_p, void *bp, u32 count, u32 intr)
-{
-       dma_sync_single_for_device(pi->port.dev, be32_to_cpu(txre->buf_ptr),
-                       MPSC_TXBE_SIZE, DMA_TO_DEVICE);
-       MPSC_CACHE_FLUSH(pi, bp, bp + MPSC_TXBE_SIZE);
-
-       txre->bytecnt = cpu_to_be16(count);
-       txre->shadow = txre->bytecnt;
-       wmb(); /* ensure cmdstat is last field updated */
-       txre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O | SDMA_DESC_CMDSTAT_F |
-               SDMA_DESC_CMDSTAT_L | ((intr) ? SDMA_DESC_CMDSTAT_EI : 0));
-       MPSC_CACHE_FLUSH(pi, txre, txre + 1);
-
-       /* Start Tx engine, if its stopped */
-       if ((MPSC_READ(pi, sdma, SDMA_SDCM) & SDMA_SDCM_TXD) == 0) {
-               mpsc_sdma_start_tx(pi, txre_p);
-       }
-
-       return;
-}
-
-static inline void
-mpsc_tx_intr(mpsc_port_info_t *pi)
-{
-       volatile mpsc_tx_desc_t *txre = &pi->txr[pi->txr_posn];
-       volatile mpsc_tx_desc_t *txre_p = &pi->txr_p[pi->txr_posn];
-       struct circ_buf         *xmit = &pi->port.info->xmit;
-       u8                      *bp;
-       u32                     i;
-
-       MPSC_CACHE_INVALIDATE(pi, txre, txre + 1);
-
-       while (!(be32_to_cpu(txre->cmdstat) & SDMA_DESC_CMDSTAT_O)) {
-               bp = &pi->txb[pi->txr_posn * MPSC_TXBE_SIZE];
-
-               dma_sync_single_for_cpu(pi->port.dev,be32_to_cpu(txre->buf_ptr),
-                       MPSC_TXBE_SIZE, DMA_TO_DEVICE);
-
-               if (pi->port.x_char) {
-                       /*
-                        * Ideally, we should use the TCS field in CHR_1 to
-                        * put the x_char out immediately but errata prevents
-                        * us from being able to read CHR_2 to know that its
-                        * safe to write to CHR_1.  Instead, just put it
-                        * in-band with all the other Tx data.
-                        */
-                       *bp = pi->port.x_char;
-                       pi->port.x_char = 0;
-                       i = 1;
-               }
-               else if (!uart_circ_empty(xmit) && !uart_tx_stopped(&pi->port)){
-                       i = MIN(MPSC_TXBE_SIZE, uart_circ_chars_pending(xmit));
-                       i = MIN(i, CIRC_CNT_TO_END(xmit->head, xmit->tail,
-                                                       UART_XMIT_SIZE));
-                       memcpy(bp, &xmit->buf[xmit->tail], i);
-                       xmit->tail = (xmit->tail + i) & (UART_XMIT_SIZE - 1);
-               }
-               else { /* No more data to transmit or tx engine is stopped */
-                       MPSC_CACHE_INVALIDATE(pi, txre, txre + 1);
-                       return;
-               }
-
-               mpsc_send_tx_data(pi, txre, txre_p, bp, i, 1);
-               pi->port.icount.tx += i;
-
-               if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
-                       uart_write_wakeup(&pi->port);
-
-               /* Advance to next descriptor */
-               pi->txr_posn = (pi->txr_posn + 1) & (MPSC_TXR_ENTRIES - 1);
-               txre = &pi->txr[pi->txr_posn];
-               txre_p = &pi->txr_p[pi->txr_posn];
-               MPSC_CACHE_INVALIDATE(pi, txre, txre + 1);
-       }
-
-       return;
-}
-
-/*
- * This is the driver's interrupt handler.  To avoid a race, we first clear
- * the interrupt, then handle any completed Rx/Tx descriptors.  When done
- * handling those descriptors, we restart the Rx/Tx engines if they're stopped.
- */
-static irqreturn_t
-mpsc_sdma_intr(int irq, void *dev_id, struct pt_regs *regs)
-{
-       mpsc_port_info_t        *pi = dev_id;
-       ulong                   iflags;
-
-       DBG("mpsc_sdma_intr[%d]: SDMA Interrupt Received\n", pi->port.line);
-
-       spin_lock_irqsave(&pi->port.lock, iflags);
-       mpsc_sdma_intr_ack(pi);
-       mpsc_rx_intr(pi, regs);
-       mpsc_tx_intr(pi);
-       spin_unlock_irqrestore(&pi->port.lock, iflags);
-
-       DBG("mpsc_sdma_intr[%d]: SDMA Interrupt Handled\n", pi->port.line);
-       return IRQ_HANDLED;
-}
-
-/*
- ******************************************************************************
- *
- * serial_core.c Interface routines
- *
- ******************************************************************************
- */
-
-static uint
-_mpsc_tx_empty(mpsc_port_info_t *pi)
-{
-       return (((MPSC_READ(pi, sdma, SDMA_SDCM) & SDMA_SDCM_TXD) == 0) ?
-                                                       TIOCSER_TEMT : 0);
-}
-
-static uint
-mpsc_tx_empty(struct uart_port *port)
-{
-       mpsc_port_info_t        *pi = (mpsc_port_info_t *)port;
-       ulong                   iflags;
-       uint                    rc;
-
-       spin_lock_irqsave(&pi->port.lock, iflags);
-       rc = _mpsc_tx_empty(pi);
-       spin_unlock_irqrestore(&pi->port.lock, iflags);
-
-       return rc;
-}
-
-static void
-mpsc_set_mctrl(struct uart_port *port, uint mctrl)
-{
-       /* Have no way to set modem control lines AFAICT */
-       return;
-}
-
-static uint
-mpsc_get_mctrl(struct uart_port *port)
-{
-       mpsc_port_info_t        *pi = (mpsc_port_info_t *)port;
-       u32                     mflags, status;
-       ulong                   iflags;
-
-       spin_lock_irqsave(&pi->port.lock, iflags);
-       status = MPSC_READ_M(pi, mpsc, MPSC_CHR_10);
-       spin_unlock_irqrestore(&pi->port.lock, iflags);
-
-       mflags = 0;
-       if (status & 0x1)
-               mflags |= TIOCM_CTS;
-       if (status & 0x2)
-               mflags |= TIOCM_CAR;
-
-       return mflags | TIOCM_DSR;      /* No way to tell if DSR asserted */
-}
-
-static void
-mpsc_stop_tx(struct uart_port *port, uint tty_start)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-
-       DBG("mpsc_stop_tx[%d]: tty_start: %d\n", port->line, tty_start);
-
-       mpsc_freeze(pi);
-       return;
-}
-
-static void
-mpsc_start_tx(struct uart_port *port, uint tty_start)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-
-       mpsc_unfreeze(pi);
-       mpsc_tx_intr(pi); /* Load Tx data into Tx ring bufs & go */
-
-       DBG("mpsc_start_tx[%d]: tty_start: %d\n", port->line, tty_start);
-       return;
-}
-
-static void
-mpsc_start_rx(mpsc_port_info_t *pi)
-{
-       DBG("mpsc_start_rx[%d]: Starting...\n", pi->port.line);
-
-       if (pi->rcv_data) {
-               mb();
-               mpsc_enter_hunt(pi);
-               mpsc_sdma_cmd(pi, SDMA_SDCM_ERD);
-       }
-       return;
-}
-
-static void
-mpsc_stop_rx(struct uart_port *port)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-
-       DBG("mpsc_stop_rx[%d]: Stopping...\n", port->line);
-
-       mpsc_sdma_cmd(pi, SDMA_SDCM_AR);
-       return;
-}
-
-static void
-mpsc_enable_ms(struct uart_port *port)
-{
-       return;         /* Not supported */
-}
-
-static void
-mpsc_break_ctl(struct uart_port *port, int ctl)
-{
-       mpsc_port_info_t        *pi = (mpsc_port_info_t *)port;
-       ulong                   flags;
-
-       spin_lock_irqsave(&pi->port.lock, flags);
-       if (ctl) {
-               /* Send as many BRK chars as we can */
-               MPSC_WRITE_M(pi, mpsc, MPSC_CHR_1, 0x00ff0000);
-       }
-       else {
-               /* Stop sending BRK chars */
-               MPSC_WRITE_M(pi, mpsc, MPSC_CHR_1, 0);
-       }
-       spin_unlock_irqrestore(&pi->port.lock, flags);
-
-       return;
-}
-
-static int
-mpsc_startup(struct uart_port *port)
-{
-       mpsc_port_info_t        *pi = (mpsc_port_info_t *)port;
-       int                     rc;
-
-       DBG("mpsc_startup[%d]: Starting up MPSC, irq: %d\n",
-               port->line, pi->port.irq);
-
-       if ((rc = mpsc_make_ready(pi)) == 0) {
-               /* Setup IRQ handler */
-               mpsc_sdma_intr_ack(pi);
-               mpsc_sdma_intr_unmask(pi, 0xf);
-
-               if (request_irq(pi->port.irq, mpsc_sdma_intr, 0, "MPSC/SDMA",
-                                                                       pi)) {
-                       printk(KERN_ERR "MPSC: Can't get SDMA IRQ");
-                       printk("MPSC: Can't get SDMA IRQ %d\n", pi->port.irq);
-               }
-
-               mpsc_sdma_set_rx_ring(pi, &pi->rxr_p[pi->rxr_posn]);
-               mpsc_start_rx(pi);
-       }
-
-       return rc;
-}
-
-static void
-mpsc_shutdown(struct uart_port *port)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-       static void mpsc_release_port(struct uart_port *port);
-
-       DBG("mpsc_shutdown[%d]: Shutting down MPSC\n", port->line);
-
-       mpsc_sdma_stop(pi);
-       free_irq(pi->port.irq, pi);
-       return;
-}
-
-static void
-mpsc_set_termios(struct uart_port *port, struct termios *termios,
-                      struct termios *old)
-{
-       mpsc_port_info_t        *pi = (mpsc_port_info_t *)port;
-       u32                     baud, quot;
-       ulong                   flags;
-       u32                     chr_bits, stop_bits, par;
-
-       pi->c_iflag = termios->c_iflag;
-       pi->c_cflag = termios->c_cflag;
-
-       switch (termios->c_cflag & CSIZE) {
-               case CS5:
-                       chr_bits = MPSC_MPCR_CL_5;
-                       break;
-               case CS6:
-                       chr_bits = MPSC_MPCR_CL_6;
-                       break;
-               case CS7:
-                       chr_bits = MPSC_MPCR_CL_7;
-                       break;
-               default:
-               case CS8:
-                       chr_bits = MPSC_MPCR_CL_8;
-                       break;
-       }
-
-       if (termios->c_cflag & CSTOPB)
-               stop_bits = MPSC_MPCR_SBL_2;
-       else
-               stop_bits = MPSC_MPCR_SBL_1;
-
-       if (termios->c_cflag & PARENB) {
-               if (termios->c_cflag & PARODD)
-                       par = MPSC_CHR_2_PAR_ODD;
-               else
-                       par = MPSC_CHR_2_PAR_EVEN;
-#ifdef CMSPAR
-               if (termios->c_cflag & CMSPAR) {
-                       if (termios->c_cflag & PARODD)
-                               par = MPSC_CHR_2_PAR_MARK;
-                       else
-                               par = MPSC_CHR_2_PAR_SPACE;
-               }
-#endif
-       }
-
-       baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk); 
-       quot = uart_get_divisor(port, baud);
-
-       spin_lock_irqsave(&pi->port.lock, flags);
-
-       uart_update_timeout(port, termios->c_cflag, baud);
-
-       mpsc_set_char_length(pi, chr_bits);
-       mpsc_set_stop_bit_length(pi, stop_bits);
-       mpsc_set_parity(pi, par);
-       mpsc_set_baudrate(pi, baud);
-
-       /* Characters/events to read */
-       pi->rcv_data = 1;
-       pi->port.read_status_mask = SDMA_DESC_CMDSTAT_OR;
-
-       if (termios->c_iflag & INPCK)
-               pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE |
-                       SDMA_DESC_CMDSTAT_FR;
-
-       if (termios->c_iflag & (BRKINT | PARMRK))
-               pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR;
-
-       /* Characters/events to ignore */
-       pi->port.ignore_status_mask = 0;
-
-       if (termios->c_iflag & IGNPAR)
-               pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_PE |
-                       SDMA_DESC_CMDSTAT_FR;
-
-       if (termios->c_iflag & IGNBRK) {
-               pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_BR;
-
-               if (termios->c_iflag & IGNPAR)
-                       pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_OR;
-       }
-
-       /* Ignore all chars if CREAD not set */
-       if (!(termios->c_cflag & CREAD))
-               pi->rcv_data = 0;
-
-       spin_unlock_irqrestore(&pi->port.lock, flags);
-       return;
-}
-
-static const char *
-mpsc_type(struct uart_port *port)
-{
-       DBG("mpsc_type[%d]: port type: %s\n", port->line, MPSC_DRIVER_NAME);
-       return MPSC_DRIVER_NAME;
-}
-
-static int
-mpsc_request_port(struct uart_port *port)
-{
-       /* Should make chip/platform specific call */
-       return 0;
-}
-
-static void
-mpsc_release_port(struct uart_port *port)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-
-       mpsc_uninit_rings(pi);
-       mpsc_free_ring_mem(pi);
-       pi->ready = 0;
-
-       return;
-}
-
-static void
-mpsc_config_port(struct uart_port *port, int flags)
-{
-       return;
-}
-
-static int
-mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)
-{
-       mpsc_port_info_t *pi = (mpsc_port_info_t *)port;
-       int     rc = 0;
-
-       DBG("mpsc_verify_port[%d]: Verifying port data\n", pi->port.line);
-
-       if (ser->type != PORT_UNKNOWN && ser->type != PORT_MPSC)
-               rc = -EINVAL;
-       if (pi->port.irq != ser->irq)
-               rc = -EINVAL;
-       if (ser->io_type != SERIAL_IO_MEM)
-               rc = -EINVAL;
-       if (pi->port.uartclk / 16 != ser->baud_base) /* XXXX Not sure */
-               rc = -EINVAL;
-       if ((void *)pi->port.mapbase != ser->iomem_base)
-               rc = -EINVAL;
-       if (pi->port.iobase != ser->port)
-               rc = -EINVAL;
-       if (ser->hub6 != 0)
-               rc = -EINVAL;
-
-       return rc;
-}
-
-static struct uart_ops mpsc_pops = {
-       .tx_empty       = mpsc_tx_empty,
-       .set_mctrl      = mpsc_set_mctrl,
-       .get_mctrl      = mpsc_get_mctrl,
-       .stop_tx        = mpsc_stop_tx,
-       .start_tx       = mpsc_start_tx,
-       .stop_rx        = mpsc_stop_rx,
-       .enable_ms      = mpsc_enable_ms,
-       .break_ctl      = mpsc_break_ctl,
-       .startup        = mpsc_startup,
-       .shutdown       = mpsc_shutdown,
-       .set_termios    = mpsc_set_termios,
-       .type           = mpsc_type,
-       .release_port   = mpsc_release_port,
-       .request_port   = mpsc_request_port,
-       .config_port    = mpsc_config_port,
-       .verify_port    = mpsc_verify_port,
-};
-
-/*
- ******************************************************************************
- *
- * Console Interface Routines
- *
- ******************************************************************************
- */
-
-#ifdef CONFIG_SERIAL_MPSC_CONSOLE
-static void
-mpsc_console_write(struct console *co, const char *s, uint count)
-{
-       mpsc_port_info_t        *pi = &mpsc_ports[co->index];
-       volatile mpsc_tx_desc_t *txre = &pi->txr[pi->txr_posn];
-       volatile mpsc_tx_desc_t *txre_p = &pi->txr_p[pi->txr_posn];
-       u8                      *bp, *dp, add_cr = 0;
-       int                     i;
-
-       /*
-        * Step thru tx ring one entry at a time, filling up its buf, sending
-        * the data out and moving to the next ring entry until its all out.
-        */
-       MPSC_CACHE_INVALIDATE(pi, txre, txre + 1);
-
-       while (count > 0) {
-               while (_mpsc_tx_empty(pi) != TIOCSER_TEMT);
-
-               BUG_ON(be32_to_cpu(txre->cmdstat) & SDMA_DESC_CMDSTAT_O);
-
-               bp = dp = &pi->txb[pi->txr_posn * MPSC_TXBE_SIZE];
-
-               dma_sync_single_for_cpu(pi->port.dev,be32_to_cpu(txre->buf_ptr),
-                       MPSC_TXBE_SIZE, DMA_TO_DEVICE);
-
-               for (i=0; i<MPSC_TXBE_SIZE; i++) {
-                       if (count == 0)
-                               break;
-
-                       if (add_cr) {
-                               *(dp++) = '\r';
-                               add_cr = 0;
-                       }
-                       else {
-                               *(dp++) = *s;
-
-                               if (*(s++) == '\n') { /* add '\r' after '\n' */
-                                       add_cr = 1;
-                                       count++;
-                               }
-                       }
-
-                       count--;
-               }
-
-               mpsc_send_tx_data(pi, txre, txre_p, bp, i, 0);
-
-               /* Advance to next descriptor */
-               pi->txr_posn = (pi->txr_posn + 1) & (MPSC_TXR_ENTRIES - 1);
-               txre = &pi->txr[pi->txr_posn];
-               txre_p = &pi->txr_p[pi->txr_posn];
-               MPSC_CACHE_INVALIDATE(pi, txre, txre + 1);
-       }
-
-       while (_mpsc_tx_empty(pi) != TIOCSER_TEMT);
-       return;
-}
-
-static int __init
-mpsc_console_setup(struct console *co, char *options)
-{
-       mpsc_port_info_t        *pi;
-       int                     baud, bits, parity, flow;
-
-       DBG("mpsc_console_setup[%d]: options: %s\n", co->index, options);
-
-       if (co->index >= MPSC_NUM_CTLRS)
-               co->index = 0;
-
-       pi = &mpsc_ports[co->index];
-
-       baud = pi->default_baud;
-       bits = pi->default_bits;
-       parity = pi->default_parity;
-       flow = pi->default_flow;
-
-       if (!pi->port.ops)
-               return -ENODEV;
-
-       spin_lock_init(&pi->port.lock); /* Temporary fix--copied from 8250.c */
-
-       if (options)
-               uart_parse_options(options, &baud, &parity, &bits, &flow);
-
-       return uart_set_options(&pi->port, co, baud, parity, bits, flow);
-}
-
-extern struct uart_driver mpsc_reg;
-static struct console mpsc_console = {
-       .name           = MPSC_DEV_NAME,
-       .write          = mpsc_console_write,
-       .device         = uart_console_device,
-       .setup          = mpsc_console_setup,
-       .flags          = CON_PRINTBUFFER,
-       .index          = -1,
-       .data           = &mpsc_reg,
-};
-
-static int __init
-mpsc_console_init(void)
-{
-       DBG("mpsc_console_init: Enter\n");
-       register_console(&mpsc_console);
-       return 0;
-}
-console_initcall(mpsc_console_init);
-
-static int __init
-mpsc_late_console_init(void)
-{
-       DBG("mpsc_late_console_init: Enter\n");
-
-       if (!(mpsc_console.flags & CON_ENABLED))
-               register_console(&mpsc_console);
-       return 0;
-}
-late_initcall(mpsc_late_console_init);
-
-#define MPSC_CONSOLE   &mpsc_console
-#else
-#define MPSC_CONSOLE   NULL
-#endif
-
-/*
- ******************************************************************************
- *
- * Driver Interface Routines
- *
- ******************************************************************************
- */
-
-static void
-mpsc_map_regs(mpsc_port_info_t *pi)
-{
-       pi->mpsc_base = (u32)ioremap(pi->mpsc_base_p, MPSC_REG_BLOCK_SIZE);
-       pi->mpsc_routing_base = (u32)ioremap(pi->mpsc_routing_base_p,
-                                               MPSC_ROUTING_REG_BLOCK_SIZE);
-       pi->sdma_base = (u32)ioremap(pi->sdma_base_p, SDMA_REG_BLOCK_SIZE);
-       pi->sdma_intr_base = (u32)ioremap(pi->sdma_intr_base_p,
-                                               SDMA_INTR_REG_BLOCK_SIZE);
-       pi->brg_base = (u32)ioremap(pi->brg_base_p, BRG_REG_BLOCK_SIZE);
-
-       return;
-}
-
-static void
-mpsc_unmap_regs(mpsc_port_info_t *pi)
-{
-       iounmap((void *)pi->mpsc_base);
-       iounmap((void *)pi->mpsc_routing_base);
-       iounmap((void *)pi->sdma_base);
-       iounmap((void *)pi->sdma_intr_base);
-       iounmap((void *)pi->brg_base);
-
-       pi->mpsc_base = 0;
-       pi->mpsc_routing_base = 0;
-       pi->sdma_base = 0;
-       pi->sdma_intr_base = 0;
-       pi->brg_base = 0;
-
-       return;
-}
-
-/* Called from platform specific device probe routine */
-mpsc_port_info_t *
-mpsc_device_probe(int index)
-{
-       mpsc_port_info_t        *pi = NULL;
-
-       if ((index >= 0) && (index < MPSC_NUM_CTLRS))
-               pi = &mpsc_ports[index];
-
-       return pi;
-}
-
-/* Called from platform specific device remove routine */
-mpsc_port_info_t *
-mpsc_device_remove(int index)
-{
-       mpsc_port_info_t        *pi = NULL;
-
-       if ((index >= 0) && (index < MPSC_NUM_CTLRS))
-               pi = &mpsc_ports[index];
-
-       return pi;
-}
-
-static struct uart_driver mpsc_reg = {
-       .owner                  = THIS_MODULE,
-       .driver_name            = MPSC_DRIVER_NAME,
-       .devfs_name             = MPSC_DEVFS_NAME,
-       .dev_name               = MPSC_DEV_NAME,
-       .major                  = MPSC_MAJOR,
-       .minor                  = MPSC_MINOR_START,
-       .nr                     = MPSC_NUM_CTLRS,
-       .cons                   = MPSC_CONSOLE,
-};
-
-static int __init
-mpsc_init(void)
-{
-       mpsc_port_info_t        *pi;
-       int                     i, j, rc;
-
-       printk(KERN_INFO "Serial: MPSC driver $Revision: 1.00 $\n");
-
-       if ((rc = mpsc_platform_register_driver()) >= 0) {
-               if ((rc = uart_register_driver(&mpsc_reg)) < 0) {
-                       mpsc_platform_unregister_driver();
-               }
-               else {
-                       for (i=0; i<MPSC_NUM_CTLRS; i++) {
-                               pi = &mpsc_ports[i];
-
-                               pi->port.line = i;
-                               pi->port.type = PORT_MPSC;
-                               pi->port.fifosize = MPSC_TXBE_SIZE;
-                               pi->port.membase = (char *)pi->mpsc_base;
-                               pi->port.mapbase = (ulong)pi->mpsc_base;
-                               pi->port.ops = &mpsc_pops;
-
-                               mpsc_map_regs(pi);
-
-                               if ((rc = mpsc_make_ready(pi)) >= 0) {
-                                       uart_add_one_port(&mpsc_reg, &pi->port);
-                               }
-                               else { /* on failure, undo everything */
-                                       for (j=0; j<i; j++) {
-                                               mpsc_unmap_regs(&mpsc_ports[j]);
-                                               uart_remove_one_port(&mpsc_reg,
-                                                       &mpsc_ports[j].port);
-                                       }
-
-                                       uart_unregister_driver(&mpsc_reg);
-                                       mpsc_platform_unregister_driver();
-                                       break;
-                               }
-                       }
-               }
-       }
-
-       return rc;
-}
-
-static void __exit
-mpsc_exit(void)
-{
-       int     i;
-
-       DBG("mpsc_exit: Exiting\n");
-
-       for (i=0; i<MPSC_NUM_CTLRS; i++) {
-               mpsc_unmap_regs(&mpsc_ports[i]);
-               uart_remove_one_port(&mpsc_reg, &mpsc_ports[i].port);
-       }
-
-       uart_unregister_driver(&mpsc_reg);
-       mpsc_platform_unregister_driver();
-
-       return;
-}
-
-int
-register_serial(struct serial_struct *req)
-{
-       return uart_register_port(&mpsc_reg, &mpsc_ports[req->line].port);
-}
-
-void
-unregister_serial(int line)
-{
-       uart_unregister_port(&mpsc_reg, line);
-       return;
-}
-
-module_init(mpsc_init);
-module_exit(mpsc_exit);
-
-EXPORT_SYMBOL(register_serial);
-EXPORT_SYMBOL(unregister_serial);
-
-MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
-MODULE_DESCRIPTION("Generic Marvell MPSC serial/UART driver $Revision: 1.00 $");
-MODULE_VERSION(MPSC_VERSION);
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_CHARDEV_MAJOR(MPSC_MAJOR);
diff --git a/drivers/serial/mpsc/mpsc.h b/drivers/serial/mpsc/mpsc.h
deleted file mode 100644 (file)
index 400629e..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * drivers/serial/mpsc/mpsc.h
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-
-#ifndef        __MPSC_H__
-#define        __MPSC_H__
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/tty.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/sysrq.h>
-#include <linux/serial.h>
-#include <linux/delay.h>
-#include <linux/device.h>
-#include <linux/dma-mapping.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-
-#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
-#include <linux/serial_core.h>
-#include "mpsc_defs.h"
-
-
-/*
- * Descriptors and buffers must be cache line aligned.
- * Buffers lengths must be multiple of cache line size.
- * Number of Tx & Rx descriptors must be power of 2.
- */
-#define        MPSC_DESC_ALIGN         dma_get_cache_alignment()
-#define MPSC_BUF_ALIGN         dma_get_cache_alignment()
-
-#define        MPSC_RXR_ENTRIES        32
-#define        MPSC_RXRE_SIZE          sizeof(mpsc_rx_desc_t)
-#define        MPSC_RXR_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE)
-#define        MPSC_RXBE_SIZE          dma_get_cache_alignment()
-#define        MPSC_RXB_SIZE           (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE)
-
-#define        MPSC_TXR_ENTRIES        32
-#define        MPSC_TXRE_SIZE          sizeof(mpsc_tx_desc_t)
-#define        MPSC_TXR_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE)
-#define        MPSC_TXBE_SIZE          dma_get_cache_alignment()
-#define        MPSC_TXB_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE)
-
-typedef struct {
-        u16   bufsize;
-       u16   bytecnt;
-        u32   cmdstat;
-        u32   link;
-        u32   buf_ptr;
-} mpsc_rx_desc_t __attribute((packed));
-
-/* Tx and Rx Ring entry descriptors */
-typedef struct {
-        u16   bytecnt;
-        u16   shadow;
-        u32   cmdstat;
-        u32   link;
-        u32   buf_ptr;
-} mpsc_tx_desc_t __attribute((packed));
-
-/* The main driver data structure */
-typedef struct {
-       struct uart_port        port;   /* Overlay uart_port structure */
-
-       /* Internal driver state for this ctlr */
-       u8                      ready;
-       u8                      rcv_data;
-       tcflag_t                c_iflag;        /* save termios->c_iflag */
-       tcflag_t                c_cflag;        /* save termios->c_cflag */
-
-       /* Info passed in from platform */
-       u8                      mirror_regs;    /* Need to mirror regs? */
-       u8                      cache_mgmt;     /* Need manual cache mgmt? */
-       u8                      brg_can_tune;   /* BRG has baud tuning? */
-       u32                     brg_clk_src;
-       u16                     mpsc_max_idle;
-       int                     default_baud;
-       int                     default_bits;
-       int                     default_parity;
-       int                     default_flow;
-
-       /* Physical addresses of various blocks of registers (from platform) */
-       u32                     mpsc_base_p;
-       u32                     mpsc_routing_base_p;
-       u32                     sdma_base_p;
-       u32                     sdma_intr_base_p;
-       u32                     brg_base_p;
-
-       /* Virtual addresses of various blocks of registers (from platform) */
-       u32                     mpsc_base;
-       u32                     mpsc_routing_base;
-       u32                     sdma_base;
-       u32                     sdma_intr_base;
-       u32                     brg_base;
-
-       /* Descriptor ring and buffer allocations */
-       void                    *desc_region;   /* Region for desc rings */
-       dma_addr_t              desc_region_p;
-       u32                     desc_region_size;
-
-       void                    *buf_region;    /* kmalloc region for bufs */
-       u32                     buf_region_size;
-
-       mpsc_rx_desc_t          *rxr;           /* Rx descriptor ring */
-       mpsc_rx_desc_t          *rxr_p;         /* Phys addr of rxr */
-       u32                     rxr_posn;       /* First desc w/ Rx data */
-       u8                      *rxb;           /* Rx Ring I/O buf */
-       dma_addr_t              rxb_p;          /* Phys addr of rxb */
-
-       mpsc_tx_desc_t          *txr;           /* Tx descriptor ring */
-       mpsc_tx_desc_t          *txr_p;         /* Phys addr of txr */
-       u32                     txr_posn;       /* First unused desc */
-       u8                      *txb;           /* Tx Ring I/O buf */
-       dma_addr_t              txb_p;          /* Phys addr of txb */
-
-       /* Mirrored values of regs we can't read (if 'mirror_regs' set) */
-       u32                     MPSC_CHR_1_m;
-       u32                     MPSC_CHR_2_m;
-       u32                     MPSC_CHR_10_m;
-       u32                     MPSC_MPCR_m;
-       u32                     MPSC_MRR_m;
-       u32                     MPSC_RCRR_m;
-       u32                     MPSC_TCRR_m;
-       u32                     SDMA_INTR_MASK_m;
-       u32                     BRG_BCR_m;
-} mpsc_port_info_t;
-
-/*
- * Some MPSC ctlrs have an erratum where they aren't supposed to access
- * cache coherent memory regions.  From practical experience, the erratum
- * is not triggered as long as there isn't a snoop hit.  Therefore, if
- * the MPSC in used has this erratum and coherency is enabled on the platform,
- * we must manually manage the cache for ring descriptors and the I/O buffers.
- */
-#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
-#define        MPSC_CACHE_FLUSH(pi, s, e) {                    \
-       if (pi->cache_mgmt) {                           \
-               /* 64x60 erratum: can't use dcbst/clean_dcache_range() */ \
-               flush_dcache_range((ulong)s, (ulong)e); \
-               mb();                                   \
-       }                                               \
-}
-
-#define        MPSC_CACHE_INVALIDATE(pi, s, e) {                       \
-       if (pi->cache_mgmt) {                                   \
-               invalidate_dcache_range((ulong)s, (ulong)e);    \
-               mb();                                           \
-       }                                                       \
-}
-
-#define        MPSC_CACHE_FLUSH_INVALIDATE(pi, s, e) {         \
-       if (pi->cache_mgmt) {                           \
-               flush_dcache_range((ulong)s, (ulong)e); \
-               mb();                                   \
-       }                                               \
-}
-#else
-#define        MPSC_CACHE_FLUSH(pi, s, e)
-#define        MPSC_CACHE_INVALIDATE(pi, s, e)
-#define        MPSC_CACHE_FLUSH_INVALIDATE(pi, s, e)
-#endif
-
-/*
- * 'MASK_INSERT' takes the low-order 'n' bits of 'i', shifts it 'b' bits to
- * the left, and inserts it into the target 't'.  The corresponding bits in
- * 't' will have been cleared before the bits in 'i' are inserted.
- */
-#ifdef CONFIG_PPC32
-#define MASK_INSERT(t, i, n, b) ({                             \
-       u32     rval = (t);                                     \
-        __asm__ __volatile__(                                  \
-               "rlwimi %0,%2,%4,32-(%3+%4),31-%4\n"            \
-               : "=r" (rval)                                   \
-               : "0" (rval), "r" (i), "i" (n), "i" (b));       \
-       rval;                                                   \
-})
-#else
-/* These macros are really just examples.  Feel free to change them --MAG */
-#define GEN_MASK(n, b)                 \
-({                                     \
-       u32     m, sl, sr;              \
-       sl = 32 - (n);                  \
-       sr = sl - (b);                  \
-       m = (0xffffffff << sl) >> sr;   \
-})
-
-#define MASK_INSERT(t, i, n, b)                \
-({                                     \
-       u32     m, rval = (t);          \
-       m = GEN_MASK((n), (b));         \
-       rval &= ~m;                     \
-       rval |= (((i) << (b)) & m);     \
-})
-#endif
-
-/* I/O macros for regs that you can read */
-#define        MPSC_READ(pi, unit, offset)     readl((pi)->unit##_base + (offset))
-#define        MPSC_WRITE(pi, unit, offset, v) writel(v, (pi)->unit##_base + (offset))
-#define        MPSC_MOD_FIELD(pi, unit, offset, num_bits, shift, val)  \
-{                                                              \
-       u32     v;                                              \
-       v = readl((pi)->unit##_base + (offset));                \
-       writel(MASK_INSERT(v,val,num_bits,shift), (pi)->unit##_base+(offset));\
-}
-
-#define        MPSC_READ_M(pi, unit, offset)                   \
-({                                                     \
-       u32     v;                                      \
-       if ((pi)->mirror_regs) v = (pi)->offset##_m;    \
-       else v = readl((pi)->unit##_base + (offset));   \
-       v;                                              \
-})
-
-#define        MPSC_WRITE_M(pi, unit, offset, v)               \
-({                                                     \
-       if ((pi)->mirror_regs) (pi)->offset##_m = v;    \
-       writel(v, (pi)->unit##_base + (offset));        \
-})
-
-#define        MPSC_MOD_FIELD_M(pi, unit, offset, num_bits, shift, val)        \
-({                                                                     \
-       u32     v;                                                      \
-       if ((pi)->mirror_regs) v = (pi)->offset##_m;                    \
-       else v = readl((pi)->unit##_base + (offset));                   \
-       v = MASK_INSERT(v, val, num_bits, shift);                       \
-       if ((pi)->mirror_regs) (pi)->offset##_m = v;                    \
-       writel(v, (pi)->unit##_base + (offset));                        \
-})
-
-#if !defined(MIN)
-#define        MIN(a, b)       (((a) < (b)) ? (a) : (b))
-#endif
-
-/* Hooks to platform-specific code */
-int mpsc_platform_register_driver(void);
-void mpsc_platform_unregister_driver(void);
-
-/* Hooks back in to mpsc common to be called by platform-specific code */
-mpsc_port_info_t *mpsc_device_probe(int index);
-mpsc_port_info_t *mpsc_device_remove(int index);
-
-#endif /* __MPSC_H__ */
diff --git a/drivers/serial/mpsc/mpsc_defs.h b/drivers/serial/mpsc/mpsc_defs.h
deleted file mode 100644 (file)
index 7bf095a..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * drivers/serial/mpsc/mpsc_defs.h
- * 
- * Register definitions for the Marvell Multi-Protocol Serial Controller (MPSC),
- * Serial DMA Controller (SDMA), and Baud Rate Generator (BRG).
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#ifndef        __MPSC_DEFS_H__
-#define        __MPSC_DEFS_H__
-
-#define        MPSC_NUM_CTLRS          2
-
-
-/*
- *****************************************************************************
- *
- *     Multi-Protocol Serial Controller Interface Registers
- *
- *****************************************************************************
- */
-
-/* Main Configuratino Register Offsets */
-#define        MPSC_MMCRL                      0x0000
-#define        MPSC_MMCRH                      0x0004
-#define        MPSC_MPCR                       0x0008
-#define        MPSC_CHR_1                      0x000c
-#define        MPSC_CHR_2                      0x0010
-#define        MPSC_CHR_3                      0x0014
-#define        MPSC_CHR_4                      0x0018
-#define        MPSC_CHR_5                      0x001c
-#define        MPSC_CHR_6                      0x0020
-#define        MPSC_CHR_7                      0x0024
-#define        MPSC_CHR_8                      0x0028
-#define        MPSC_CHR_9                      0x002c
-#define        MPSC_CHR_10                     0x0030
-#define        MPSC_CHR_11                     0x0034
-#define        MPSC_REG_BLOCK_SIZE             0x0038
-
-
-#define        MPSC_MPCR_CL_5                  0
-#define        MPSC_MPCR_CL_6                  1
-#define        MPSC_MPCR_CL_7                  2
-#define        MPSC_MPCR_CL_8                  3
-#define        MPSC_MPCR_SBL_1                 0
-#define        MPSC_MPCR_SBL_2                 3
-
-#define        MPSC_CHR_2_TEV                  (1<<1)
-#define        MPSC_CHR_2_TA                   (1<<7)
-#define        MPSC_CHR_2_TTCS                 (1<<9)
-#define        MPSC_CHR_2_REV                  (1<<17)
-#define        MPSC_CHR_2_RA                   (1<<23)
-#define        MPSC_CHR_2_CRD                  (1<<25)
-#define        MPSC_CHR_2_EH                   (1<<31)
-#define        MPSC_CHR_2_PAR_ODD              0
-#define        MPSC_CHR_2_PAR_SPACE            1
-#define        MPSC_CHR_2_PAR_EVEN             2
-#define        MPSC_CHR_2_PAR_MARK             3
-
-/* MPSC Signal Routing */
-#define        MPSC_MRR                        0x0000
-#define        MPSC_RCRR                       0x0004
-#define        MPSC_TCRR                       0x0008
-#define        MPSC_ROUTING_REG_BLOCK_SIZE     0x000c
-
-/*
- *****************************************************************************
- *
- *     Serial DMA Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        SDMA_SDC                        0x0000
-#define        SDMA_SDCM                       0x0008
-#define        SDMA_RX_DESC                    0x0800
-#define        SDMA_RX_BUF_PTR                 0x0808
-#define        SDMA_SCRDP                      0x0810
-#define        SDMA_TX_DESC                    0x0c00
-#define        SDMA_SCTDP                      0x0c10
-#define        SDMA_SFTDP                      0x0c14
-#define        SDMA_REG_BLOCK_SIZE             0x0c18
-
-#define        SDMA_DESC_CMDSTAT_PE            (1<<0)
-#define        SDMA_DESC_CMDSTAT_CDL           (1<<1)
-#define        SDMA_DESC_CMDSTAT_FR            (1<<3)
-#define        SDMA_DESC_CMDSTAT_OR            (1<<6)
-#define        SDMA_DESC_CMDSTAT_BR            (1<<9)
-#define        SDMA_DESC_CMDSTAT_MI            (1<<10)
-#define        SDMA_DESC_CMDSTAT_A             (1<<11)
-#define        SDMA_DESC_CMDSTAT_AM            (1<<12)
-#define        SDMA_DESC_CMDSTAT_CT            (1<<13)
-#define        SDMA_DESC_CMDSTAT_C             (1<<14)
-#define        SDMA_DESC_CMDSTAT_ES            (1<<15)
-#define        SDMA_DESC_CMDSTAT_L             (1<<16)
-#define        SDMA_DESC_CMDSTAT_F             (1<<17)
-#define        SDMA_DESC_CMDSTAT_P             (1<<18)
-#define        SDMA_DESC_CMDSTAT_EI            (1<<23)
-#define        SDMA_DESC_CMDSTAT_O             (1<<31)
-
-#define SDMA_DESC_DFLT                 (SDMA_DESC_CMDSTAT_O |  \
-                                       SDMA_DESC_CMDSTAT_EI)
-
-#define        SDMA_SDC_RFT                    (1<<0)
-#define        SDMA_SDC_SFM                    (1<<1)
-#define        SDMA_SDC_BLMR                   (1<<6)
-#define        SDMA_SDC_BLMT                   (1<<7)
-#define        SDMA_SDC_POVR                   (1<<8)
-#define        SDMA_SDC_RIFB                   (1<<9)
-
-#define        SDMA_SDCM_ERD                   (1<<7)
-#define        SDMA_SDCM_AR                    (1<<15)
-#define        SDMA_SDCM_STD                   (1<<16)
-#define        SDMA_SDCM_TXD                   (1<<23)
-#define        SDMA_SDCM_AT                    (1<<31)
-
-#define        SDMA_0_CAUSE_RXBUF              (1<<0)
-#define        SDMA_0_CAUSE_RXERR              (1<<1)
-#define        SDMA_0_CAUSE_TXBUF              (1<<2)
-#define        SDMA_0_CAUSE_TXEND              (1<<3)
-#define        SDMA_1_CAUSE_RXBUF              (1<<8)
-#define        SDMA_1_CAUSE_RXERR              (1<<9)
-#define        SDMA_1_CAUSE_TXBUF              (1<<10)
-#define        SDMA_1_CAUSE_TXEND              (1<<11)
-
-#define        SDMA_CAUSE_RX_MASK      (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \
-       SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
-#define        SDMA_CAUSE_TX_MASK      (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \
-       SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
-
-/* SDMA Interrupt registers */
-#define        SDMA_INTR_CAUSE                 0x0000
-#define        SDMA_INTR_MASK                  0x0080
-#define        SDMA_INTR_REG_BLOCK_SIZE        0x0084
-
-/*
- *****************************************************************************
- *
- *     Baud Rate Generator Interface Registers
- *
- *****************************************************************************
- */
-
-#define        BRG_BCR                         0x0000
-#define        BRG_BTR                         0x0004
-#define        BRG_REG_BLOCK_SIZE              0x0008
-
-#endif /*__MPSC_DEFS_H__ */
diff --git a/drivers/serial/mpsc/mpsc_ppc32.c b/drivers/serial/mpsc/mpsc_ppc32.c
deleted file mode 100644 (file)
index 53b1dd4..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * drivers/serial/mpsc/mpsc_ppc32.c
- *
- * Middle layer that sucks data from the ppc32 OCP--that is, chip &
- * platform-specific data--and puts it into the mpsc_port_info_t structure
- * for the mpsc driver to use.
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2004 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#include "mpsc.h"
-#include <asm/ocp.h>
-#include <asm/mv64x60.h>
-
-static void mpsc_ocp_remove(struct ocp_device *ocpdev);
-
-static int
-mpsc_ocp_probe(struct ocp_device *ocpdev)
-{
-       mpsc_port_info_t        *pi;
-       mv64x60_ocp_mpsc_data_t *dp;
-       u32                     base;
-       int                     rc = -ENODEV;
-
-       if ((pi = mpsc_device_probe(ocpdev->def->index)) != NULL) {
-               dp = (mv64x60_ocp_mpsc_data_t *)ocpdev->def->additions;
-
-               pi->mpsc_base_p = ocpdev->def->paddr;
-
-               if (ocpdev->def->index == 0) {
-                       base = pi->mpsc_base_p - MV64x60_MPSC_0_OFFSET;
-                       pi->sdma_base_p = base + MV64x60_SDMA_0_OFFSET;
-                       pi->brg_base_p = base + MV64x60_BRG_0_OFFSET;
-               }
-               else { /* Must be 1 */
-                       base = pi->mpsc_base_p - MV64x60_MPSC_1_OFFSET;
-                       pi->sdma_base_p = base + MV64x60_SDMA_1_OFFSET;
-                       pi->brg_base_p = base + MV64x60_BRG_1_OFFSET;
-               }
-
-               pi->mpsc_routing_base_p = base + MV64x60_MPSC_ROUTING_OFFSET;
-               pi->sdma_intr_base_p = base + MV64x60_SDMA_INTR_OFFSET;
-
-               pi->port.irq = dp->sdma_irq;
-               pi->port.uartclk = dp->brg_clk_freq;
-
-               pi->mirror_regs = dp->mirror_regs;
-               pi->cache_mgmt = dp->cache_mgmt;
-               pi->brg_can_tune = dp->brg_can_tune;
-               pi->brg_clk_src = dp->brg_clk_src;
-               pi->mpsc_max_idle = dp->max_idle;
-               pi->default_baud = dp->default_baud;
-               pi->default_bits = dp->default_bits;
-               pi->default_parity = dp->default_parity;
-               pi->default_flow = dp->default_flow;
-
-               /* Initial values of mirrored regs */
-               pi->MPSC_CHR_1_m = dp->chr_1_val;
-               pi->MPSC_CHR_2_m = dp->chr_2_val;
-               pi->MPSC_CHR_10_m = dp->chr_10_val;
-               pi->MPSC_MPCR_m = dp->mpcr_val;
-               pi->MPSC_MRR_m = dp->mrr_val;
-               pi->MPSC_RCRR_m = dp->rcrr_val;
-               pi->MPSC_TCRR_m = dp->tcrr_val;
-               pi->SDMA_INTR_MASK_m = dp->intr_mask_val;
-               pi->BRG_BCR_m = dp->bcr_val;
-
-               pi->port.iotype = UPIO_MEM;
-
-               rc = 0;
-       }
-
-       return rc;
-}
-
-static void
-mpsc_ocp_remove(struct ocp_device *ocpdev)
-{
-       (void)mpsc_device_remove(ocpdev->def->index);
-       return;
-}
-
-static struct ocp_device_id mpsc_ocp_ids[] = {
-       {.vendor = OCP_VENDOR_MARVELL, .function = OCP_FUNC_MPSC},
-       {.vendor = OCP_VENDOR_INVALID}
-};
-
-static struct ocp_driver mpsc_ocp_driver = {
-       .name = "mpsc",
-       .id_table = mpsc_ocp_ids,
-       .probe = mpsc_ocp_probe,
-       .remove = mpsc_ocp_remove,
-};
-
-int
-mpsc_platform_register_driver(void)
-{
-       return ocp_register_driver(&mpsc_ocp_driver);
-}
-
-void
-mpsc_platform_unregister_driver(void)
-{
-       ocp_unregister_driver(&mpsc_ocp_driver);
-       return;
-}
index fca52e6..7258659 100644 (file)
@@ -245,7 +245,7 @@ static struct tty_struct *pmz_receive_chars(struct uart_pmac_port *uap,
                        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
                                drop = 1;
                        if (ZS_IS_ASLEEP(uap))
-                               return 0;
+                               return NULL;
                        if (!ZS_IS_OPEN(uap))
                                goto retry;
                }
@@ -1433,6 +1433,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
                        ioremap(np->addrs[np->n_addrs - 1].address, 0x1000);
                if (uap->rx_dma_regs == NULL) { 
                        iounmap((void *)uap->tx_dma_regs);
+                       uap->tx_dma_regs = NULL;
                        uap->flags &= ~PMACZILOG_FLAG_HAS_DMA;
                        goto no_dma;
                }
@@ -1490,7 +1491,6 @@ no_dma:
        uap->port.ops = &pmz_pops;
        uap->port.type = PORT_PMAC_ZILOG;
        uap->port.flags = 0;
-       spin_lock_init(&uap->port.lock);
 
        /* Setup some valid baud rate information in the register
         * shadows so we don't write crap there before baud rate is
@@ -1508,10 +1508,13 @@ static void pmz_dispose_port(struct uart_pmac_port *uap)
 {
        struct device_node *np;
 
-       iounmap((void *)uap->control_reg);
        np = uap->node;
+       iounmap((void *)uap->rx_dma_regs);
+       iounmap((void *)uap->tx_dma_regs);
+       iounmap((void *)uap->control_reg);
        uap->node = NULL;
        of_node_put(np);
+       memset(uap, 0, sizeof(struct uart_pmac_port));
 }
 
 /*
@@ -1798,7 +1801,7 @@ static int __init pmz_register(void)
         * Register this driver with the serial core
         */
        rc = uart_register_driver(&pmz_uart_reg);
-       if (rc != 0)
+       if (rc)
                return rc;
 
        /*
@@ -1808,10 +1811,19 @@ static int __init pmz_register(void)
                struct uart_pmac_port *uport = &pmz_ports[i];
                /* NULL node may happen on wallstreet */
                if (uport->node != NULL)
-                       uart_add_one_port(&pmz_uart_reg, &uport->port);
+                       rc = uart_add_one_port(&pmz_uart_reg, &uport->port);
+               if (rc)
+                       goto err_out;
        }
 
        return 0;
+err_out:
+       while (i-- > 0) {
+               struct uart_pmac_port *uport = &pmz_ports[i];
+               uart_remove_one_port(&pmz_uart_reg, &uport->port);
+       }
+       uart_unregister_driver(&pmz_uart_reg);
+       return rc;
 }
 
 static struct of_match pmz_match[] = 
@@ -1841,6 +1853,7 @@ static struct macio_driver pmz_driver =
 
 static int __init init_pmz(void)
 {
+       int rc, i;
        printk(KERN_INFO "%s\n", version);
 
        /* 
@@ -1862,7 +1875,16 @@ static int __init init_pmz(void)
        /*
         * Now we register with the serial layer
         */
-       pmz_register();
+       rc = pmz_register();
+       if (rc) {
+               printk(KERN_ERR 
+                       "pmac_zilog: Error registering serial device, disabling pmac_zilog.\n"
+                       "pmac_zilog: Did another serial driver already claim the minors?\n"); 
+               /* effectively "pmz_unprobe()" */
+               for (i=0; i < pmz_ports_count; i++)
+                       pmz_dispose_port(&pmz_ports[i]);
+               return rc;
+       }
        
        /*
         * Then we register the macio driver itself
index d72a7aa..0258651 100644 (file)
@@ -1045,7 +1045,7 @@ static void sunsu_autoconfig(struct uart_sunsu_port *up)
 {
        unsigned char status1, status2, scratch, scratch2, scratch3;
        unsigned char save_lcr, save_mcr;
-       struct linux_ebus_device *dev = 0;
+       struct linux_ebus_device *dev = NULL;
        struct linux_ebus *ebus;
 #ifdef CONFIG_SPARC64
        struct sparc_isa_bridge *isa_br;
index 648bbb0..42f60fa 100644 (file)
@@ -1974,7 +1974,7 @@ static int usb_audio_open_mixdev(struct inode *inode, struct file *file)
        s->count++;
 
        up(&open_sem);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_audio_release_mixdev(struct inode *inode, struct file *file)
@@ -2147,8 +2147,6 @@ static ssize_t usb_audio_read(struct file *file, char __user *buffer, size_t cou
        unsigned int ptr;
        int cnt, err;
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (as->usbin.dma.mapped)
                return -ENXIO;
        if (!as->usbin.dma.ready && (ret = prog_dmabuf_in(as)))
@@ -2216,8 +2214,6 @@ static ssize_t usb_audio_write(struct file *file, const char __user *buffer, siz
        unsigned int start_thr;
        int cnt, err;
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (as->usbout.dma.mapped)
                return -ENXIO;
        if (!as->usbout.dma.ready && (ret = prog_dmabuf_out(as)))
@@ -2688,7 +2684,7 @@ static int usb_audio_open(struct inode *inode, struct file *file)
        as->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
        s->count++;
        up(&open_sem);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int usb_audio_release(struct inode *inode, struct file *file)
index 0223d3c..6a6dbac 100644 (file)
@@ -646,9 +646,6 @@ static ssize_t usb_midi_read(struct file *file, char __user *buffer, size_t coun
        ssize_t ret;
        DECLARE_WAITQUEUE(wait, current);
 
-       if ( ppos != &file->f_pos ) {
-               return -ESPIPE;
-       }
        if ( !access_ok(VERIFY_READ, buffer, count) ) {
                return -EFAULT;
        }
@@ -728,9 +725,6 @@ static ssize_t usb_midi_write(struct file *file, const char __user *buffer, size
        ssize_t ret;
        unsigned long int flags;
 
-       if ( ppos != &file->f_pos ) {
-               return -ESPIPE;
-       }
        if ( !access_ok(VERIFY_READ, buffer, count) ) {
                return -EFAULT;
        }
@@ -920,7 +914,7 @@ static int usb_midi_open(struct inode *inode, struct file *file)
        printk(KERN_INFO "usb-midi: Open Succeeded. minor= %d.\n", minor);
 #endif
 
-       return 0; /** Success. **/
+       return nonseekable_open(inode, file); /** Success. **/
 }
 
 
index f817a8c..b13fe40 100644 (file)
@@ -1253,8 +1253,8 @@ int usb_resume_device(struct usb_device *udev)
        return 0;
 }
 
-#define        hub_suspend             0
-#define        hub_resume              0
+#define        hub_suspend             NULL
+#define        hub_resume              NULL
 #define        remote_wakeup(x)        0
 
 #endif /* CONFIG_USB_SUSPEND */
index 676726a..1cd445a 100644 (file)
@@ -1323,11 +1323,15 @@ int rndis_proc_read (char *page, char **start, off_t off, int count, int *eof,
 int rndis_proc_write (struct file *file, const char __user *buffer, 
                      unsigned long count, void *data)
 {
+       rndis_params *p = data;
        u32 speed = 0;
        int i, fl_speed = 0;
        
        for (i = 0; i < count; i++) {
-               switch (*buffer) {
+               char c;
+               if (get_user(c, buffer))
+                       return -EFAULT;
+               switch (c) {
                case '0':
                case '1':
                case '2':
@@ -1339,21 +1343,19 @@ int rndis_proc_write (struct file *file, const char __user *buffer,
                case '8':
                case '9':
                        fl_speed = 1;
-                       speed = speed*10 + *buffer - '0';
+                       speed = speed*10 + c - '0';
                        break;
                case 'C':
                case 'c':
-                       rndis_signal_connect (((rndis_params *) data)
-                               ->confignr);
+                       rndis_signal_connect (p->confignr);
                        break;
                case 'D':
                case 'd':
-                       rndis_signal_disconnect (((rndis_params *) data)
-                               ->confignr);
+                       rndis_signal_disconnect(p->confignr);
                        break;
                default: 
-                       if (fl_speed) ((rndis_params *) data)->speed = speed;
-                       else DEBUG ("%c is not valid\n", *buffer);
+                       if (fl_speed) p->speed = speed;
+                       else DEBUG ("%c is not valid\n", c);
                        break;
                }
                
index 133e50c..a0721d0 100644 (file)
@@ -571,22 +571,7 @@ static ssize_t uhci_proc_read(struct file *file, char __user *buf,
                                size_t nbytes, loff_t *ppos)
 {
        struct uhci_proc *up = file->private_data;
-       unsigned int pos;
-       unsigned int size;
-
-       pos = *ppos;
-       size = up->size;
-       if (pos >= size)
-               return 0;
-       if (nbytes > size - pos)
-               nbytes = size - pos;
-
-       if (copy_to_user(buf, up->data + pos, nbytes))
-               return -EFAULT;
-
-       *ppos += nbytes;
-
-       return nbytes;
+       return simple_read_from_buffer(buf, nbytes, ppos, up->data, up->size);
 }
 
 static int uhci_proc_release(struct inode *inode, struct file *file)
index 2c021bf..01f77cb 100644 (file)
@@ -616,7 +616,7 @@ static int dabusb_open (struct inode *inode, struct file *file)
        file->f_pos = 0;
        file->private_data = s;
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int dabusb_release (struct inode *inode, struct file *file)
index 51a39a3..529a2de 100644 (file)
@@ -16,7 +16,7 @@
  * Based on the Linux CPiA driver written by Peter Pregler,
  * Scott J. Bertin and Johannes Erdfelt.
  * 
- * Please see the file: linux/Documentation/usb/ov511.txt 
+ * Please see the file: Documentation/usb/ov511.txt
  * and the website at:  http://alpha.dyndns.org/ov511
  * for more info.
  *
index b98f17f..f3a70b2 100644 (file)
@@ -1150,7 +1150,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
        DECLARE_WAITQUEUE(wait, current);
         int bytes_to_read;
 
-       Trace(TRACE_READ, "video_read(0x%p, %p, %d) called.\n", vdev, buf, count);
+       Trace(TRACE_READ, "video_read(0x%p, %p, %zd) called.\n", vdev, buf, count);
        if (vdev == NULL)
                return -EFAULT;
        pdev = vdev->priv;
index 3a61a0b..310c5a9 100644 (file)
@@ -1435,7 +1435,7 @@ static int auerchar_open (struct inode *inode, struct file *file)
        /* file IO stuff */
        file->f_pos = 0;
        file->private_data = ccp;
-       return 0;
+       return nonseekable_open(inode, file);
 
        /* Error exit */
 ofail: up (&cp->mutex);
index 8e266eb..cd7b548 100644 (file)
@@ -344,6 +344,7 @@ static int tower_open (struct inode *inode, struct file *file)
 
        dbg(2, "%s: enter", __FUNCTION__);
 
+       nonseekable_open(inode, file);
        subminor = iminor(inode);
 
        down (&disconnect_sem);
index 471873b..cdf5919 100644 (file)
@@ -10,7 +10,7 @@
  *
  * Based on dabusb.c, printer.c & scanner.c
  *
- * Please see the file: linux/Documentation/usb/SilverLink.txt
+ * Please see the file: Documentation/usb/silverlink.txt
  * and the website at:  http://lpg.ticalc.org/prj_usb/
  * for more info.
  *
@@ -132,7 +132,7 @@ tiglusb_open (struct inode *inode, struct file *filp)
        filp->f_pos = 0;
        filp->private_data = s;
 
-       return 0;
+       return nonseekable_open(inode, filp);
 }
 
 static int
index d80e806..798ba00 100644 (file)
@@ -40,7 +40,7 @@ config FB
 
 config FB_CIRRUS
        tristate "Cirrus Logic support"
-       depends on FB && (AMIGA || PCI)
+       depends on FB && (ZORRO || PCI)
        ---help---
          This enables support for Cirrus Logic GD542x/543x based boards on
          Amiga: SD64, Piccolo, Picasso II/II+, Picasso IV, or EGS Spectrum.
@@ -93,7 +93,7 @@ config FB_SA1100
 
 config FB_CYBER2000
        tristate "CyberPro 2000/2010/5000 support"
-       depends on FB && PCI
+       depends on FB && PCI && (BROKEN || !SPARC64)
        help
          This enables support for the Integraphics CyberPro 20x0 and 5000
          VGA chips used in the Rebel.com Netwinder and other machines.
@@ -238,7 +238,7 @@ config FB_IMSTT
 
 config FB_S3TRIO
        bool "S3 Trio display support"
-       depends on FB && PPC
+       depends on FB && PPC && BROKEN
        help
          If you have a S3 Trio say Y. Say N for S3 Virge.
 
@@ -446,6 +446,15 @@ config FB_RIVA_I2C
          independently validate video mode parameters, you should say Y
          here.
 
+config FB_RIVA_DEBUG
+       bool "Lots of debug output from Riva(nVidia) driver"
+       depends on FB_RIVA
+       default n
+       help
+         Say Y here if you want the Riva driver to output all sorts
+         of debugging informations to provide to the maintainer when
+         something goes wrong.
+
 config FB_I810
        tristate "Intel 810/815 support (EXPERIMENTAL)"
        depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI        
index 5e7c2d2..37177be 100644 (file)
@@ -1037,7 +1037,7 @@ static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd,
                fbtyp.fb_cmsize = info->cmap.len;
                fbtyp.fb_size = info->fix.smem_len;
                if (copy_to_user
-                   ((struct fbtype *) arg, &fbtyp, sizeof(fbtyp)))
+                   ((struct fbtype __user *) arg, &fbtyp, sizeof(fbtyp)))
                        return -EFAULT;
                break;
 #endif                         /* __sparc__ */
@@ -1405,7 +1405,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
                case PBOOK_SLEEP_REJECT:
                        if (par->save_framebuffer) {
                                vfree(par->save_framebuffer);
-                               par->save_framebuffer = 0;
+                               par->save_framebuffer = NULL;
                        }
                        break;
                case PBOOK_SLEEP_NOW:
@@ -1435,7 +1435,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
                                memcpy_toio((void *) info->screen_base,
                                            par->save_framebuffer, nb);
                                vfree(par->save_framebuffer);
-                               par->save_framebuffer = 0;
+                               par->save_framebuffer = NULL;
                        }
                        /* Restore display */
                        atyfb_set_par(info);
index a782198..acec888 100644 (file)
@@ -386,7 +386,7 @@ static int __devinit radeon_map_ROM(struct radeonfb_info *rinfo, struct pci_dev
        return -ENXIO;
 }
 
-#ifdef __i386__
+#ifdef CONFIG_X86
 static int  __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo)
 {
        /* I simplified this code as we used to miss the signatures in
@@ -415,7 +415,7 @@ static int  __devinit radeon_find_mem_vbios(struct radeonfb_info *rinfo)
 
        return 0;
 }
-#endif /* __i386__ */
+#endif
 
 #ifdef CONFIG_PPC_OF
 /*
@@ -432,7 +432,7 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
                printk(KERN_WARNING "radeonfb: Cannot match card to OF node !\n");
                return -ENODEV;
        }
-       val = (u32 *) get_property(dp, "ATY,RefCLK", 0);
+       val = (u32 *) get_property(dp, "ATY,RefCLK", NULL);
        if (!val || !*val) {
                printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n");
                return -EINVAL;
@@ -440,11 +440,11 @@ static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo)
 
        rinfo->pll.ref_clk = (*val) / 10;
 
-       val = (u32 *) get_property(dp, "ATY,SCLK", 0);
+       val = (u32 *) get_property(dp, "ATY,SCLK", NULL);
        if (val && *val)
                rinfo->pll.sclk = (*val) / 10;
 
-       val = (u32 *) get_property(dp, "ATY,MCLK", 0);
+       val = (u32 *) get_property(dp, "ATY,MCLK", NULL);
        if (val && *val)
                rinfo->pll.mclk = (*val) / 10;
 
@@ -2282,13 +2282,13 @@ static int radeonfb_pci_register (struct pci_dev *pdev,
        /*
         * On x86, the primary display on laptop may have it's BIOS
         * ROM elsewhere, try to locate it at the legacy memory hole.
-        * We probably need to make sure this is the primary dispay,
+        * We probably need to make sure this is the primary display,
         * but that is difficult without some arch support.
         */
-#ifdef __i386__
+#ifdef CONFIG_X86
        if (rinfo->bios_seg == NULL)
                radeon_find_mem_vbios(rinfo);
-#endif /* __i386__ */
+#endif
 
        /* If both above failed, try the BIOS ROM again for mobility
         * chips
index 9ab6811..c26f43c 100644 (file)
@@ -922,7 +922,7 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
        /* Restore display & engine */
        radeonfb_set_par(info);
        fb_pan_display(info, &info->var);
-       fb_set_cmap(&info->cmap, 1, info);
+       fb_set_cmap(&info->cmap, info);
 
        /* Refresh */
        fb_set_suspend(info, 0);
index adcb451..82c26b1 100644 (file)
@@ -5,8 +5,8 @@
  *
  * Contributors (thanks, all!)
  *
- *     David Eger:
- *     Overhaul for Linux 2.6
+ *     David Eger:
+ *     Overhaul for Linux 2.6
  *
  *      Jeff Rugen:
  *      Major contributions;  Motorola PowerStack (PPC and PCI) support,
@@ -145,9 +145,6 @@ typedef enum {
  * a run-time table?
  */
 static const struct cirrusfb_board_info_rec {
-       cirrusfb_board_t btype; /* chipset enum, not strictly necessary, as
-                                * cirrusfb_board_info[] is directly indexed
-                                * by this value */
        char *name;             /* ASCII name of chipset */
        long maxclock[5];               /* maximum video clock */
        /* for  1/4bpp, 8bpp 15/16bpp, 24bpp, 32bpp - numbers from xorg code */
@@ -164,104 +161,115 @@ static const struct cirrusfb_board_info_rec {
 
        unsigned char sr1f;     /* SR1F VGA initial register value */
 } cirrusfb_board_info[] = {
-       { BT_NONE, }, /* dummy record */
-       { BT_SD64,
-               "CL SD64",
-               { 140000, 140000, 140000, 140000, 140000, },    /* guess */
-               /* the SD64/P4 have a higher max. videoclock */
-               TRUE,
-               TRUE,
-               TRUE,
-               0xF0,
-               0xF0,
-               0,              /* unused, does not multiplex */
-               0xF1,
-               0,              /* unused, does not multiplex */
-               0x20 },
-       { BT_PICCOLO,
-               "CL Piccolo",
-               { 90000, 90000, 90000, 90000, 90000 },  /* guess */
-               TRUE,
-               TRUE,
-               FALSE,
-               0x80,
-               0x80,
-               0,              /* unused, does not multiplex */
-               0x81,
-               0,              /* unused, does not multiplex */
-               0x22 },
-       { BT_PICASSO,
-               "CL Picasso",
-               { 90000, 90000, 90000, 90000, 90000, }, /* guess */
-               TRUE,
-               TRUE,
-               FALSE,
-               0x20,
-               0x20,
-               0,              /* unused, does not multiplex */
-               0x21,
-               0,              /* unused, does not multiplex */
-               0x22 },
-       { BT_SPECTRUM,
-               "CL Spectrum",
-               { 90000, 90000, 90000, 90000, 90000, }, /* guess */
-               TRUE,
-               TRUE,
-               FALSE,
-               0x80,
-               0x80,
-               0,              /* unused, does not multiplex */
-               0x81,
-               0,              /* unused, does not multiplex */
-               0x22 },
-       { BT_PICASSO4,
-               "CL Picasso4",
-               { 135100, 135100, 85500, 85500, 0 },
-               TRUE,
-               FALSE,
-               TRUE,
-               0x20,
-               0x20,
-               0,              /* unused, does not multiplex */
-               0x21,
-               0,              /* unused, does not multiplex */
-               0 },
-       { BT_ALPINE,
-               "CL Alpine",
-               { 85500, 85500, 50000, 28500, 0}, /* for the GD5430.  GD5446 can do more... */
-               TRUE,
-               TRUE,
-               TRUE,
-               0xA0,
-               0xA1,
-               0xA7,
-               0xA1,
-               0xA7,
-               0x1C },
-       { BT_GD5480,
-               "CL GD5480",
-               { 135100, 200000, 200000, 135100, 135100 },
-               TRUE,
-               TRUE,
-               TRUE,
-               0x10,
-               0x11,
-               0,              /* unused, does not multiplex */
-               0x11,
-               0,              /* unused, does not multiplex */
-               0x1C },
-       { BT_LAGUNA,
-               "CL Laguna",
-               { 135100, 135100, 135100, 135100, 135100, }, /* guess */
-               FALSE,
-               FALSE,
-               TRUE,
-               0,              /* unused */
-               0,              /* unused */
-               0,              /* unused */
-               0,              /* unused */
-               0,              /* unused */
-               0 },            /* unused */
+       [BT_SD64] = {
+               .name                   = "CL SD64",
+               .maxclock               = {
+                       /* guess */
+                       /* the SD64/P4 have a higher max. videoclock */
+                       140000, 140000, 140000, 140000, 140000,
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = TRUE,
+               .sr07                   = 0xF0,
+               .sr07_1bpp              = 0xF0,
+               .sr07_8bpp              = 0xF1,
+               .sr1f                   = 0x20
+       },
+       [BT_PICCOLO] = {
+               .name                   = "CL Piccolo",
+               .maxclock               = {
+                       /* guess */
+                       90000, 90000, 90000, 90000, 90000
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = FALSE,
+               .sr07                   = 0x80,
+               .sr07_1bpp              = 0x80,
+               .sr07_8bpp              = 0x81,
+               .sr1f                   = 0x22
+       },
+       [BT_PICASSO] = {
+               .name                   = "CL Picasso",
+               .maxclock               = {
+                       /* guess */
+                       90000, 90000, 90000, 90000, 90000
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = FALSE,
+               .sr07                   = 0x20,
+               .sr07_1bpp              = 0x20,
+               .sr07_8bpp              = 0x21,
+               .sr1f                   = 0x22
+       },
+       [BT_SPECTRUM] = {
+               .name                   = "CL Spectrum",
+               .maxclock               = {
+                       /* guess */
+                       90000, 90000, 90000, 90000, 90000
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = FALSE,
+               .sr07                   = 0x80,
+               .sr07_1bpp              = 0x80,
+               .sr07_8bpp              = 0x81,
+               .sr1f                   = 0x22
+       },
+       [BT_PICASSO4] = {
+               .name                   = "CL Picasso4",
+               .maxclock               = {
+                       135100, 135100, 85500, 85500, 0
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = FALSE,
+               .scrn_start_bit19       = TRUE,
+               .sr07                   = 0x20,
+               .sr07_1bpp              = 0x20,
+               .sr07_8bpp              = 0x21,
+               .sr1f                   = 0
+       },
+       [BT_ALPINE] = {
+               .name                   = "CL Alpine",
+               .maxclock               = {
+                       /* for the GD5430.  GD5446 can do more... */
+                       85500, 85500, 50000, 28500, 0
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = TRUE,
+               .sr07                   = 0xA0,
+               .sr07_1bpp              = 0xA1,
+               .sr07_1bpp_mux          = 0xA7,
+               .sr07_8bpp              = 0xA1,
+               .sr07_8bpp_mux          = 0xA7,
+               .sr1f                   = 0x1C
+       },
+       [BT_GD5480] = {
+               .name                   = "CL GD5480",
+               .maxclock               = {
+                       135100, 200000, 200000, 135100, 135100
+               },
+               .init_sr07              = TRUE,
+               .init_sr1f              = TRUE,
+               .scrn_start_bit19       = TRUE,
+               .sr07                   = 0x10,
+               .sr07_1bpp              = 0x11,
+               .sr07_8bpp              = 0x11,
+               .sr1f                   = 0x1C
+       },
+       [BT_LAGUNA] = {
+               .name                   = "CL Laguna",
+               .maxclock               = {
+                       /* guess */
+                       135100, 135100, 135100, 135100, 135100,
+               },
+               .init_sr07              = FALSE,
+               .init_sr1f              = FALSE,
+               .scrn_start_bit19       = TRUE,
+       }
 };
 
 
@@ -270,12 +278,12 @@ static const struct cirrusfb_board_info_rec {
        { PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_##id, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (btype) }
 
 static struct pci_device_id cirrusfb_pci_table[] = {
-       CHIP( CIRRUS_5436,      BT_ALPINE ),
-       CHIP( CIRRUS_5434_8,    BT_ALPINE ),
-       CHIP( CIRRUS_5434_4,    BT_ALPINE ),
-       CHIP( CIRRUS_5430,      BT_ALPINE ), /* GD-5440 has identical id */
-       CHIP( CIRRUS_7543,      BT_ALPINE ),
-       CHIP( CIRRUS_7548,      BT_ALPINE ),
+       CHIP( CIRRUS_5436,      BT_ALPINE ),
+       CHIP( CIRRUS_5434_8,    BT_ALPINE ),
+       CHIP( CIRRUS_5434_4,    BT_ALPINE ),
+       CHIP( CIRRUS_5430,      BT_ALPINE ), /* GD-5440 has identical id */
+       CHIP( CIRRUS_7543,      BT_ALPINE ),
+       CHIP( CIRRUS_7548,      BT_ALPINE ),
        CHIP( CIRRUS_5480,      BT_GD5480 ), /* MacPicasso probably */
        CHIP( CIRRUS_5446,      BT_PICASSO4 ), /* Picasso 4 is a GD5446 */
        CHIP( CIRRUS_5462,      BT_LAGUNA ), /* CL Laguna */
@@ -289,31 +297,50 @@ MODULE_DEVICE_TABLE(pci, cirrusfb_pci_table);
 
 
 #ifdef CONFIG_ZORRO
+static const struct zorro_device_id cirrusfb_zorro_table[] = {
+       {
+               .id             = ZORRO_PROD_HELFRICH_SD64_RAM,
+               .driver_data    = BT_SD64,
+       }, {
+               .id             = ZORRO_PROD_HELFRICH_PICCOLO_RAM,
+               .driver_data    = BT_PICCOLO,
+       }, {
+               .id             = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM,
+               .driver_data    = BT_PICASSO,
+       }, {
+               .id             = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM,
+               .driver_data    = BT_SPECTRUM,
+       }, {
+               .id             = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3,
+               .driver_data    = BT_PICASSO4,
+       },
+       { 0 }
+};
+
 static const struct {
-       cirrusfb_board_t btype;
-       zorro_id id, id2;
+       zorro_id id2;
        unsigned long size;
-} cirrusfb_zorro_probe_list[] __initdata = {
-       { BT_SD64,
-               ZORRO_PROD_HELFRICH_SD64_RAM,
-               ZORRO_PROD_HELFRICH_SD64_REG,
-               0x400000 },
-       { BT_PICCOLO,
-               ZORRO_PROD_HELFRICH_PICCOLO_RAM,
-               ZORRO_PROD_HELFRICH_PICCOLO_REG,
-               0x200000 },
-       { BT_PICASSO,
-               ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM,
-               ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
-               0x200000 },
-       { BT_SPECTRUM,
-               ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM,
-               ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
-               0x200000 },
-       { BT_PICASSO4,
-               ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3,
-               0,
-               0x400000 },
+} cirrusfb_zorro_table2[] = {
+       [BT_SD64] = {
+               .id2    = ZORRO_PROD_HELFRICH_SD64_REG,
+               .size   = 0x400000
+       },
+       [BT_PICCOLO] = {
+               .id2    = ZORRO_PROD_HELFRICH_PICCOLO_REG,
+               .size   = 0x200000
+       },
+       [BT_PICASSO] = {
+               .id2    = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
+               .size   = 0x200000
+       },
+       [BT_SPECTRUM] = {
+               .id2    = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
+               .size   = 0x200000
+       },
+       [BT_PICASSO4] = {
+               .id2    = 0,
+               .size   = 0x400000
+       }
 };
 #endif /* CONFIG_ZORRO */
 
@@ -381,13 +408,12 @@ struct cirrusfb_info {
        struct { u8 red, green, blue, pad; } palette[256];
 
 #ifdef CONFIG_ZORRO
-       unsigned long board_addr,
-                     board_size;
+       struct zorro_dev *zdev;
 #endif
-
 #ifdef CONFIG_PCI
        struct pci_dev *pdev;
 #endif
+       void (*unmap)(struct cirrusfb_info *cinfo);
 };
 
 
@@ -401,50 +427,83 @@ static int noaccel = 0;
 static const struct {
        const char *name;
        struct fb_var_screeninfo var;
-} cirrusfb_predefined[] =
-
-{
-       {"Autodetect",          /* autodetect mode */
-        {0}
-       },
-
-       {"640x480",             /* 640x480, 31.25 kHz, 60 Hz, 25 MHz PixClock */
-        {
-                640, 480, 640, 480, 0, 0, 8, 0,
-                {0, 8, 0},
-                {0, 8, 0},
-                {0, 8, 0},
-                {0, 0, 0},
-              0, 0, -1, -1, FB_ACCEL_NONE, 40000, 48, 16, 32, 8, 96, 4,
-     FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, FB_VMODE_NONINTERLACED
-        }
-       },
-
-       {"800x600",             /* 800x600, 48 kHz, 76 Hz, 50 MHz PixClock */
-        {
-                800, 600, 800, 600, 0, 0, 8, 0,
-                {0, 8, 0},
-                {0, 8, 0},
-                {0, 8, 0},
-                {0, 0, 0},
-              0, 0, -1, -1, FB_ACCEL_NONE, 20000, 128, 16, 24, 2, 96, 6,
-     0, FB_VMODE_NONINTERLACED
-        }
-       },
-
-       /*
-          Modeline from XF86Config:
-          Mode "1024x768" 80  1024 1136 1340 1432  768 770 774 805
-        */
-       {"1024x768",            /* 1024x768, 55.8 kHz, 70 Hz, 80 MHz PixClock */
-               {
-                       1024, 768, 1024, 768, 0, 0, 8, 0,
-                       {0, 8, 0},
-                       {0, 8, 0},
-                       {0, 8, 0},
-                       {0, 0, 0},
-             0, 0, -1, -1, FB_ACCEL_NONE, 12500, 144, 32, 30, 2, 192, 6,
-     0, FB_VMODE_NONINTERLACED
+} cirrusfb_predefined[] = {
+       {
+               /* autodetect mode */
+               .name   = "Autodetect",
+       }, {
+               /* 640x480, 31.25 kHz, 60 Hz, 25 MHz PixClock */
+               .name   = "640x480",
+               .var    = {
+                       .xres           = 640,
+                       .yres           = 480,
+                       .xres_virtual   = 640,
+                       .yres_virtual   = 480,
+                       .bits_per_pixel = 8,
+                       .red            = { .length = 8 },
+                       .green          = { .length = 8 },
+                       .blue           = { .length = 8 },
+                       .width          = -1,
+                       .height         = -1,
+                       .pixclock       = 40000,
+                       .left_margin    = 48,
+                       .right_margin   = 16,
+                       .upper_margin   = 32,
+                       .lower_margin   = 8,
+                       .hsync_len      = 96,
+                       .vsync_len      = 4,
+                       .sync           = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+                       .vmode          = FB_VMODE_NONINTERLACED
+                }
+       }, {
+               /* 800x600, 48 kHz, 76 Hz, 50 MHz PixClock */
+               .name   = "800x600",
+               .var    = {
+                       .xres           = 800,
+                       .yres           = 600,
+                       .xres_virtual   = 800,
+                       .yres_virtual   = 600,
+                       .bits_per_pixel = 8,
+                       .red            = { .length = 8 },
+                       .green          = { .length = 8 },
+                       .blue           = { .length = 8 },
+                       .width          = -1,
+                       .height         = -1,
+                       .pixclock       = 20000,
+                       .left_margin    = 128,
+                       .right_margin   = 16,
+                       .upper_margin   = 24,
+                       .lower_margin   = 2,
+                       .hsync_len      = 96,
+                       .vsync_len      = 6,
+                       .vmode          = FB_VMODE_NONINTERLACED
+                }
+       }, {
+               /*
+                * Modeline from XF86Config:
+                * Mode "1024x768" 80  1024 1136 1340 1432  768 770 774 805
+                */
+               /* 1024x768, 55.8 kHz, 70 Hz, 80 MHz PixClock */
+               .name   = "1024x768",
+               .var    = {
+                       .xres           = 1024,
+                       .yres           = 768,
+                       .xres_virtual   = 1024,
+                       .yres_virtual   = 768,
+                       .bits_per_pixel = 8,
+                       .red            = { .length = 8 },
+                       .green          = { .length = 8 },
+                       .blue           = { .length = 8 },
+                       .width          = -1,
+                       .height         = -1,
+                       .pixclock       = 12500,
+                       .left_margin    = 144,
+                       .right_margin   = 32,
+                       .upper_margin   = 30,
+                       .lower_margin   = 2,
+                       .hsync_len      = 192,
+                       .vsync_len      = 6,
+                       .vmode          = FB_VMODE_NONINTERLACED
                }
        }
 };
@@ -478,7 +537,7 @@ void cirrusfb_imageblit(struct fb_info *info, const struct fb_image *image);
 static struct fb_ops cirrusfb_ops = {
        .owner          = THIS_MODULE,
        .fb_open        = cirrusfb_open,
-       .fb_release     = cirrusfb_release,
+       .fb_release     = cirrusfb_release,
        .fb_setcolreg   = cirrusfb_setcolreg,
        .fb_check_var   = cirrusfb_check_var,
        .fb_set_par     = cirrusfb_set_par,
@@ -1132,7 +1191,7 @@ static int cirrusfb_set_par_foo (struct fb_info *info)
                        DPRINTK (" (for GD54xx)\n");
                        vga_wseq (regbase, CL_SEQR7,
                                  regs.multiplexing ?
-                                       bi->sr07_1bpp_mux : bi->sr07_1bpp);
+                                       bi->sr07_1bpp_mux : bi->sr07_1bpp);
                        break;
 
                case BT_LAGUNA:
@@ -1216,7 +1275,7 @@ static int cirrusfb_set_par_foo (struct fb_info *info)
                        DPRINTK (" (for GD54xx)\n");
                        vga_wseq (regbase, CL_SEQR7,
                                  regs.multiplexing ?
-                                       bi->sr07_8bpp_mux : bi->sr07_8bpp);
+                                       bi->sr07_8bpp_mux : bi->sr07_8bpp);
                        break;
 
                case BT_LAGUNA:
@@ -2142,7 +2201,7 @@ static void get_pci_addrs (const struct pci_dev *pdev,
 }
 
 
-static void __devexit cirrusfb_pci_unmap (struct cirrusfb_info *cinfo)
+static void cirrusfb_pci_unmap (struct cirrusfb_info *cinfo)
 {
        struct pci_dev *pdev = cinfo->pdev;
 
@@ -2156,10 +2215,144 @@ static void __devexit cirrusfb_pci_unmap (struct cirrusfb_info *cinfo)
        framebuffer_release(cinfo->info);
        pci_disable_device(pdev);
 }
+#endif /* CONFIG_PCI */
+
+
+#ifdef CONFIG_ZORRO
+static void __devexit cirrusfb_zorro_unmap (struct cirrusfb_info *cinfo)
+{
+       zorro_release_device(cinfo->zdev);
+
+       if (cinfo->btype == BT_PICASSO4) {
+               cinfo->regbase -= 0x600000;
+               iounmap ((void *)cinfo->regbase);
+               iounmap ((void *)cinfo->fbmem);
+       } else {
+               if (zorro_resource_start(cinfo->zdev) > 0x01000000)
+                       iounmap ((void *)cinfo->fbmem);
+       }
+       framebuffer_release(cinfo->info);
+}
+#endif /* CONFIG_ZORRO */
+
+static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo)
+{
+       struct fb_info *info = cinfo->info;
+       struct fb_var_screeninfo *var = &info->var;
+
+       info->currcon = -1;
+       info->par = cinfo;
+       info->pseudo_palette = cinfo->pseudo_palette;
+       info->flags = FBINFO_DEFAULT
+                   | FBINFO_HWACCEL_XPAN
+                   | FBINFO_HWACCEL_YPAN
+                   | FBINFO_HWACCEL_FILLRECT
+                   | FBINFO_HWACCEL_COPYAREA;
+       if (noaccel)
+               info->flags |= FBINFO_HWACCEL_DISABLED;
+       info->fbops = &cirrusfb_ops;
+       info->screen_base = cinfo->fbmem;
+       if (cinfo->btype == BT_GD5480) {
+               if (var->bits_per_pixel == 16)
+                       info->screen_base += 1 * MB_;
+               if (var->bits_per_pixel == 24 || var->bits_per_pixel == 32)
+                       info->screen_base += 2 * MB_;
+       }
+
+       /* Fill fix common fields */
+       strlcpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
+               sizeof(info->fix.id));
+
+       /* monochrome: only 1 memory plane */
+       /* 8 bit and above: Use whole memory area */
+       info->fix.smem_start = cinfo->fbmem_phys;
+       info->fix.smem_len   = (var->bits_per_pixel == 1) ? cinfo->size / 4 : cinfo->size;
+       info->fix.type       = cinfo->currentmode.type;
+       info->fix.type_aux   = 0;
+       info->fix.visual     = cinfo->currentmode.visual;
+       info->fix.xpanstep   = 1;
+       info->fix.ypanstep   = 1;
+       info->fix.ywrapstep  = 0;
+       info->fix.line_length = cinfo->currentmode.line_length;
+
+       /* FIXME: map region at 0xB8000 if available, fill in here */
+       info->fix.mmio_start = cinfo->fbregs_phys;
+       info->fix.mmio_len   = 0;
+       info->fix.accel = FB_ACCEL_NONE;
+
+       fb_alloc_cmap(&info->cmap, 256, 0);
+
+       return 0;
+}
 
+static int cirrusfb_register(struct cirrusfb_info *cinfo)
+{
+       struct fb_info *info;
+       int err;
+       cirrusfb_board_t btype;
+
+       DPRINTK ("ENTER\n");
 
-static struct cirrusfb_info *cirrusfb_pci_setup (struct pci_dev *pdev,
-                                                const struct pci_device_id *ent)
+       printk (KERN_INFO "cirrusfb: Driver for Cirrus Logic based graphic boards, v" CIRRUSFB_VERSION "\n");
+
+       info = cinfo->info;
+       btype = cinfo->btype;
+
+       /* sanity checks */
+       assert (btype != BT_NONE);
+
+       DPRINTK ("cirrusfb: (RAM start set to: 0x%p)\n", cinfo->fbmem);
+
+       /* Make pretend we've set the var so our structures are in a "good" */
+       /* state, even though we haven't written the mode to the hw yet...  */
+       info->var = cirrusfb_predefined[cirrusfb_def_mode].var;
+       info->var.activate = FB_ACTIVATE_NOW;
+
+       err = cirrusfb_decode_var(&info->var, &cinfo->currentmode, info);
+       if (err < 0) {
+               /* should never happen */
+               DPRINTK("choking on default var... umm, no good.\n");
+               goto err_unmap_cirrusfb;
+       }
+
+       /* set all the vital stuff */
+       cirrusfb_set_fbinfo(cinfo);
+
+       err = register_framebuffer(info);
+       if (err < 0) {
+               printk (KERN_ERR "cirrusfb: could not register fb device; err = %d!\n", err);
+               goto err_dealloc_cmap;
+       }
+
+       DPRINTK ("EXIT, returning 0\n");
+       return 0;
+
+err_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+err_unmap_cirrusfb:
+       cinfo->unmap(cinfo);
+       return err;
+}
+
+static void __devexit cirrusfb_cleanup (struct fb_info *info)
+{
+       struct cirrusfb_info *cinfo = info->par;
+       DPRINTK ("ENTER\n");
+
+       switch_monitor (cinfo, 0);
+
+       unregister_framebuffer (info);
+       fb_dealloc_cmap (&info->cmap);
+       printk ("Framebuffer unregistered\n");
+       cinfo->unmap(cinfo);
+
+       DPRINTK ("EXIT\n");
+}
+
+
+#ifdef CONFIG_PCI
+static int cirrusfb_pci_register (struct pci_dev *pdev,
+                                 const struct pci_device_id *ent)
 {
        struct cirrusfb_info *cinfo;
        struct fb_info *info;
@@ -2233,11 +2426,13 @@ static struct cirrusfb_info *cirrusfb_pci_setup (struct pci_dev *pdev,
 
        cinfo->fbmem_phys = board_addr;
        cinfo->size = board_size;
+       cinfo->unmap = cirrusfb_pci_unmap;
 
        printk (" RAM (%lu kB) at 0xx%lx, ", cinfo->size / KB_, board_addr);
        printk ("Cirrus Logic chipset on PCI bus\n");
+       pci_set_drvdata(pdev, info);
 
-       return cinfo;
+       return cirrusfb_register(cinfo);
 
 err_release_legacy:
        if (release_io_ports)
@@ -2252,77 +2447,51 @@ err_release_fb:
 err_disable:
        pci_disable_device(pdev);
 err_out:
-       return ERR_PTR(ret);
+       return ret;
 }
-#endif                         /* CONFIG_PCI */
-
-
 
-
-#ifdef CONFIG_ZORRO
-static int cirrusfb_zorro_find (struct zorro_dev **z_o,
-                                   struct zorro_dev **z2_o,
-                                   cirrusfb_board_t *btype, unsigned long *size)
+void __devexit cirrusfb_pci_unregister (struct pci_dev *pdev)
 {
-       struct zorro_dev *z = NULL;
-       int i;
-
-       assert (z_o != NULL);
-       assert (btype != NULL);
-
-       for (i = 0; i < ARRAY_SIZE(cirrusfb_zorro_probe_list); i++)
-               if ((z = zorro_find_device(cirrusfb_zorro_probe_list[i].id, NULL)))
-                       break;
-
-       if (z) {
-               *z_o = z;
-               if (cirrusfb_zorro_probe_list[i].id2)
-                       *z2_o = zorro_find_device(cirrusfb_zorro_probe_list[i].id2, NULL);
-               else
-                       *z2_o = NULL;
-
-               *btype = cirrusfb_zorro_probe_list[i].btype;
-               *size = cirrusfb_zorro_probe_list[i].size;
-
-               printk (KERN_INFO "cirrusfb: %s board detected; ",
-                       cirrusfb_board_info[*btype].name);
+       struct fb_info *info = pci_get_drvdata(pdev);
+       DPRINTK ("ENTER\n");
 
-               return 0;
-       }
+       cirrusfb_cleanup (info);
 
-       printk (KERN_NOTICE "cirrusfb: no supported board found.\n");
-       return -ENODEV;
+       DPRINTK ("EXIT\n");
 }
 
-
-static void __devexit cirrusfb_zorro_unmap (struct cirrusfb_info *cinfo)
-{
-       release_mem_region(cinfo->board_addr, cinfo->board_size);
-
-       if (cinfo->btype == BT_PICASSO4) {
-               cinfo->regbase -= 0x600000;
-               iounmap ((void *)cinfo->regbase);
-               iounmap ((void *)cinfo->fbmem);
-       } else {
-               if (cinfo->board_addr > 0x01000000)
-                       iounmap ((void *)cinfo->fbmem);
-       }
-       framebuffer_release(cinfo->info);
-}
+static struct pci_driver cirrusfb_pci_driver = {
+       .name           = "cirrusfb",
+       .id_table       = cirrusfb_pci_table,
+       .probe          = cirrusfb_pci_register,
+       .remove         = __devexit_p(cirrusfb_pci_unregister),
+#ifdef CONFIG_PM
+#if 0
+       .suspend        = cirrusfb_pci_suspend,
+       .resume         = cirrusfb_pci_resume,
+#endif
+#endif
+};
+#endif /* CONFIG_PCI */
 
 
-static struct cirrusfb_info *cirrusfb_zorro_setup(void)
+#ifdef CONFIG_ZORRO
+static int cirrusfb_zorro_register(struct zorro_dev *z,
+                                  const struct zorro_device_id *ent)
 {
        struct cirrusfb_info *cinfo;
        struct fb_info *info;
        cirrusfb_board_t btype;
-       struct zorro_dev *z = NULL, *z2 = NULL;
+       struct zorro_dev *z2 = NULL;
        unsigned long board_addr, board_size, size;
        int ret;
 
-       ret = cirrusfb_zorro_find (&z, &z2, &btype, &size);
-       if (ret < 0)
-               goto err_out;
+       btype = ent->driver_data;
+       if (cirrusfb_zorro_table2[btype].id2)
+               z2 = zorro_find_device(cirrusfb_zorro_table2[btype].id2, NULL);
+       size = cirrusfb_zorro_table2[btype].size;
+       printk(KERN_INFO "cirrusfb: %s board detected; ",
+              cirrusfb_board_info[btype].name);
 
        info = framebuffer_alloc(sizeof(struct cirrusfb_info), &z->dev);
        if (!info) {
@@ -2339,11 +2508,12 @@ static struct cirrusfb_info *cirrusfb_zorro_setup(void)
        assert (z2 >= 0);
        assert (btype != BT_NONE);
 
-       cinfo->board_addr = board_addr = z->resource.start;
-       cinfo->board_size = board_size = z->resource.end-z->resource.start+1;
+       cinfo->zdev = z;
+       board_addr = zorro_resource_start(z);
+       board_size = zorro_resource_len(z);
        cinfo->size = size;
 
-       if (!request_mem_region(board_addr, board_size, "cirrusfb")) {
+       if (!zorro_request_device(z, "cirrusfb")) {
                printk(KERN_ERR "cirrusfb: cannot reserve region 0x%lx, abort\n",
                       board_addr);
                ret = -EBUSY;
@@ -2370,7 +2540,7 @@ static struct cirrusfb_info *cirrusfb_zorro_setup(void)
                cinfo->fbregs_phys = board_addr + 0x600000;
 
                cinfo->fbmem_phys = board_addr + 16777216;
-               cinfo->fbmem = ioremap (info->fbmem_phys, 16777216);
+               cinfo->fbmem = ioremap (cinfo->fbmem_phys, 16777216);
                if (!cinfo->fbmem)
                        goto err_unmap_regbase;
        } else {
@@ -2390,10 +2560,12 @@ static struct cirrusfb_info *cirrusfb_zorro_setup(void)
 
                DPRINTK ("cirrusfb: Virtual address for board set to: $%p\n", cinfo->regbase);
        }
+       cinfo->unmap = cirrusfb_zorro_unmap;
 
        printk (KERN_INFO "Cirrus Logic chipset on Zorro bus\n");
+       zorro_set_drvdata(z, info);
 
-       return 0;
+       return cirrusfb_register(cinfo);
 
 err_unmap_regbase:
        /* Parental advisory: explicit hack */
@@ -2403,153 +2575,12 @@ err_release_region:
 err_release_fb:
        framebuffer_release(info);
 err_out:
-       return ERR_PTR(ret);
+       return ret;
 }
-#endif /* CONFIG_ZORRO */
 
-static int cirrusfb_set_fbinfo(struct cirrusfb_info *cinfo)
+void __devexit cirrusfb_zorro_unregister(struct zorro_dev *z)
 {
-       struct fb_info *info = cinfo->info;
-       struct fb_var_screeninfo *var = &info->var;
-
-       info->currcon = -1;
-       info->par = cinfo;
-       info->pseudo_palette = cinfo->pseudo_palette;
-       info->flags = FBINFO_DEFAULT
-                   | FBINFO_HWACCEL_XPAN
-                   | FBINFO_HWACCEL_YPAN
-                   | FBINFO_HWACCEL_FILLRECT
-                   | FBINFO_HWACCEL_COPYAREA;
-       if (noaccel)
-               info->flags |= FBINFO_HWACCEL_DISABLED;
-       info->fbops = &cirrusfb_ops;
-       info->screen_base = cinfo->fbmem;
-       if (cinfo->btype == BT_GD5480) {
-               if (var->bits_per_pixel == 16)
-                       info->screen_base += 1 * MB_;
-               if (var->bits_per_pixel == 24 || var->bits_per_pixel == 32)
-                       info->screen_base += 2 * MB_;
-       }
-
-       /* Fill fix common fields */
-       strlcpy(info->fix.id, cirrusfb_board_info[cinfo->btype].name,
-               sizeof(info->fix.id));
-
-       /* monochrome: only 1 memory plane */
-       /* 8 bit and above: Use whole memory area */
-       info->fix.smem_start = cinfo->fbmem_phys;
-       info->fix.smem_len   = (var->bits_per_pixel == 1) ? cinfo->size / 4 : cinfo->size;
-       info->fix.type       = cinfo->currentmode.type;
-       info->fix.type_aux   = 0;
-       info->fix.visual     = cinfo->currentmode.visual;
-       info->fix.xpanstep   = 1;
-       info->fix.ypanstep   = 1;
-       info->fix.ywrapstep  = 0;
-       info->fix.line_length = cinfo->currentmode.line_length;
-
-       /* FIXME: map region at 0xB8000 if available, fill in here */
-       info->fix.mmio_start = cinfo->fbregs_phys;
-       info->fix.mmio_len   = 0;
-       info->fix.accel = FB_ACCEL_NONE;
-
-       fb_alloc_cmap(&info->cmap, 256, 0);
-
-       return 0;
-}
-
-#if defined(CONFIG_PCI)
-#define cirrusfb_unmap cirrusfb_pci_unmap
-#define cirrusfb_bus_setup cirrusfb_pci_setup
-#elif defined(CONFIG_ZORRO)
-#define cirrusfb_unmap cirrusfb_zorro_unmap
-#define cirrusfb_bus_setup cirrusfb_zorro_setup
-#endif
-
-
-static int cirrusfb_pci_register (struct pci_dev *pdev,
-                                 const struct pci_device_id *ent)
-{
-       struct fb_info *info;
-       struct cirrusfb_info *cinfo = NULL;
-       int err;
-       cirrusfb_board_t btype;
-
-       DPRINTK ("ENTER\n");
-
-       printk (KERN_INFO "cirrusfb: Driver for Cirrus Logic based graphic boards, v" CIRRUSFB_VERSION "\n");
-
-       cinfo = cirrusfb_bus_setup(pdev, ent);
-
-       if (IS_ERR(cinfo)) {
-               err = PTR_ERR(cinfo);
-               goto err_out;
-       }
-
-       info = cinfo->info;
-       btype = cinfo->btype;
-
-       /* sanity checks */
-       assert (btype != BT_NONE);
-       assert (btype == cirrusfb_board_info[btype].btype);
-
-       DPRINTK ("cirrusfb: (RAM start set to: 0x%p)\n", cinfo->fbmem);
-
-       /* Make pretend we've set the var so our structures are in a "good" */
-       /* state, even though we haven't written the mode to the hw yet...  */
-       info->var = cirrusfb_predefined[cirrusfb_def_mode].var;
-       info->var.activate = FB_ACTIVATE_NOW;
-
-       err = cirrusfb_decode_var(&info->var, &cinfo->currentmode, info);
-       if (err < 0) {
-               /* should never happen */
-               DPRINTK("choking on default var... umm, no good.\n");
-               goto err_unmap_cirrusfb;
-       }
-
-       /* set all the vital stuff */
-       cirrusfb_set_fbinfo(cinfo);
-
-       pci_set_drvdata(pdev, info);
-
-       err = register_framebuffer(info);
-       if (err < 0) {
-               printk (KERN_ERR "cirrusfb: could not register fb device; err = %d!\n", err);
-               goto err_dealloc_cmap;
-       }
-
-       DPRINTK ("EXIT, returning 0\n");
-       return 0;
-
-err_dealloc_cmap:
-       fb_dealloc_cmap(&info->cmap);
-err_unmap_cirrusfb:
-       cirrusfb_unmap(cinfo);
-err_out:
-       return err;
-}
-
-
-static void __devexit cirrusfb_cleanup (struct fb_info *info)
-{
-       struct cirrusfb_info *cinfo = info->par;
-       DPRINTK ("ENTER\n");
-
-#ifdef CONFIG_ZORRO
-       switch_monitor (cinfo, 0);
-#endif
-
-       unregister_framebuffer (info);
-       fb_dealloc_cmap (&info->cmap);
-       printk ("Framebuffer unregistered\n");
-       cirrusfb_unmap (cinfo);
-
-       DPRINTK ("EXIT\n");
-}
-
-
-void __devexit cirrusfb_pci_unregister (struct pci_dev *pdev)
-{
-       struct fb_info *info = pci_get_drvdata(pdev);
+       struct fb_info *info = zorro_get_drvdata(z);
        DPRINTK ("ENTER\n");
 
        cirrusfb_cleanup (info);
@@ -2557,26 +2588,25 @@ void __devexit cirrusfb_pci_unregister (struct pci_dev *pdev)
        DPRINTK ("EXIT\n");
 }
 
-static struct pci_driver cirrusfb_driver = {
-       .name   = "cirrusfb",
-       .id_table       = cirrusfb_pci_table,
-       .probe          = cirrusfb_pci_register,
-       .remove         = __devexit_p(cirrusfb_pci_unregister),
-#ifdef CONFIG_PM
-#if 0
-       .suspend        = cirrusfb_pci_suspend,
-       .resume         = cirrusfb_pci_resume,
-#endif
-#endif
+static struct zorro_driver cirrusfb_zorro_driver = {
+       .name           = "cirrusfb",
+       .id_table       = cirrusfb_zorro_table,
+       .probe          = cirrusfb_zorro_register,
+       .remove         = __devexit_p(cirrusfb_zorro_unregister),
 };
+#endif /* CONFIG_ZORRO */
 
 int __init cirrusfb_init(void)
 {
+       int error = 0;
+
 #ifdef CONFIG_ZORRO
-       return cirrusfb_pci_register(NULL, NULL);
-#else
-       return pci_module_init(&cirrusfb_driver);
+       error |= zorro_module_init(&cirrusfb_zorro_driver);
 #endif
+#ifdef CONFIG_PCI
+       error |= pci_module_init(&cirrusfb_pci_driver);
+#endif
+       return error;
 }
 
 
@@ -2619,7 +2649,12 @@ MODULE_LICENSE("GPL");
 
 void __exit cirrusfb_exit (void)
 {
-       pci_unregister_driver (&cirrusfb_driver);
+#ifdef CONFIG_PCI
+       pci_unregister_driver(&cirrusfb_pci_driver);
+#endif
+#ifdef CONFIG_ZORRO
+       zorro_unregister_driver(&cirrusfb_zorro_driver);
+#endif
 }
 
 #ifdef MODULE
@@ -2830,7 +2865,7 @@ static void cirrusfb_WaitBLT (caddr_t regbase)
 
 static void cirrusfb_BitBLT (caddr_t regbase, int bits_per_pixel,
                             u_short curx, u_short cury, u_short destx, u_short desty,
-                            u_short width, u_short height, u_short line_length)
+                            u_short width, u_short height, u_short line_length)
 {
        u_short nwidth, nheight;
        u_long nsrc, ndest;
index cbe3386..3ac5d58 100644 (file)
@@ -71,7 +71,10 @@ const struct consw dummy_con = {
     .con_bmove =       DUMMY,
     .con_switch =      DUMMY,
     .con_blank =       DUMMY,
-    .con_font_op =     DUMMY,
+    .con_font_set =    DUMMY,
+    .con_font_get =    DUMMY,
+    .con_font_default =        DUMMY,
+    .con_font_copy =   DUMMY,
     .con_set_palette = DUMMY,
     .con_scrolldelta = DUMMY,
 };
index 691ae83..2fcb51a 100644 (file)
@@ -165,7 +165,6 @@ static void fbcon_bmove(struct vc_data *vc, int sy, int sx, int dy, int dx,
                        int height, int width);
 static int fbcon_switch(struct vc_data *vc);
 static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch);
-static int fbcon_font_op(struct vc_data *vc, struct console_font_op *op);
 static int fbcon_set_palette(struct vc_data *vc, unsigned char *table);
 static int fbcon_scrolldelta(struct vc_data *vc, int lines);
 void accel_clear_margins(struct vc_data *vc, struct fb_info *info,
@@ -2001,36 +2000,36 @@ static void fbcon_free_font(struct display *p)
        p->userfont = 0;
 }
 
-static inline int fbcon_get_font(struct vc_data *vc, struct console_font_op *op)
+static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
 {
        u8 *fontdata = vc->vc_font.data;
-       u8 *data = op->data;
+       u8 *data = font->data;
        int i, j;
 
-       op->width = vc->vc_font.width;
-       op->height = vc->vc_font.height;
-       op->charcount = vc->vc_hi_font_mask ? 512 : 256;
-       if (!op->data)
+       font->width = vc->vc_font.width;
+       font->height = vc->vc_font.height;
+       font->charcount = vc->vc_hi_font_mask ? 512 : 256;
+       if (!font->data)
                return 0;
 
-       if (op->width <= 8) {
+       if (font->width <= 8) {
                j = vc->vc_font.height;
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < font->charcount; i++) {
                        memcpy(data, fontdata, j);
                        memset(data + j, 0, 32 - j);
                        data += 32;
                        fontdata += j;
                }
-       } else if (op->width <= 16) {
+       } else if (font->width <= 16) {
                j = vc->vc_font.height * 2;
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < font->charcount; i++) {
                        memcpy(data, fontdata, j);
                        memset(data + j, 0, 64 - j);
                        data += 64;
                        fontdata += j;
                }
-       } else if (op->width <= 24) {
-               for (i = 0; i < op->charcount; i++) {
+       } else if (font->width <= 24) {
+               for (i = 0; i < font->charcount; i++) {
                        for (j = 0; j < vc->vc_font.height; j++) {
                                *data++ = fontdata[0];
                                *data++ = fontdata[1];
@@ -2042,7 +2041,7 @@ static inline int fbcon_get_font(struct vc_data *vc, struct console_font_op *op)
                }
        } else {
                j = vc->vc_font.height * 4;
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < font->charcount; i++) {
                        memcpy(data, fontdata, j);
                        memset(data + j, 0, 128 - j);
                        data += 128;
@@ -2052,23 +2051,15 @@ static inline int fbcon_get_font(struct vc_data *vc, struct console_font_op *op)
        return 0;
 }
 
-static int fbcon_do_set_font(struct vc_data *vc, struct console_font_op *op,
+static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
                             u8 * data, int userfont)
 {
        struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
        struct display *p = &fb_display[vc->vc_num];
        int resize;
-       int w = op->width;
-       int h = op->height;
        int cnt;
        char *old_data = NULL;
 
-       if (!w > 32) {
-               if (userfont && op->op != KD_FONT_OP_COPY)
-                       kfree(data - FONT_EXTRA_WORDS * sizeof(int));
-               return -ENXIO;
-       }
-
        if (CON_IS_VISIBLE(vc) && softback_lines)
                fbcon_set_origin(vc);
 
@@ -2168,33 +2159,32 @@ static int fbcon_do_set_font(struct vc_data *vc, struct console_font_op *op,
        return 0;
 }
 
-static inline int fbcon_copy_font(struct vc_data *vc, struct console_font_op *op)
+static int fbcon_copy_font(struct vc_data *vc, int con)
 {
-       struct display *od;
-       int h = op->height;
-
-       if (h < 0 || !vc_cons_allocated(h))
-               return -ENOTTY;
-       if (h == vc->vc_num)
-               return 0;       /* nothing to do */
-       od = &fb_display[h];
-       if (od->fontdata == vc->vc_font.data)
+       struct display *od = &fb_display[con];
+       struct console_font *f = &vc->vc_font;
+
+       if (od->fontdata == f->data)
                return 0;       /* already the same font... */
-       op->width = vc->vc_font.width;
-       op->height = vc->vc_font.height;
-       return fbcon_do_set_font(vc, op, od->fontdata, od->userfont);
+       return fbcon_do_set_font(vc, f->width, f->height, od->fontdata, od->userfont);
 }
 
-static inline int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
+/*
+ *  User asked to set font; we are guaranteed that
+ *     a) width and height are in range 1..32
+ *     b) charcount does not exceed 512
+ */
+
+static int fbcon_set_font(struct vc_data *vc, struct console_font *font, unsigned flags)
 {
-       int w = op->width;
-       int h = op->height;
+       unsigned charcount = font->charcount;
+       int w = font->width;
+       int h = font->height;
        int size = h;
        int i, k;
-       u8 *new_data, *data = op->data, *p;
+       u8 *new_data, *data = font->data, *p;
 
-       if ((w <= 0) || (w > 32)
-           || (op->charcount != 256 && op->charcount != 512))
+       if (charcount != 256 && charcount != 512)
                return -EINVAL;
 
        if (w > 8) {
@@ -2203,32 +2193,33 @@ static inline int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
                else
                        size *= 4;
        }
-       size *= op->charcount;
+       size *= charcount;
+
+       new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);
 
-       if (!
-           (new_data =
-            kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER)))
+       if (!new_data)
                return -ENOMEM;
+
        new_data += FONT_EXTRA_WORDS * sizeof(int);
        FNTSIZE(new_data) = size;
-       FNTCHARCNT(new_data) = op->charcount;
+       FNTCHARCNT(new_data) = charcount;
        REFCOUNT(new_data) = 0; /* usage counter */
        p = new_data;
        if (w <= 8) {
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < charcount; i++) {
                        memcpy(p, data, h);
                        data += 32;
                        p += h;
                }
        } else if (w <= 16) {
                h *= 2;
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < charcount; i++) {
                        memcpy(p, data, h);
                        data += 64;
                        p += h;
                }
        } else if (w <= 24) {
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < charcount; i++) {
                        int j;
                        for (j = 0; j < h; j++) {
                                memcpy(p, data, 3);
@@ -2240,7 +2231,7 @@ static inline int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
                }
        } else {
                h *= 4;
-               for (i = 0; i < op->charcount; i++) {
+               for (i = 0; i < charcount; i++) {
                        memcpy(p, data, h);
                        data += 128;
                        p += h;
@@ -2270,43 +2261,22 @@ static inline int fbcon_set_font(struct vc_data *vc, struct console_font_op *op)
                        break;
                }
        }
-       return fbcon_do_set_font(vc, op, new_data, 1);
+       return fbcon_do_set_font(vc, font->width, font->height, new_data, 1);
 }
 
-static inline int fbcon_set_def_font(struct vc_data *vc, struct console_font_op *op)
+static int fbcon_set_def_font(struct vc_data *vc, struct console_font *font, char *name)
 {
        struct fb_info *info = registered_fb[(int) con2fb_map[vc->vc_num]];
-       char name[MAX_FONT_NAME];
        struct font_desc *f;
 
-       if (!op->data)
+       if (!name)
                f = get_default_font(info->var.xres, info->var.yres);
-       else if (strncpy_from_user(name, op->data, MAX_FONT_NAME - 1) < 0)
-               return -EFAULT;
-       else {
-               name[MAX_FONT_NAME - 1] = 0;
-               if (!(f = find_font(name)))
-                       return -ENOENT;
-       }
-       op->width = f->width;
-       op->height = f->height;
-       return fbcon_do_set_font(vc, op, f->data, 0);
-}
+       else if (!(f = find_font(name)))
+               return -ENOENT;
 
-static int fbcon_font_op(struct vc_data *vc, struct console_font_op *op)
-{
-       switch (op->op) {
-       case KD_FONT_OP_SET:
-               return fbcon_set_font(vc, op);
-       case KD_FONT_OP_GET:
-               return fbcon_get_font(vc, op);
-       case KD_FONT_OP_SET_DEFAULT:
-               return fbcon_set_def_font(vc, op);
-       case KD_FONT_OP_COPY:
-               return fbcon_copy_font(vc, op);
-       default:
-               return -ENOSYS;
-       }
+       font->width = f->width;
+       font->height = f->height;
+       return fbcon_do_set_font(vc, f->width, f->height, f->data, 0);
 }
 
 static u16 palette_red[16];
@@ -2340,7 +2310,7 @@ static int fbcon_set_palette(struct vc_data *vc, unsigned char *table)
        else
                palette_cmap.len = 16;
        palette_cmap.start = 0;
-       return fb_set_cmap(&palette_cmap, 1, info);
+       return fb_set_cmap(&palette_cmap, info);
 }
 
 static u16 *fbcon_screen_pos(struct vc_data *vc, int offset)
@@ -2609,7 +2579,10 @@ const struct consw fb_con = {
        .con_bmove              = fbcon_bmove,
        .con_switch             = fbcon_switch,
        .con_blank              = fbcon_blank,
-       .con_font_op            = fbcon_font_op,
+       .con_font_set           = fbcon_set_font,
+       .con_font_get           = fbcon_get_font,
+       .con_font_default       = fbcon_set_def_font,
+       .con_font_copy          = fbcon_copy_font,
        .con_set_palette        = fbcon_set_palette,
        .con_scrolldelta        = fbcon_scrolldelta,
        .con_set_origin         = fbcon_set_origin,
index 8f7f3a7..6dbeb18 100644 (file)
@@ -517,11 +517,6 @@ static int mdacon_blank(struct vc_data *c, int blank, int mode_switch)
        }
 }
 
-static int mdacon_font_op(struct vc_data *c, struct console_font_op *op)
-{
-       return -ENOSYS;
-}
-
 static int mdacon_scrolldelta(struct vc_data *c, int lines)
 {
        return 0;
@@ -594,7 +589,6 @@ const struct consw mda_con = {
        .con_bmove =            mdacon_bmove,
        .con_switch =           mdacon_switch,
        .con_blank =            mdacon_blank,
-       .con_font_op =          mdacon_font_op,
        .con_set_palette =      mdacon_set_palette,
        .con_scrolldelta =      mdacon_scrolldelta,
        .con_build_attr =       mdacon_build_attr,
index 5e4fdc0..b30ae70 100644 (file)
@@ -52,7 +52,7 @@ static int xcurs_correction = 29;
 static int newport_xsize;
 static int newport_ysize;
 
-static int newport_set_def_font(int unit, struct console_font_op *op);
+static int newport_set_def_font(int unit, struct console_font *op);
 
 #define BMASK(c) (c << 24)
 
@@ -477,7 +477,7 @@ static int newport_blank(struct vc_data *c, int blank)
        return 1;
 }
 
-static int newport_set_font(int unit, struct console_font_op *op)
+static int newport_set_font(int unit, struct console_font *op)
 {
        int w = op->width;
        int h = op->height;
@@ -531,7 +531,7 @@ static int newport_set_font(int unit, struct console_font_op *op)
        return 0;
 }
 
-static int newport_set_def_font(int unit, struct console_font_op *op)
+static int newport_set_def_font(int unit, struct console_font *op)
 {
        if (font_data[unit] != FONT_DATA) {
                if (--REFCOUNT(font_data[unit]) == 0)
@@ -543,18 +543,14 @@ static int newport_set_def_font(int unit, struct console_font_op *op)
        return 0;
 }
 
-static int newport_font_op(struct vc_data *vc, struct console_font_op *op)
+static int newport_font_default(struct vc_data *vc, struct console_font *op, char *name)
 {
-       int unit = vc->vc_num;
-
-       switch (op->op) {
-       case KD_FONT_OP_SET:
-               return newport_set_font(unit, op);
-       case KD_FONT_OP_SET_DEFAULT:
-               return newport_set_def_font(unit, op);
-       default:
-               return -ENOSYS;
-       }
+       return newport_set_def_font(vc->vc_num, op);
+}
+
+static int newport_font_set(struct vc_data *vc, struct console_font *font, unsigned flags)
+{
+       return newport_set_font(vc->vc_num, font);
 }
 
 static int newport_set_palette(struct vc_data *vc, unsigned char *table)
@@ -717,7 +713,8 @@ const struct consw newport_con = {
     .con_bmove =       newport_bmove,
     .con_switch =      newport_switch,
     .con_blank =       newport_blank,
-    .con_font_op =     newport_font_op,
+    .con_font_set =    newport_font_set,
+    .con_font_default =        newport_font_default,
     .con_set_palette = newport_set_palette,
     .con_scrolldelta = newport_scrolldelta,
     .con_set_origin =  DUMMY,
index 1458b16..fec664e 100644 (file)
@@ -456,12 +456,6 @@ promcon_cursor(struct vc_data *conp, int mode)
        }
 }
 
-static int
-promcon_font_op(struct vc_data *conp, struct console_font_op *op)
-{
-       return -ENOSYS;
-}
-        
 static int
 promcon_blank(struct vc_data *conp, int blank, int mode_switch)
 {
@@ -586,7 +580,6 @@ const struct consw prom_con = {
        .con_bmove =            promcon_bmove,
        .con_switch =           promcon_switch,
        .con_blank =            promcon_blank,
-       .con_font_op =          promcon_font_op,
        .con_set_palette =      DUMMY,
        .con_scrolldelta =      DUMMY,
 #if !(PROMCON_COLOR)
index 92dffc6..9926268 100644 (file)
@@ -85,11 +85,6 @@ static int sticon_set_palette(struct vc_data *c, unsigned char *table)
     return -EINVAL;
 }
 
-static int sticon_font_op(struct vc_data *c, struct console_font_op *op)
-{
-    return -ENOSYS;
-}
-
 static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos)
 {
     int unit = conp->vc_num;
@@ -366,7 +361,6 @@ static struct consw sti_con = {
        .con_bmove              = sticon_bmove,
        .con_switch             = sticon_switch,
        .con_blank              = sticon_blank,
-       .con_font_op            = sticon_font_op,
        .con_set_palette        = sticon_set_palette,
        .con_scrolldelta        = sticon_scrolldelta,
        .con_set_origin         = sticon_set_origin,
index 23e1e7e..0e91d6b 100644 (file)
@@ -77,7 +77,6 @@ static void vgacon_deinit(struct vc_data *c);
 static void vgacon_cursor(struct vc_data *c, int mode);
 static int vgacon_switch(struct vc_data *c);
 static int vgacon_blank(struct vc_data *c, int blank, int mode_switch);
-static int vgacon_font_op(struct vc_data *c, struct console_font_op *op);
 static int vgacon_set_palette(struct vc_data *vc, unsigned char *table);
 static int vgacon_scrolldelta(struct vc_data *c, int lines);
 static int vgacon_set_origin(struct vc_data *c);
@@ -908,39 +907,44 @@ static int vgacon_adjust_height(struct vc_data *vc, unsigned fontheight)
        return 0;
 }
 
-static int vgacon_font_op(struct vc_data *c, struct console_font_op *op)
+static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigned flags)
 {
+       unsigned charcount = font->charcount;
        int rc;
 
        if (vga_video_type < VIDEO_TYPE_EGAM)
                return -EINVAL;
 
-       if (op->op == KD_FONT_OP_SET) {
-               if (op->width != 8
-                   || (op->charcount != 256 && op->charcount != 512))
-                       return -EINVAL;
-               rc = vgacon_do_font_op(&state, op->data, 1, op->charcount == 512);
-               if (!rc && !(op->flags & KD_FONT_FLAG_DONT_RECALC))
-                       rc = vgacon_adjust_height(c, op->height);
-       } else if (op->op == KD_FONT_OP_GET) {
-               op->width = 8;
-               op->height = c->vc_font.height;
-               op->charcount = vga_512_chars ? 512 : 256;
-               if (!op->data)
-                       return 0;
-               rc = vgacon_do_font_op(&state, op->data, 0, 0);
-       } else
-               rc = -ENOSYS;
+       if (font->width != 8 || (charcount != 256 && charcount != 512))
+               return -EINVAL;
+
+       rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512);
+       if (rc)
+               return rc;
+
+       if (!(flags & KD_FONT_FLAG_DONT_RECALC))
+               rc = vgacon_adjust_height(c, font->height);
        return rc;
 }
 
-#else
-
-static int vgacon_font_op(struct vc_data *c, struct console_font_op *op)
+static int vgacon_font_get(struct vc_data *c, struct console_font *font)
 {
-       return -ENOSYS;
+       if (vga_video_type < VIDEO_TYPE_EGAM)
+               return -EINVAL;
+
+       font->width = 8;
+       font->height = c->vc_font.height;
+       font->charcount = vga_512_chars ? 512 : 256;
+       if (!font->data)
+               return 0;
+       return vgacon_do_font_op(&state, font->data, 0, 0);
 }
 
+#else
+
+#define vgacon_font_set NULL
+#define vgacon_font_get NULL
+
 #endif
 
 static int vgacon_scrolldelta(struct vc_data *c, int lines)
@@ -1079,7 +1083,8 @@ const struct consw vga_con = {
        .con_bmove = DUMMY,
        .con_switch = vgacon_switch,
        .con_blank = vgacon_blank,
-       .con_font_op = vgacon_font_op,
+       .con_font_set = vgacon_font_set,
+       .con_font_get = vgacon_font_get,
        .con_set_palette = vgacon_set_palette,
        .con_scrolldelta = vgacon_scrolldelta,
        .con_set_origin = vgacon_set_origin,
index 148cb0b..2a55e5d 100644 (file)
@@ -563,7 +563,7 @@ static inline unsigned safe_shift(unsigned d, int n)
        return n < 0 ? d >> -n : d << n;
 }
 
-static void __init fb_set_logocmap(struct fb_info *info,
+static void fb_set_logocmap(struct fb_info *info,
                                   const struct linux_logo *logo)
 {
        struct fb_cmap palette_cmap;
@@ -593,11 +593,11 @@ static void __init fb_set_logocmap(struct fb_info *info,
                        palette_cmap.blue[j] = clut[2] << 8 | clut[2];
                        clut += 3;
                }
-               fb_set_cmap(&palette_cmap, 1, info);
+               fb_set_cmap(&palette_cmap, info);
        }
 }
 
-static void  __init fb_set_logo_truepalette(struct fb_info *info,
+static void  fb_set_logo_truepalette(struct fb_info *info,
                                            const struct linux_logo *logo,
                                            u32 *palette)
 {
@@ -627,7 +627,7 @@ static void  __init fb_set_logo_truepalette(struct fb_info *info,
        }
 }
 
-static void __init fb_set_logo_directpalette(struct fb_info *info,
+static void fb_set_logo_directpalette(struct fb_info *info,
                                             const struct linux_logo *logo,
                                             u32 *palette)
 {
@@ -642,7 +642,7 @@ static void __init fb_set_logo_directpalette(struct fb_info *info,
                palette[i] = i << redshift | i << greenshift | i << blueshift;
 }
 
-static void __init fb_set_logo(struct fb_info *info,
+static void fb_set_logo(struct fb_info *info,
                               const struct linux_logo *logo, u8 *dst,
                               int depth)
 {
@@ -938,53 +938,93 @@ fb_load_cursor_image(struct fb_info *info)
 }
 
 int
-fb_cursor(struct fb_info *info, struct fb_cursor *sprite)
+fb_cursor(struct fb_info *info, struct fb_cursor_user __user *sprite)
 {
+       struct fb_cursor_user cursor_user;
        struct fb_cursor cursor;
-       int err;
+       char *data = NULL, *mask = NULL;
+       u16 *red = NULL, *green = NULL, *blue = NULL, *transp = NULL;
+       int err = -EINVAL;
        
-       if (copy_from_user(&cursor, sprite, sizeof(struct fb_cursor)))
+       if (copy_from_user(&cursor_user, sprite, sizeof(struct fb_cursor_user)))
                return -EFAULT;
 
+       memcpy(&cursor, &cursor_user, sizeof(cursor));
+       cursor.mask = NULL;
+       cursor.image.data = NULL;
+       cursor.image.cmap.red = NULL;
+       cursor.image.cmap.green = NULL;
+       cursor.image.cmap.blue = NULL;
+       cursor.image.cmap.transp = NULL;
+
        if (cursor.set & FB_CUR_SETCUR)
                info->cursor.enable = 1;
        
        if (cursor.set & FB_CUR_SETCMAP) {
-               err = fb_copy_cmap(&cursor.image.cmap, &sprite->image.cmap, 1);
-               if (err)
-                       return err;
+               unsigned len = cursor.image.cmap.len;
+               if ((int)len <= 0)
+                       goto out;
+               len *= 2;
+               err = -ENOMEM;
+               red = kmalloc(len, GFP_USER);
+               green = kmalloc(len, GFP_USER);
+               blue = kmalloc(len, GFP_USER);
+               if (!red || !green || !blue)
+                       goto out;
+               if (cursor_user.image.cmap.transp) {
+                       transp = kmalloc(len, GFP_USER);
+                       if (!transp)
+                               goto out;
+               }
+               err = -EFAULT;
+               if (copy_from_user(red, cursor_user.image.cmap.red, len))
+                       goto out;
+               if (copy_from_user(green, cursor_user.image.cmap.green, len))
+                       goto out;
+               if (copy_from_user(blue, cursor_user.image.cmap.blue, len))
+                       goto out;
+               if (transp) {
+                       if (copy_from_user(transp,
+                                          cursor_user.image.cmap.transp, len))
+                               goto out;
+               }
+               cursor.image.cmap.red = red;
+               cursor.image.cmap.green = green;
+               cursor.image.cmap.blue = blue;
+               cursor.image.cmap.transp = transp;
        }
        
        if (cursor.set & FB_CUR_SETSHAPE) {
                int size = ((cursor.image.width + 7) >> 3) * cursor.image.height;               
-               char *data, *mask;
 
                if ((cursor.image.height != info->cursor.image.height) ||
                    (cursor.image.width != info->cursor.image.width))
                        cursor.set |= FB_CUR_SETSIZE;
                
-               data = kmalloc(size, GFP_KERNEL);
-               if (!data)
-                       return -ENOMEM;
+               err = -ENOMEM;
+               data = kmalloc(size, GFP_USER);
+               mask = kmalloc(size, GFP_USER);
+               if (!mask || !data)
+                       goto out;
                
-               mask = kmalloc(size, GFP_KERNEL);
-               if (!mask) {
-                       kfree(data);
-                       return -ENOMEM;
-               }
+               err = -EFAULT;
+               if (copy_from_user(data, cursor_user.image.data, size) ||
+                   copy_from_user(mask, cursor_user.mask, size))
+                       goto out;
                
-               if (copy_from_user(data, sprite->image.data, size) ||
-                   copy_from_user(mask, sprite->mask, size)) {
-                       kfree(data);
-                       kfree(mask);
-                       return -EFAULT;
-               }
                cursor.image.data = data;
                cursor.mask = mask;
        }
        info->cursor.set = cursor.set;
        info->cursor.rop = cursor.rop;
        err = info->fbops->fb_cursor(info, &cursor);
+out:
+       kfree(data);
+       kfree(mask);
+       kfree(red);
+       kfree(green);
+       kfree(blue);
+       kfree(transp);
        return err;
 }
 
@@ -1033,7 +1073,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
 
                        fb_pan_display(info, &info->var);
 
-                       fb_set_cmap(&info->cmap, 1, info);
+                       fb_set_cmap(&info->cmap, info);
 
                        if (info->flags & FBINFO_MISC_MODECHANGEUSER) {
                                info->flags &= ~FBINFO_MISC_MODECHANGEUSER;
@@ -1062,7 +1102,7 @@ fb_blank(struct fb_info *info, int blank)
                cmap.len = info->cmap.len;
        } else
                cmap = info->cmap;
-       return fb_set_cmap(&cmap, 1, info);
+       return fb_set_cmap(&cmap, info);
 }
 
 static int 
@@ -1077,17 +1117,18 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
        struct fb_con2fbmap con2fb;
 #endif
-       struct fb_cmap cmap;
+       struct fb_cmap_user cmap;
+       void __user *argp = (void __user *)arg;
        int i;
        
        if (!fb)
                return -ENODEV;
        switch (cmd) {
        case FBIOGET_VSCREENINFO:
-               return copy_to_user((void *) arg, &info->var,
+               return copy_to_user(argp, &info->var,
                                    sizeof(var)) ? -EFAULT : 0;
        case FBIOPUT_VSCREENINFO:
-               if (copy_from_user(&var, (void *) arg, sizeof(var)))
+               if (copy_from_user(&var, argp, sizeof(var)))
                        return -EFAULT;
                acquire_console_sem();
                info->flags |= FBINFO_MISC_MODECHANGEUSER;
@@ -1095,47 +1136,47 @@ fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                info->flags &= ~FBINFO_MISC_MODECHANGEUSER;
                release_console_sem();
                if (i) return i;
-               if (copy_to_user((void *) arg, &var, sizeof(var)))
+               if (copy_to_user(argp, &var, sizeof(var)))
                        return -EFAULT;
                return 0;
        case FBIOGET_FSCREENINFO:
-               return copy_to_user((void *) arg, &info->fix,
+               return copy_to_user(argp, &info->fix,
                                    sizeof(fix)) ? -EFAULT : 0;
        case FBIOPUTCMAP:
-               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
+               if (copy_from_user(&cmap, argp, sizeof(cmap)))
                        return -EFAULT;
-               return (fb_set_cmap(&cmap, 0, info));
+               return (fb_set_user_cmap(&cmap, info));
        case FBIOGETCMAP:
-               if (copy_from_user(&cmap, (void *) arg, sizeof(cmap)))
+               if (copy_from_user(&cmap, argp, sizeof(cmap)))
                        return -EFAULT;
-               return (fb_copy_cmap(&info->cmap, &cmap, 2));
+               return fb_cmap_to_user(&info->cmap, &cmap);
        case FBIOPAN_DISPLAY:
-               if (copy_from_user(&var, (void *) arg, sizeof(var)))
+               if (copy_from_user(&var, argp, sizeof(var)))
                        return -EFAULT;
                acquire_console_sem();
                i = fb_pan_display(info, &var);
                release_console_sem();
                if (i)
                        return i;
-               if (copy_to_user((void *) arg, &var, sizeof(var)))
+               if (copy_to_user(argp, &var, sizeof(var)))
                        return -EFAULT;
                return 0;
        case FBIO_CURSOR:
                acquire_console_sem();
-               i = fb_cursor(info, (struct fb_cursor *) arg);
+               i = fb_cursor(info, argp);
                release_console_sem();
                return i;
 #ifdef CONFIG_FRAMEBUFFER_CONSOLE
        case FBIOGET_CON2FBMAP:
-               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
+               if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
                        return -EFAULT;
                if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
                    return -EINVAL;
                con2fb.framebuffer = con2fb_map[con2fb.console-1];
-               return copy_to_user((void *)arg, &con2fb,
+               return copy_to_user(argp, &con2fb,
                                    sizeof(con2fb)) ? -EFAULT : 0;
        case FBIOPUT_CON2FBMAP:
-               if (copy_from_user(&con2fb, (void *)arg, sizeof(con2fb)))
+               if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
                        return - EFAULT;
                if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES)
                    return -EINVAL;
index 152dde8..18938f1 100644 (file)
@@ -217,21 +217,21 @@ static inline void mga_memcpy_toio(vaddr_t va, unsigned int offs, const void* sr
 #ifdef MEMCPYTOIO_WORKS
        memcpy_toio(va.vaddr + offs, src, len);
 #elif defined(MEMCPYTOIO_WRITEL)
-#define srcd ((const u_int32_t*)src)
        if (offs & 3) {
                while (len >= 4) {
-                       mga_writel(va, offs, get_unaligned(srcd++));
+                       mga_writel(va, offs, get_unaligned((u32 *)src));
                        offs += 4;
                        len -= 4;
+                       src += 4;
                }
        } else {
                while (len >= 4) {
-                       mga_writel(va, offs, *srcd++);
+                       mga_writel(va, offs, *(u32 *)src);
                        offs += 4;
                        len -= 4;
+                       src += 4;
                }
        }
-#undef srcd
        if (len) {
                u_int32_t tmp;
 
index 50235d7..1f3f23f 100644 (file)
@@ -1221,7 +1221,7 @@ static int radeon_read_OF (struct radeonfb_info *rinfo)
 
        dp = pci_device_to_OF_node(rinfo->pdev);
 
-       xtal = (unsigned int *) get_property(dp, "ATY,RefCLK", 0);
+       xtal = (unsigned int *) get_property(dp, "ATY,RefCLK", NULL);
 
        rinfo->pll.ref_clk = *xtal / 10;
 
index bba8aad..fec7024 100644 (file)
@@ -48,6 +48,9 @@
 #include <asm/prom.h>
 #include <asm/pci-bridge.h>
 #endif
+#ifdef CONFIG_PMAC_BACKLIGHT
+#include <asm/backlight.h>
+#endif
 
 #include "rivafb.h"
 #include "nvreg.h"
  * various helpful macros and constants
  *
  * ------------------------------------------------------------------------- */
-
-#undef RIVAFBDEBUG
-#ifdef RIVAFBDEBUG
-#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args)
+#ifdef CONFIG_FB_RIVA_DEBUG
+#define NVTRACE          printk
 #else
-#define DPRINTK(fmt, args...)
+#define NVTRACE          if(0) printk
 #endif
 
-#ifndef RIVA_NDEBUG
+#define NVTRACE_ENTER(...)  NVTRACE("%s START\n", __FUNCTION__)
+#define NVTRACE_LEAVE(...)  NVTRACE("%s END\n", __FUNCTION__)
+
+#ifdef CONFIG_FB_RIVA_DEBUG
 #define assert(expr) \
        if(!(expr)) { \
        printk( "Assertion failed! %s,%s,%s,line=%d\n",\
@@ -173,18 +177,18 @@ static struct riva_chip_info {
        { "GeForce2-GTS", NV_ARCH_10 },
        { "GeForce2-ULTRA", NV_ARCH_10 },
        { "Quadro2-PRO", NV_ARCH_10 },
-       { "GeForce4-MX-460", NV_ARCH_20 },
-       { "GeForce4-MX-440", NV_ARCH_20 },
-       { "GeForce4-MX-420", NV_ARCH_20 },
-       { "GeForce4-440-GO", NV_ARCH_20 },
-       { "GeForce4-420-GO", NV_ARCH_20 },
-       { "GeForce4-420-GO-M32", NV_ARCH_20 },
-       { "Quadro4-500-XGL", NV_ARCH_20 },
-       { "GeForce4-440-GO-M64", NV_ARCH_20 },
-       { "Quadro4-200", NV_ARCH_20 },
-       { "Quadro4-550-XGL", NV_ARCH_20 },
-       { "Quadro4-500-GOGL", NV_ARCH_20 },
-       { "GeForce2", NV_ARCH_20 },
+       { "GeForce4-MX-460", NV_ARCH_10 },
+       { "GeForce4-MX-440", NV_ARCH_10 },
+       { "GeForce4-MX-420", NV_ARCH_10 },
+       { "GeForce4-440-GO", NV_ARCH_10 },
+       { "GeForce4-420-GO", NV_ARCH_10 },
+       { "GeForce4-420-GO-M32", NV_ARCH_10 },
+       { "Quadro4-500-XGL", NV_ARCH_10 },
+       { "GeForce4-440-GO-M64", NV_ARCH_10 },
+       { "Quadro4-200", NV_ARCH_10 },
+       { "Quadro4-550-XGL", NV_ARCH_10 },
+       { "Quadro4-500-GOGL", NV_ARCH_10 },
+       { "GeForce2", NV_ARCH_10 },
        { "GeForce3", NV_ARCH_20 }, 
        { "GeForce3 Ti 200", NV_ARCH_20 },
        { "GeForce3 Ti 500", NV_ARCH_20 },
@@ -351,6 +355,38 @@ static const struct riva_regs reg_template = {
        0xEB                                                    /* MISC */
 };
 
+/*
+ * Backlight control
+ */
+#ifdef CONFIG_PMAC_BACKLIGHT
+
+static int riva_backlight_levels[] = {
+    0x158,
+    0x192,
+    0x1c6,
+    0x200,
+    0x234,
+    0x268,
+    0x2a2,
+    0x2d6,
+    0x310,
+    0x344,
+    0x378,
+    0x3b2,
+    0x3e6,
+    0x41a,
+    0x454,
+    0x534,
+};
+
+static int riva_set_backlight_enable(int on, int level, void *data);
+static int riva_set_backlight_level(int level, void *data);
+static struct backlight_controller riva_backlight_controller = {
+       riva_set_backlight_enable,
+       riva_set_backlight_level
+};
+#endif /* CONFIG_PMAC_BACKLIGHT */
+
 /* ------------------------------------------------------------------------- *
  *
  * MMIO access macros
@@ -592,6 +628,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
 {
        int i;
 
+       NVTRACE_ENTER();
        par->riva.LockUnlock(&par->riva, 0);
 
        par->riva.UnloadStateExt(&par->riva, &regs->ext);
@@ -609,6 +646,7 @@ static void riva_save_state(struct riva_par *par, struct riva_regs *regs)
 
        for (i = 0; i < NUM_SEQ_REGS; i++)
                regs->seq[i] = SEQin(par, i);
+       NVTRACE_LEAVE();
 }
 
 /**
@@ -630,6 +668,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
        RIVA_HW_STATE *state = &regs->ext;
        int i;
 
+       NVTRACE_ENTER();
        CRTCout(par, 0x11, 0x00);
 
        par->riva.LockUnlock(&par->riva, 0);
@@ -656,6 +695,7 @@ static void riva_load_state(struct riva_par *par, struct riva_regs *regs)
 
        for (i = 0; i < NUM_SEQ_REGS; i++)
                SEQout(par, i, regs->seq[i]);
+       NVTRACE_LEAVE();
 }
 
 /**
@@ -676,6 +716,7 @@ static void riva_load_video_mode(struct fb_info *info)
        struct riva_par *par = (struct riva_par *) info->par;
        struct riva_regs newmode;
        
+       NVTRACE_ENTER();
        /* time to calculate */
        rivafb_blank(1, info);
 
@@ -806,10 +847,12 @@ static void riva_load_video_mode(struct fb_info *info)
        riva_load_state(par, &par->current_state);
        par->riva.LockUnlock(&par->riva, 0); /* important for HW cursor */
        rivafb_blank(0, info);
+       NVTRACE_LEAVE();
 }
 
 static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *modedb)
 {
+       NVTRACE_ENTER();
        var->xres = var->xres_virtual = modedb->xres;
        var->yres = modedb->yres;
         if (var->yres_virtual < var->yres)
@@ -824,6 +867,7 @@ static void riva_update_var(struct fb_var_screeninfo *var, struct fb_videomode *
         var->vsync_len = modedb->vsync_len;
         var->sync = modedb->sync;
         var->vmode = modedb->vmode;
+       NVTRACE_LEAVE();
 }
 
 /**
@@ -859,6 +903,7 @@ static int rivafb_do_maximize(struct fb_info *info,
        };
        int i;
 
+       NVTRACE_ENTER();
        /* use highest possible virtual resolution */
        if (var->xres_virtual == -1 && var->yres_virtual == -1) {
                printk(KERN_WARNING PFX
@@ -871,7 +916,7 @@ static int rivafb_do_maximize(struct fb_info *info,
                if (modes[i].xres == -1) {
                        printk(KERN_ERR PFX
                               "could not find a virtual resolution that fits into video memory!!\n");
-                       DPRINTK("EXIT - EINVAL error\n");
+                       NVTRACE("EXIT - EINVAL error\n");
                        return -EINVAL;
                }
                var->xres_virtual = modes[i].xres;
@@ -897,7 +942,7 @@ static int rivafb_do_maximize(struct fb_info *info,
                        printk(KERN_ERR PFX
                               "mode %dx%dx%d rejected...resolution too high to fit into video memory!\n",
                               var->xres, var->yres, var->bits_per_pixel);
-                       DPRINTK("EXIT - EINVAL error\n");
+                       NVTRACE("EXIT - EINVAL error\n");
                        return -EINVAL;
                }
        }
@@ -924,7 +969,7 @@ static int rivafb_do_maximize(struct fb_info *info,
                var->yres_virtual = 0x7fff/nom;
        if (var->xres_virtual > 0x7fff/nom)
                var->xres_virtual = 0x7fff/nom;
-
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1002,6 +1047,36 @@ static int riva_get_cmap_len(const struct fb_var_screeninfo *var)
        return rc;
 }
 
+/* ------------------------------------------------------------------------- *
+ *
+ * Backlight operations
+ *
+ * ------------------------------------------------------------------------- */
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+static int riva_set_backlight_enable(int on, int level, void *data)
+{
+       struct riva_par *par = (struct riva_par *)data;
+       U032 tmp_pcrt, tmp_pmc;
+
+       tmp_pmc = par->riva.PMC[0x10F0/4] & 0x0000FFFF;
+       tmp_pcrt = par->riva.PCRTC0[0x081C/4] & 0xFFFFFFFC;
+       if(on && (level > BACKLIGHT_OFF)) {
+               tmp_pcrt |= 0x1;
+               tmp_pmc |= (1 << 31); // backlight bit
+               tmp_pmc |= riva_backlight_levels[level-1] << 16; // level
+       }
+       par->riva.PCRTC0[0x081C/4] = tmp_pcrt;
+       par->riva.PMC[0x10F0/4] = tmp_pmc;
+       return 0;
+}
+
+static int riva_set_backlight_level(int level, void *data)
+{
+       return riva_set_backlight_enable(1, level, data);
+}
+#endif /* CONFIG_PMAC_BACKLIGHT */
+
 /* ------------------------------------------------------------------------- *
  *
  * framebuffer operations
@@ -1013,6 +1088,7 @@ static int rivafb_open(struct fb_info *info, int user)
        struct riva_par *par = (struct riva_par *) info->par;
        int cnt = atomic_read(&par->ref_count);
 
+       NVTRACE_ENTER();
        if (!cnt) {
                memset(&par->state, 0, sizeof(struct vgastate));
                par->state.flags = VGA_SAVE_MODE  | VGA_SAVE_FONTS;
@@ -1029,6 +1105,7 @@ static int rivafb_open(struct fb_info *info, int user)
                riva_save_state(par, &par->initial_state);
        }
        atomic_inc(&par->ref_count);
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1037,6 +1114,7 @@ static int rivafb_release(struct fb_info *info, int user)
        struct riva_par *par = (struct riva_par *) info->par;
        int cnt = atomic_read(&par->ref_count);
 
+       NVTRACE_ENTER();
        if (!cnt)
                return -EINVAL;
        if (cnt == 1) {
@@ -1047,6 +1125,7 @@ static int rivafb_release(struct fb_info *info, int user)
                par->riva.LockUnlock(&par->riva, 1);
        }
        atomic_dec(&par->ref_count);
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1056,6 +1135,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        int nom, den;           /* translating from pixels->bytes */
        int mode_valid = 0;
        
+       NVTRACE_ENTER();
        switch (var->bits_per_pixel) {
        case 1 ... 8:
                var->red.offset = var->green.offset = var->blue.offset = 0;
@@ -1101,7 +1181,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                printk(KERN_ERR PFX
                       "mode %dx%dx%d rejected...color depth not supported.\n",
                       var->xres, var->yres, var->bits_per_pixel);
-               DPRINTK("EXIT, returning -EINVAL\n");
+               NVTRACE("EXIT, returning -EINVAL\n");
                return -EINVAL;
        }
 
@@ -1191,6 +1271,7 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
            var->green.msb_right =
            var->blue.msb_right =
            var->transp.offset = var->transp.length = var->transp.msb_right = 0;
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1198,6 +1279,7 @@ static int rivafb_set_par(struct fb_info *info)
 {
        struct riva_par *par = (struct riva_par *) info->par;
 
+       NVTRACE_ENTER();
        riva_common_setup(par);
        RivaGetConfig(&par->riva, par->Chipset);
        /* vgaHWunlock() + riva unlock (0x7F) */
@@ -1211,6 +1293,7 @@ static int rivafb_set_par(struct fb_info *info)
        info->fix.line_length = (info->var.xres_virtual * (info->var.bits_per_pixel >> 3));
        info->fix.visual = (info->var.bits_per_pixel == 8) ?
                                FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_DIRECTCOLOR;
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1233,6 +1316,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var,
        struct riva_par *par = (struct riva_par *)info->par;
        unsigned int base;
 
+       NVTRACE_ENTER();
        if (var->xoffset > (var->xres_virtual - var->xres))
                return -EINVAL;
        if (var->yoffset > (var->yres_virtual - var->yres))
@@ -1259,6 +1343,7 @@ static int rivafb_pan_display(struct fb_var_screeninfo *var,
                info->var.vmode |= FB_VMODE_YWRAP;
        else
                info->var.vmode &= ~FB_VMODE_YWRAP;
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1270,6 +1355,7 @@ static int rivafb_blank(int blank, struct fb_info *info)
        tmp = SEQin(par, 0x01) & ~0x20; /* screen on/off */
        vesa = CRTCin(par, 0x1a) & ~0xc0;       /* sync on/off */
 
+       NVTRACE_ENTER();
        if (blank) {
                tmp |= 0x20;
                switch (blank - 1) {
@@ -1288,6 +1374,14 @@ static int rivafb_blank(int blank, struct fb_info *info)
        }
        SEQout(par, 0x01, tmp);
        CRTCout(par, 0x1a, vesa);
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+       if ( par->FlatPanel && _machine == _MACH_Pmac) {
+               set_backlight_enable(!blank);
+       }
+#endif
+
+       NVTRACE_LEAVE();
        return 0;
 }
 
@@ -1676,6 +1770,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
 {
        unsigned int cmap_len;
 
+       NVTRACE_ENTER();
        info->flags = FBINFO_DEFAULT
                    | FBINFO_HWACCEL_XPAN
                    | FBINFO_HWACCEL_YPAN
@@ -1696,6 +1791,7 @@ static int __devinit riva_set_fbinfo(struct fb_info *info)
        info->pixmap.scan_align = 4;
        info->pixmap.flags = FB_PIXMAP_SYSTEM;
        info->var.yres_virtual = -1;
+       NVTRACE_LEAVE();
        return (rivafb_check_var(&info->var, info));
 }
 
@@ -1710,6 +1806,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
                "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL };
        int i;
 
+       NVTRACE_ENTER();
        dp = pci_device_to_OF_node(pd);
        for (; dp != NULL; dp = dp->child) {
                disptype = (unsigned char *)get_property(dp, "display-type", NULL);
@@ -1726,6 +1823,7 @@ static int riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
                        }
                }
        }
+       NVTRACE_LEAVE();
                return 0;
 }
 #endif /* CONFIG_PPC_OF */
@@ -1735,6 +1833,7 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf
        struct fb_monspecs *specs = &info->monspecs;
        struct fb_videomode modedb;
 
+       NVTRACE_ENTER();
        /* respect mode options */
        if (mode_option) {
                fb_find_mode(var, info, mode_option,
@@ -1759,20 +1858,24 @@ static void riva_update_default_var(struct fb_var_screeninfo *var, struct fb_inf
                riva_update_var(var, &modedb);
        }
        var->accel_flags |= FB_ACCELF_TEXT;
+       NVTRACE_LEAVE();
 }
 
 
 static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
 {
+       struct riva_par *par;
+       int i;
+
+       NVTRACE_ENTER();
 #ifdef CONFIG_PPC_OF
        if (!riva_get_EDID_OF(info, pdev))
                printk("rivafb: could not retrieve EDID from OF\n");
 #else
        /* XXX use other methods later */
 #ifdef CONFIG_FB_RIVA_I2C
-       struct riva_par *par = (struct riva_par *) info->par;
-       int i;
 
+       par = (struct riva_par *) info->par;
        riva_create_i2c_busses(par);
        for (i = par->bus; i >= 1; i--) {
                riva_probe_i2c_connector(par, i, &par->EDID);
@@ -1784,6 +1887,7 @@ static void riva_get_EDID(struct fb_info *info, struct pci_dev *pdev)
        riva_delete_i2c_busses(par);
 #endif
 #endif
+       NVTRACE_LEAVE();
 }
 
 
@@ -1813,6 +1917,7 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
        struct riva_par *default_par;
        struct fb_info *info;
 
+       NVTRACE_ENTER();
        assert(pd != NULL);
        assert(rci != NULL);
 
@@ -1958,6 +2063,12 @@ static int __devinit rivafb_probe(struct pci_dev *pd,
                info->fix.id,
                info->fix.smem_len / (1024 * 1024),
                info->fix.smem_start);
+#ifdef CONFIG_PMAC_BACKLIGHT
+       if (default_par->FlatPanel && _machine == _MACH_Pmac)
+       register_backlight_controller(&riva_backlight_controller,
+                                               default_par, "mnca");
+#endif
+       NVTRACE_LEAVE();
        return 0;
 
 err_out_iounmap_fb:
@@ -1986,6 +2097,7 @@ static void __exit rivafb_remove(struct pci_dev *pd)
        struct fb_info *info = pci_get_drvdata(pd);
        struct riva_par *par = (struct riva_par *) info->par;
        
+       NVTRACE_ENTER();
        if (!info)
                return;
 
@@ -2007,6 +2119,7 @@ static void __exit rivafb_remove(struct pci_dev *pd)
        kfree(par);
        kfree(info);
        pci_set_drvdata(pd, NULL);
+       NVTRACE_LEAVE();
 }
 
 /* ------------------------------------------------------------------------- *
@@ -2020,6 +2133,7 @@ int __init rivafb_setup(char *options)
 {
        char *this_opt;
 
+       NVTRACE_ENTER();
        if (!options || !*options)
                return 0;
 
@@ -2043,6 +2157,7 @@ int __init rivafb_setup(char *options)
                } else
                        mode_option = this_opt;
        }
+       NVTRACE_LEAVE();
        return 0;
 }
 #endif /* !MODULE */
index 1bca4cd..ae8fb7a 100644 (file)
@@ -1074,7 +1074,7 @@ static int sa1100fb_blank(int blank, struct fb_info *info)
        case VESA_NO_BLANKING:
                if (fbi->fb.fix.visual == FB_VISUAL_PSEUDOCOLOR ||
                    fbi->fb.fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR)
-                       fb_set_cmap(&fbi->fb.cmap, 1, info);
+                       fb_set_cmap(&fbi->fb.cmap, info);
                sa1100fb_schedule_work(fbi, C_ENABLE);
        }
        return 0;
@@ -1291,8 +1291,7 @@ static void sa1100fb_enable_controller(struct sa1100fb_info *fbi)
 #error Where is GPIO24 set as an output?  Can we fit this in somewhere else?
        if (machine_is_graphicsclient()) {
                // From ADS doc again...same as disable
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(20 * HZ / 1000);
+               msleep(20);
                GPSR |= GPIO_GPIO24;
        }
 #endif
@@ -1327,8 +1326,7 @@ static void sa1100fb_disable_controller(struct sa1100fb_info *fbi)
                 * We'll wait 20msec.
                 */
                GPCR |= GPIO_GPIO24;
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(20 * HZ / 1000);
+               msleep(20);
        }
 #endif
 #ifdef CONFIG_SA1100_HUW_WEBPANEL
index aa1f313..9ad218d 100644 (file)
@@ -1566,10 +1566,10 @@ sisfb_do_install_cmap(int con, struct fb_info *info)
         if(con != ivideo->currcon) return;
 
         if(fb_display[con].cmap.len) {
-               fb_set_cmap(&fb_display[con].cmap, 1, sisfb_setcolreg, info);
+               fb_set_cmap(&fb_display[con].cmap, sisfb_setcolreg, info);
         } else {
                int size = sisfb_get_cmap_len(&fb_display[con].var);
-               fb_set_cmap(fb_default_cmap(size), 1, sisfb_setcolreg, info);
+               fb_set_cmap(fb_default_cmap(size), sisfb_setcolreg, info);
        }
 }
 
index f385759..a953b46 100644 (file)
@@ -43,7 +43,7 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
                        info->cursor.image.fg_color = cursor->image.fg_color;
                } else {
                        if (cursor->image.cmap.len)
-                               fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap, 0);
+                               fb_copy_cmap(&cursor->image.cmap, &info->cursor.image.cmap);
                }
                info->cursor.image.depth = cursor->image.depth;
        }       
index f3aa37e..2873877 100644 (file)
@@ -1050,7 +1050,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
                bg_color = ((cmap.red[cmap.start+1] << 16) |
                            (cmap.green[cmap.start+1] << 8) |
                            (cmap.blue[cmap.start+1]));
-               fb_copy_cmap(&cmap, &info->cursor.image.cmap, 0);
+               fb_copy_cmap(&cmap, &info->cursor.image.cmap);
                spin_lock_irqsave(&par->DAClock, flags);
                banshee_make_room(par, 2);
                tdfx_outl(par, HWCURC0, bg_color);
index e9ce544..460a4cb 100644 (file)
@@ -1183,24 +1183,20 @@ config JFFS2_FS_DEBUG
          messages at debug level 1 while the misbehaviour was occurring.
 
 config JFFS2_FS_NAND
-       bool "JFFS2 support for NAND flash (EXPERIMENTAL)"
-       depends on JFFS2_FS && EXPERIMENTAL
+       bool "JFFS2 support for NAND flash"
+       depends on JFFS2_FS
        default n
        help
-         This enables the experimental support for NAND flash in JFFS2. NAND
-         is a newer type of flash chip design than the traditional NOR flash,
-         with higher density but a handful of characteristics which make it
-         more interesting for the file system to use. Support for NAND flash
-         is not yet complete and may corrupt data. For further information,
-         including a link to the mailing list where details of the remaining
-         work to be completed for NAND flash support can be found, see the 
-         JFFS2 web site at <http://sources.redhat.com/jffs2>.
+         This enables the support for NAND flash in JFFS2. NAND is a newer
+         type of flash chip design than the traditional NOR flash, with
+         higher density but a handful of characteristics which make it more
+         interesting for the file system to use.
 
-         Say 'N' unless you have NAND flash and you are willing to test and
-         develop JFFS2 support for it.
+         Say 'N' unless you have NAND flash.
 
 config JFFS2_COMPRESSION_OPTIONS
        bool "Advanced compression options for JFFS2"
+       depends on JFFS2_FS
        default n
        help
          Enabling this option allows you to explicitly choose which
@@ -1266,15 +1262,6 @@ config JFFS2_CMODE_SIZE
 
 endchoice
 
-config JFFS2_PROC
-       bool "JFFS2 proc interface support" if JFFS2_COMPRESSION_OPTIONS
-       depends on JFFS2_FS && PROC_FS
-       default n
-        help
-          You can read some statistics and set the compression mode and
-          compressor priorities with this interface.
-
-
 config CRAMFS
        tristate "Compressed ROM file system support"
        select ZLIB_INFLATE
@@ -1705,6 +1692,22 @@ config CIFS_STATS
           Enabling this option will cause statistics for each server share
          mounted by the cifs client to be displayed in /proc/fs/cifs/Stats
 
+config CIFS_XATTR
+        bool "CIFS extended attributes (EXPERIMENTAL)"
+        depends on CIFS
+        help
+          Extended attributes are name:value pairs associated with inodes by
+          the kernel or by users (see the attr(5) manual page, or visit
+          <http://acl.bestbits.at/> for details).  CIFS maps the name of
+          extended attributes beginning with the user namespace prefix
+          to SMB/CIFS EAs. EAs are stored on Windows servers without the
+          user namespace prefix, but their names are seen by Linux cifs clients
+          prefaced by the user namespace prefix. The system namespace
+          (used by some filesystems to store ACLs) is not supported at
+          this time.
+                                                                                                    
+          If unsure, say N.
+
 config CIFS_POSIX
         bool "CIFS POSIX Extensions (EXPERIMENTAL)"
         depends on CIFS
index ee8feb0..59d1feb 100644 (file)
@@ -308,9 +308,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                (current->mm->start_data = N_DATADDR(ex));
        current->mm->brk = ex.a_bss +
                (current->mm->start_brk = N_BSSADDR(ex));
-       current->mm->free_area_cache = TASK_UNMAPPED_BASE;
-       /* unlimited stack is larger than TASK_SIZE */
-       current->mm->non_executable_cache = current->mm->mmap_top;
+       current->mm->free_area_cache = current->mm->mmap_base;
+
        // current->mm->rss = 0;
        vx_rsspages_sub(current->mm, current->mm->rss);
        current->mm->mmap = NULL;
@@ -351,7 +350,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                        return error;
                }
 
-               error = bprm->file->f_op->read(bprm->file, (char *)text_addr,
+               error = bprm->file->f_op->read(bprm->file,
+                         (char __user *)text_addr,
                          ex.a_text+ex.a_data, &pos);
                if ((signed long)error < 0) {
                        send_sig(SIGKILL, current, 0);
@@ -380,7 +380,8 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                if (!bprm->file->f_op->mmap||((fd_offset & ~PAGE_MASK) != 0)) {
                        loff_t pos = fd_offset;
                        do_brk(N_TXTADDR(ex), ex.a_text+ex.a_data);
-                       bprm->file->f_op->read(bprm->file,(char *)N_TXTADDR(ex),
+                       bprm->file->f_op->read(bprm->file,
+                                       (char __user *)N_TXTADDR(ex),
                                        ex.a_text+ex.a_data, &pos);
                        flush_icache_range((unsigned long) N_TXTADDR(ex),
                                           (unsigned long) N_TXTADDR(ex) +
@@ -482,7 +483,7 @@ static int load_aout_library(struct file *file)
 
                do_brk(start_addr, ex.a_text + ex.a_data + ex.a_bss);
                
-               file->f_op->read(file, (char *)start_addr,
+               file->f_op->read(file, (char __user *)start_addr,
                        ex.a_text + ex.a_data, &pos);
                flush_icache_range((unsigned long) start_addr,
                                   (unsigned long) start_addr + ex.a_text + ex.a_data);
index 9e71db4..82294d3 100644 (file)
@@ -189,7 +189,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
        NEW_AUX_ENT(AT_EGID, (elf_addr_t) tsk->egid);
        NEW_AUX_ENT(AT_SECURE, (elf_addr_t) security_bprm_secureexec(bprm));
        if (k_platform) {
-               NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(long)u_platform);
+               NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(unsigned long)u_platform);
        }
        if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) {
                NEW_AUX_ENT(AT_EXECFD, (elf_addr_t) bprm->interp_data);
@@ -225,8 +225,8 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
        if (interp_aout) {
                argv = sp + 2;
                envp = argv + argc + 1;
-               __put_user((elf_addr_t)(long)argv, sp++);
-               __put_user((elf_addr_t)(long)envp, sp++);
+               __put_user((elf_addr_t)(unsigned long)argv, sp++);
+               __put_user((elf_addr_t)(unsigned long)envp, sp++);
        } else {
                argv = sp;
                envp = argv + argc + 1;
@@ -528,7 +528,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        struct exec interp_ex;
        char passed_fileno[6];
        struct files_struct *files;
-       int executable_stack, relocexec, old_relocexec = current->flags & PF_RELOCEXEC;
+       int have_pt_gnu_stack, executable_stack, relocexec, old_relocexec = current->flags & PF_RELOCEXEC;
        unsigned long def_flags = 0;
        
        /* Get the exec-header */
@@ -665,8 +665,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                                executable_stack = EXSTACK_DISABLE_X;
                        break;
                }
-       if (i == elf_ex.e_phnum)
-               def_flags |= VM_EXEC | VM_MAYEXEC;
+       have_pt_gnu_stack = (i < elf_ex.e_phnum);
 
        relocexec = 0;
 
@@ -761,22 +760,20 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
        current->mm->end_data = 0;
        current->mm->end_code = 0;
        current->mm->mmap = NULL;
-#ifdef __HAVE_ARCH_MMAP_TOP
-       current->mm->mmap_top = mmap_top();
-#endif
        current->flags &= ~PF_FORKNOEXEC;
        current->mm->def_flags = def_flags;
 
        /* Do this immediately, since STACK_TOP as used in setup_arg_pages
           may depend on the personality.  */
        SET_PERSONALITY(elf_ex, ibcs2_interpreter);
+       if (elf_read_implies_exec(elf_ex, have_pt_gnu_stack))
+               current->personality |= READ_IMPLIES_EXEC;
 
        /* Do this so that we can load the interpreter, if need be.  We will
           change some of these later */
        // current->mm->rss = 0;
        vx_rsspages_sub(current->mm, current->mm->rss);
-       current->mm->free_area_cache = TASK_UNMAPPED_BASE;
-       current->mm->non_executable_cache = current->mm->mmap_top;
+       current->mm->free_area_cache = current->mm->mmap_base;
        retval = setup_arg_pages(bprm, executable_stack);
        if (retval < 0) {
                send_sig(SIGKILL, current, 0);
index ac03005..e246f54 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -376,6 +376,115 @@ int bio_add_page(struct bio *bio, struct page *page, unsigned int len,
                              len, offset);
 }
 
+/**
+ *     bio_uncopy_user -       finish previously mapped bio
+ *     @bio: bio being terminated
+ *
+ *     Free pages allocated from bio_copy_user() and write back data
+ *     to user space in case of a read.
+ */
+int bio_uncopy_user(struct bio *bio)
+{
+       struct bio_vec *bvec;
+       int i, ret = 0;
+
+       if (bio_data_dir(bio) == READ) {
+               char *uaddr = bio->bi_private;
+
+               __bio_for_each_segment(bvec, bio, i, 0) {
+                       char *addr = page_address(bvec->bv_page);
+
+                       if (!ret && copy_to_user(uaddr, addr, bvec->bv_len))
+                               ret = -EFAULT;
+
+                       __free_page(bvec->bv_page);
+                       uaddr += bvec->bv_len;
+               }
+       }
+
+       bio_put(bio);
+       return ret;
+}
+
+/**
+ *     bio_copy_user   -       copy user data to bio
+ *     @q: destination block queue
+ *     @uaddr: start of user address
+ *     @len: length in bytes
+ *     @write_to_vm: bool indicating writing to pages or not
+ *
+ *     Prepares and returns a bio for indirect user io, bouncing data
+ *     to/from kernel pages as necessary. Must be paired with
+ *     call bio_uncopy_user() on io completion.
+ */
+struct bio *bio_copy_user(request_queue_t *q, unsigned long uaddr,
+                         unsigned int len, int write_to_vm)
+{
+       unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
+       unsigned long start = uaddr >> PAGE_SHIFT;
+       struct bio_vec *bvec;
+       struct page *page;
+       struct bio *bio;
+       int i, ret;
+
+       bio = bio_alloc(GFP_KERNEL, end - start);
+       if (!bio)
+               return ERR_PTR(-ENOMEM);
+
+       ret = 0;
+       while (len) {
+               unsigned int bytes = PAGE_SIZE;
+
+               if (bytes > len)
+                       bytes = len;
+
+               page = alloc_page(q->bounce_gfp | GFP_KERNEL);
+               if (!page) {
+                       ret = -ENOMEM;
+                       break;
+               }
+
+               if (__bio_add_page(q, bio, page, bytes, 0) < bytes) {
+                       ret = -EINVAL;
+                       break;
+               }
+
+               len -= bytes;
+       }
+
+       /*
+        * success
+        */
+       if (!ret) {
+               if (!write_to_vm) {
+                       bio->bi_rw |= (1 << BIO_RW);
+                       /*
+                        * for a write, copy in data to kernel pages
+                        */
+                       ret = -EFAULT;
+                       bio_for_each_segment(bvec, bio, i) {
+                               char *addr = page_address(bvec->bv_page);
+
+                               if (copy_from_user(addr, (char *) uaddr, bvec->bv_len))
+                                       goto cleanup;
+                       }
+               }
+
+               bio->bi_private = (void *) uaddr;
+               return bio;
+       }
+
+       /*
+        * cleanup
+        */
+cleanup:
+       bio_for_each_segment(bvec, bio, i)
+               __free_page(bvec->bv_page);
+
+       bio_put(bio);
+       return ERR_PTR(ret);
+}
+
 static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev,
                                  unsigned long uaddr, unsigned int len,
                                  int write_to_vm)
@@ -392,12 +501,13 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev,
         * size for now, in the future we can relax this restriction
         */
        if ((uaddr & queue_dma_alignment(q)) || (len & queue_dma_alignment(q)))
-               return NULL;
+               return ERR_PTR(-EINVAL);
 
        bio = bio_alloc(GFP_KERNEL, nr_pages);
        if (!bio)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
+       ret = -ENOMEM;
        pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL);
        if (!pages)
                goto out;
@@ -446,12 +556,12 @@ static struct bio *__bio_map_user(request_queue_t *q, struct block_device *bdev,
        if (!write_to_vm)
                bio->bi_rw |= (1 << BIO_RW);
 
-       blk_queue_bounce(q, &bio);
+       bio->bi_flags |= (1 << BIO_USER_MAPPED);
        return bio;
 out:
        kfree(pages);
        bio_put(bio);
-       return NULL;
+       return ERR_PTR(ret);
 }
 
 /**
@@ -462,7 +572,7 @@ out:
  *     @write_to_vm: bool indicating writing to pages or not
  *
  *     Map the user space address into a bio suitable for io to a block
- *     device.
+ *     device. Returns an error pointer in case of error.
  */
 struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev,
                         unsigned long uaddr, unsigned int len, int write_to_vm)
@@ -471,26 +581,29 @@ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev,
 
        bio = __bio_map_user(q, bdev, uaddr, len, write_to_vm);
 
-       if (bio) {
-               /*
-                * subtle -- if __bio_map_user() ended up bouncing a bio,
-                * it would normally disappear when its bi_end_io is run.
-                * however, we need it for the unmap, so grab an extra
-                * reference to it
-                */
-               bio_get(bio);
+       if (IS_ERR(bio))
+               return bio;
 
-               if (bio->bi_size < len) {
-                       bio_endio(bio, bio->bi_size, 0);
-                       bio_unmap_user(bio, 0);
-                       return NULL;
-               }
-       }
+       /*
+        * subtle -- if __bio_map_user() ended up bouncing a bio,
+        * it would normally disappear when its bi_end_io is run.
+        * however, we need it for the unmap, so grab an extra
+        * reference to it
+        */
+       bio_get(bio);
 
-       return bio;
+       if (bio->bi_size == len)
+               return bio;
+
+       /*
+        * don't support partial mappings
+        */
+       bio_endio(bio, bio->bi_size, 0);
+       bio_unmap_user(bio);
+       return ERR_PTR(-EINVAL);
 }
 
-static void __bio_unmap_user(struct bio *bio, int write_to_vm)
+static void __bio_unmap_user(struct bio *bio)
 {
        struct bio_vec *bvec;
        int i;
@@ -511,7 +624,7 @@ static void __bio_unmap_user(struct bio *bio, int write_to_vm)
         * make sure we dirty pages we wrote to
         */
        __bio_for_each_segment(bvec, bio, i, 0) {
-               if (write_to_vm)
+               if (bio_data_dir(bio) == READ)
                        set_page_dirty_lock(bvec->bv_page);
 
                page_cache_release(bvec->bv_page);
@@ -523,17 +636,15 @@ static void __bio_unmap_user(struct bio *bio, int write_to_vm)
 /**
  *     bio_unmap_user  -       unmap a bio
  *     @bio:           the bio being unmapped
- *     @write_to_vm:   bool indicating whether pages were written to
  *
- *     Unmap a bio previously mapped by bio_map_user(). The @write_to_vm
- *     must be the same as passed into bio_map_user(). Must be called with
+ *     Unmap a bio previously mapped by bio_map_user(). Must be called with
  *     a process context.
  *
  *     bio_unmap_user() may sleep.
  */
-void bio_unmap_user(struct bio *bio, int write_to_vm)
+void bio_unmap_user(struct bio *bio)
 {
-       __bio_unmap_user(bio, write_to_vm);
+       __bio_unmap_user(bio);
        bio_put(bio);
 }
 
@@ -864,3 +975,5 @@ EXPORT_SYMBOL(bio_unmap_user);
 EXPORT_SYMBOL(bio_pair_release);
 EXPORT_SYMBOL(bio_split);
 EXPORT_SYMBOL(bio_split_pool);
+EXPORT_SYMBOL(bio_copy_user);
+EXPORT_SYMBOL(bio_uncopy_user);
index 3f16637..a853ec0 100644 (file)
@@ -1,3 +1,21 @@
+Version 1.22
+------------
+Add config option to enable XATTR (extended attribute) support, mapping
+xattr names in the "user." namespace space to SMB/CIFS EAs.
+
+Version 1.21
+------------
+Add new mount parm to control whether mode check (vfs_permission) is done on
+the client.  If Unix extensions are enabled and the uids on the client
+and server do not match, client permission checks are meaningless on
+server uids that do not exist on the client (this does not affect the
+normal ACL check which occurs on the server).  Fix default uid
+on mknod to match create and mkdir. Add optional mount parm to allow
+override of the default uid behavior (in which the server sets the uid
+and gid of newly created files). Normally for network filesystem mounts
+user want the server to set the uid/gid on newly created files (rather than 
+using uid of the client processes you would in a local filesystem).
+
 Version 1.20
 ------------
 Make transaction counts more consistent. Merge /proc/fs/cifs/SimultaneousOps
index 59a00ee..acf1448 100644 (file)
@@ -31,7 +31,7 @@ the cifs download to your kernel build directory e.g.
 5) make dep
 6) make modules (or "make" if CIFS VFS not to be built as a module)
 
-For Linux 2.5:
+For Linux 2.6:
 1) Download the kernel (e.g. from http://www.kernel.org or from bitkeeper
 at bk://linux.bkbits.net/linux-2.5) and change directory into the top
 of the kernel directory tree (e.g. /usr/src/linux-2.5.73)
@@ -56,7 +56,7 @@ the CIFS VFS web site) copy it to the same directory in which mount.smbfs and
 similar files reside (usually /sbin).  Although the helper software is not  
 required, mount.cifs is recommended.  Eventually the Samba 3.0 utility program 
 "net" may also be helpful since it may someday provide easier mount syntax for
-users who are used to Windows e.g.  net use <mount point> <UNC name or cifs URL>  
+users who are used to Windows e.g.  net use <mount point> <UNC name or cifs URL>
 Note that running the Winbind pam/nss module (logon service) on all of your
 Linux clients is useful in mapping Uids and Gids consistently across the
 domain to the proper network user.  The mount.cifs mount helper can be
@@ -64,6 +64,17 @@ trivially built from Samba 3.0 or later source e.g. by executing:
 
        gcc samba/source/client/mount.cifs.c -o mount.cifs
 
+Allowing User Mounts
+====================
+To permit users to mount and unmount over directories they own is possible
+with the cifs vfs.  A way to enable such mounting is to mark the mount.cifs
+utility as suid (e.g. "chmod +s /sbin/mount/cifs). To enable users to 
+umount shares they mount requires
+1) mount.cifs version 1.4 or later
+2) an entry for the share in /etc/fstab indicating that a user may
+unmount it e.g.
+//server/usersharename  /mnt/username cifs user 0 0
+
 Note that when the mount.cifs utility is run suid (allowing user mounts), 
 in order to reduce risks, the "nosuid" mount flag is passed in on mount to
 disallow execution of an suid program mounted on the remote target.
@@ -99,21 +110,27 @@ Linux:
        delete readonly = yes 
        ea support = yes
 
-Note that ea support is required for supporting Linux xattrs. 
-Some administrators also change the "map archive" and the "create mask" 
-parameters from their default values.  Creating special devices (mknod) 
+Note that server ea support is required for supporting xattrs from the Linux
+cifs client, and that EA support is present in later versions of Samba (e.g. 
+3.0.6 and later (also EA support works in all versions of Windows, at least to
+shares on NTFS filesystems).  Extended Attribute (xattr) support is an optional
+feature of most Linux filesystems which may require enabling via
+make menuconfig
+Some administrators may want to change Samba's smb.conf "map archive" and 
+"create mask" parameters from the default.  Creating special devices (mknod) 
 remotely may require specifying a mkdev function to Samba if you are not using 
-Samba 3.0.5 or later.  For more information on these see the manual pages
+Samba 3.0.6 or later.  For more information on these see the manual pages
 ("man smb.conf") on the Samba server system.  Note that the cifs vfs,
 unlike the smbfs vfs, does not read the smb.conf on the client system 
 (the few optional settings are passed in on mount via -o parameters instead).  
 Note that Samba 2.2.7 or later includes a fix that allows the CIFS VFS to delete
 open files (required for strict POSIX compliance).  Windows Servers already 
 supported this feature. Samba server does not allow symlinks that refer to files
-outside of the share, so in Samba versions prior to 3.0.5, most symlinks to
+outside of the share, so in Samba versions prior to 3.0.6, most symlinks to
 files with absolute paths (ie beginning with slash) such as:
         ln -s /mnt/foo bar
-would be forbidden. Samba 3.0.5 server or later includes the ability to create 
+would be forbidden. Samba 3.0.6 server or later includes the ability to create 
 such symlinks safely by converting unsafe symlinks (ie symlinks to server 
 files that are outside of the share) to a samba specific format on the server
 that is ignored by local server applications and non-cifs clients and that will
@@ -148,6 +165,12 @@ of the standard mount options "noexec" and "nosuid" to reduce the risk of
 running an altered binary on your local system (downloaded from a hostile server
 or altered by a hostile router).
 
+Although mounting using format corresponding to the CIFS URL specification is
+not possible in mount.cifs yet, it is possible to use an alternate format
+for the server and sharename (which is somewhat similar to NFS style mount
+syntax) instead of the more widely used UNC format (i.e. \\server\share):
+  mount -t cifs tcp_name_of_server:share_name /mnt -o user=myname,pass=mypasswd
+
 When using the mount helper mount.cifs, passwords may be specified via alternate
 mechanisms, instead of specifying it after -o using the normal "pass=" syntax
 on the command line:
@@ -255,7 +278,33 @@ A partial list of the supported mount options follows:
                mount helper will not prompt the user for a password
                if guest is specified on the mount options.  If no
                password is specified a null password will be used.
-
+  perm          Client does permission checks (vfs_permission check of uid
+               and gid of the file against the mode and desired operation),
+               Note that this is in addition to the normal ACL check on the
+               target machine done by the server software. 
+               Client permission checking is enabled by default.
+  noperm        Client does not do permission checks.  This can expose
+               files on this mount to access by other users on the local
+               client system. It is typically only needed when the server
+               supports the CIFS Unix Extensions but the UIDs/GIDs on the
+               client and server system do not match closely enough to allow
+               access by the user doing the mount.
+               Note that this does not affect the normal ACL check on the
+               target machine done by the server software (of the server
+               ACL against the user name provided at mount time).
+  setuids       If the CIFS Unix extensions are negotiated with the server
+               the client will attempt to set the effective uid and gid of
+               the local process on newly created files, directories, and
+               devices (create, mkdir, mknod).
+  nosetuids     The client will not attempt to set the uid and gid on
+               on newly created files, directories, and devices (create, 
+               mkdir, mknod) which will result in the server setting the
+               uid and gid to the default (usually the server uid of the
+               usern who mounted the share).  Letting the server (rather than
+               the client) set the uid and gid is the default. This
+               parameter has no effect if the CIFS Unix Extensions are not
+               negotiated.
+               
 The mount.cifs mount helper also accepts a few mount options before -o
 including:
 
@@ -325,13 +374,11 @@ and for more extensive tracing including the start of smb requests and responses
 
        echo 1 > /proc/fs/cifs/traceSMB
 
-Three other experimental features are under development and to test 
+Two other experimental features are under development and to test 
 require enabling an ifdef (e.g. by  adding "#define CIFS_FCNTL" in cifsglob.h)
 
        CONFIG_CIFS_QUOTA
 
-       CONFIG_CIFS_XATTR
-
        CONFIG_CIFS_FCNTL  (fcntl needed for support of directory change 
                            notification and perhaps later for file leases)
 
index 51b230e..05464a3 100644 (file)
@@ -1,4 +1,4 @@
-version 1.16 May 27, 2004
+version 1.22 July 30, 2004 
 
 A Partial List of Missing Features
 ==================================
@@ -10,7 +10,8 @@ is a partial list of the known problems and missing features:
 a) Support for SecurityDescriptors for chmod/chgrp/chown so
 these can be supported for Windows servers
 
-b) Better pam/winbind integration
+b) Better pam/winbind integration (e.g. to handle uid mapping
+better)
 
 c) multi-user mounts - multiplexed sessionsetups over single vc
 (ie tcp session) - prettying up needed
@@ -32,42 +33,37 @@ style byte range lock differences
 
 h) quota support
 
-i) support for the Linux 2.5 kernel new feature get_xattr and set_xattr
-which will allow us to expose dos attributes as well as real
-ACLs. This support has been started in the current code, but is
-ifdeffed out.
-
-k) finish writepages support (multi-page write behind for improved
+j) finish writepages support (multi-page write behind for improved
 performance) and syncpage
 
-l) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
+k) hook lower into the sockets api (as NFS/SunRPC does) to avoid the
 extra copy in/out of the socket buffers in some cases.
 
-m) finish support for IPv6.  This is mostly complete but
+l) finish support for IPv6.  This is mostly complete but
 needs a simple inet_pton like function to convert ipv6
 addresses in string representation.
 
-o) Better optimize open (and pathbased setfilesize) to reduce the
+m) Better optimize open (and pathbased setfilesize) to reduce the
 oplock breaks coming from windows srv.  Piggyback identical file
 opens on top of each other by incrementing reference count rather
 than resending (helps reduce server resource utilization and avoid
 spurious oplock breaks).
 
-p) Improve performance of readpages by sending more than one read
+o) Improve performance of readpages by sending more than one read
 at a time when 8 pages or more are requested.  Evaluate whether
 reads larger than 16K would be helpful.
 
-q) For support of Windows9x/98 we need to retry failed mounts
+p) For support of Windows9x/98 we need to retry failed mounts
 to *SMBSERVER (default server name) with the uppercase hostname
 in the RFC1001 session_init request.
 
-r) Add Extended Attributed support (for storing UID/GID info
-to Windows servers)
+q) Add support for storing symlink and fifo info to Windows servers 
+in the Extended Attribute format their SFU clients would recognize.
 
-s) Finish fcntl D_NOTIFY support so kde and gnome file list windows
+r) Finish fcntl D_NOTIFY support so kde and gnome file list windows
 will autorefresh
 
-t) Add GUI tool to configure /proc/fs/cifs settings and for display of
+s) Add GUI tool to configure /proc/fs/cifs settings and for display of
 the CIFS statistics
 
 KNOWN BUGS (updated May 27, 2004)
@@ -87,11 +83,14 @@ Samba (may be unmappable due to POSIX to Windows lock model
 differences but worth investigating).  Also debug Samba to 
 see why lock test case 7 takes longer to complete to Samba
 than to Windows.
+5) implement search rewind (seeking backward in a readdir), which is
+necessary for one of the "special" subsection of posix file API
+tests in the Connectathon nfs test suite.
 
 Misc testing to do
 ==================
 1) check out max path names and max path name components against various server
-types. Try nested symlinks. Return max path name in stat -f information
+types. Try nested symlinks (8 deep). Return max path name in stat -f information
 
 2) Modify file portion of ltp so it can run against a mounted network
 share and run it against cifs vfs.
@@ -102,5 +101,6 @@ and when signing is disabled to request larger read sizes (larger than
 negotiated size) and send larger write sizes to modern servers.
 
 4) More exhaustively test the recently added NT4 support against various
-NT4 service pack levels.
+NT4 service pack levels, and fix cifs_setattr for setting file times and 
+size to fall back to level 1 when error invalid level returned.
 
index 07ec6be..cd31d19 100644 (file)
@@ -41,8 +41,6 @@
 #include "cifs_fs_sb.h"
 #include <linux/mm.h>
 #define CIFS_MAGIC_NUMBER 0xFF534D42   /* the first four bytes of SMB PDUs */
-/* BB when mempool_resize is added back in, we will resize pool on new mount */
-#define CIFS_MIN_RCV_POOL 11 /* enough for progress to five servers */
 
 #ifdef CONFIG_CIFS_QUOTA
 static struct quotactl_ops cifs_quotactl_ops;
@@ -192,15 +190,11 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
 
 static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd)
 {
-        struct cifs_sb_info *cifs_sb;
+       struct cifs_sb_info *cifs_sb;
 
-        cifs_sb = CIFS_SB(inode->i_sb);
+       cifs_sb = CIFS_SB(inode->i_sb);
 
-        if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
-               /* the server supports the Unix-like mode bits and does its
-               own permission checks, and therefore we do not allow the file
-               mode to be overriden on these mounts - so do not do perm
-               check on client side */
+       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
                return 0;
        } else /* file mode might have been restricted at mount time 
                on the client (above and beyond ACL on servers) for  
@@ -541,18 +535,14 @@ struct file_operations cifs_file_ops = {
        .flush = cifs_flush,
        .mmap  = cifs_file_mmap,
        .sendfile = generic_file_sendfile,
-#ifdef CONFIG_CIFS_FCNTL
-       .fcntl = cifs_fcntl,
-#endif
+       .dir_notify = cifs_dir_notify,
 };
 
 struct file_operations cifs_dir_ops = {
        .readdir = cifs_readdir,
        .release = cifs_closedir,
        .read    = generic_read_dir,
-#ifdef CONFIG_CIFS_FCNTL
-       .fcntl   = cifs_fcntl,
-#endif
+       .dir_notify = cifs_dir_notify,
 };
 
 static void
@@ -747,6 +737,7 @@ init_cifs(void)
  */
        atomic_set(&sesInfoAllocCount, 0);
        atomic_set(&tconInfoAllocCount, 0);
+       atomic_set(&tcpSesAllocCount,0);
        atomic_set(&tcpSesReconnectCount, 0);
        atomic_set(&tconInfoReconnectCount, 0);
 
index c25d434..b1cbc68 100644 (file)
 #define TRUE 1
 #endif
 
-extern int map_cifs_error(int error_class, int error_code,
-                         int status_codes_negotiated);
-
 extern struct address_space_operations cifs_addr_ops;
 
 /* Functions related to super block operations */
 extern struct super_operations cifs_super_ops;
-extern void cifs_put_inode(struct inode *);
 extern void cifs_read_inode(struct inode *);
 extern void cifs_delete_inode(struct inode *);
 /* extern void cifs_write_inode(struct inode *); *//* BB not needed yet */
@@ -78,7 +74,7 @@ extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
 extern struct file_operations cifs_dir_ops;
 extern int cifs_dir_open(struct inode *inode, struct file *file);
 extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir);
-extern long cifs_fcntl(int, unsigned int, unsigned long, struct file *);
+extern int cifs_dir_notify(struct file *, unsigned long arg);
 
 /* Functions related to dir entries */
 extern struct dentry_operations cifs_dentry_ops;
index cfbfac7..21ac75c 100644 (file)
@@ -32,6 +32,8 @@
                                   termination then *2 for unicode versions */
 #define MAX_PASSWORD_SIZE 16
 
+#define CIFS_MIN_RCV_POOL 4
+
 /*
  * MAX_REQ is the maximum number of requests that WE will send
  * on one socket concurently. It also matches the most common
@@ -391,7 +393,7 @@ GLOBAL_EXTERN char Local_System_Name[15];
  */
 GLOBAL_EXTERN atomic_t sesInfoAllocCount;
 GLOBAL_EXTERN atomic_t tconInfoAllocCount;
-
+GLOBAL_EXTERN atomic_t tcpSesAllocCount;
 GLOBAL_EXTERN atomic_t tcpSesReconnectCount;
 GLOBAL_EXTERN atomic_t tconInfoReconnectCount;
 
index 067eb4e..94646af 100644 (file)
@@ -1046,6 +1046,8 @@ typedef union smb_com_transaction2 {
 
 /* PathInfo/FileInfo infolevels */
 #define SMB_INFO_STANDARD                   1
+#define SMB_SET_FILE_EA                     2
+#define SMB_QUERY_FILE_EA_SIZE              2
 #define SMB_INFO_QUERY_EAS_FROM_LIST        3
 #define SMB_INFO_QUERY_ALL_EAS              4
 #define SMB_INFO_IS_NAME_VALID              6
@@ -1620,6 +1622,19 @@ typedef struct {
        char LinkDest[1];
 } FILE_UNIX_LINK_INFO;         /* level 513 QPathInfo */
 
+typedef struct {
+       __u16 CreationDate;
+       __u16 CreationTime;
+       __u16 LastAccessDate;
+       __u16 LastAccessTime;
+       __u16 LastWriteDate;
+       __u16 LastWriteTime;
+       __u32 DataSize; /* File Size (EOF) */
+       __u32 AllocationSize;
+       __u16 Attributes; /* verify not u32 */
+       __u32 EASize;
+} FILE_INFO_STANDARD;  /* level 1 SetPath/FileInfo */
+
 /* defines for enumerating possible values of the Unix type field below */
 #define UNIX_FILE      0
 #define UNIX_DIR       1
@@ -1680,12 +1695,12 @@ typedef struct {
 } FILE_DIRECTORY_INFO;   /* level 257 FF response data area */
 
 struct gea {
-       unsigned char cbName;
-       char szName[1];
+       unsigned char name_len;
+       char name[1];
 };
 
 struct gealist {
-       unsigned long cbList;
+       unsigned long list_len;
        struct gea list[1];
 };
 
@@ -1693,7 +1708,7 @@ struct fea {
        unsigned char EA_flags;
        __u8 name_len;
        __u16 value_len;
-       char szName[1];
+       char name[1];
        /* optionally followed by value */
 };
 /* flags for _FEA.fEA */
index 215bbc1..8273700 100644 (file)
@@ -128,10 +128,10 @@ extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
                        const struct nls_table *nls_codepage);
 
 extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon,
-                       char *fileName, FILE_BASIC_INFO * data,
+                       const char *fileName, const FILE_BASIC_INFO * data,
                        const struct nls_table *nls_codepage);
 extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
-                       char *fileName, __u64 size,int setAllocationSizeFlag,
+                       const char *fileName, __u64 size,int setAllocationSizeFlag,
                        const struct nls_table *nls_codepage);
 extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
                         __u64 size, __u16 fileHandle,__u32 opener_pid, int AllocSizeFlag);
@@ -213,31 +213,6 @@ extern int cifs_verify_signature(const struct smb_hdr *, const char * mac_key,
 extern int cifs_calculate_mac_key(char * key,const char * rn,const char * pass);
 extern void CalcNTLMv2_partial_mac_key(struct cifsSesInfo *, struct nls_table *);
 extern void CalcNTLMv2_response(const struct cifsSesInfo *,char * );
-
-extern int CIFSBuildServerList(int xid, char *serverBufferList,
-                       int recordlength, int *entries,
-                       int *totalEntries, int *topoChangedFlag);
-extern int CIFSSMBQueryShares(int xid, struct cifsTconInfo *tcon,
-                       struct shareInfo *shareList, int bufferLen,
-                       int *entries, int *totalEntries);
-extern int CIFSSMBQueryAlias(int xid, struct cifsTconInfo *tcon,
-                       struct aliasInfo *aliasList, int bufferLen,
-                       int *entries, int *totalEntries);
-extern int CIFSSMBAliasInfo(int xid, struct cifsTconInfo *tcon,
-                       char *aliasName, char *serverName,
-                       char *shareName, char *comment);
-extern int CIFSSMBGetShareInfo(int xid, struct cifsTconInfo *tcon,
-                       char *share, char *comment);
-extern int CIFSSMBGetUserPerms(int xid, struct cifsTconInfo *tcon,
-                       char *userName, char *searchName, int *perms);
-extern int CIFSSMBSync(int xid, struct cifsTconInfo *tcon, int netfid, int pid);
-
-extern int CIFSSMBSeek(int xid,
-                       struct cifsTconInfo *tcon,
-                       int netfid,
-                       int pid,
-                       int whence, unsigned long offset, long long *newoffset);
-
 extern int CIFSSMBCopy(int xid,
                        struct cifsTconInfo *source_tcon,
                        const char *fromName,
@@ -247,8 +222,15 @@ extern int CIFSSMBCopy(int xid,
 extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, 
                        const int notify_subdirs,const __u16 netfid,__u32 filter,
                        const struct nls_table *nls_codepage);
-extern int CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
-                const unsigned char *searchName,
-                char * EAData, size_t size,
-                const struct nls_table *nls_codepage);
+extern ssize_t CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
+                       const unsigned char *searchName, char * EAData,
+                       size_t bufsize, const struct nls_table *nls_codepage);
+extern ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
+               const unsigned char * searchName,const unsigned char * ea_name,
+               unsigned char * ea_value, size_t buf_size, 
+               const struct nls_table *nls_codepage);
+extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, 
+               const char *fileName, const char * ea_name, 
+               const void * ea_value, const __u16 ea_value_len, 
+               const struct nls_table *nls_codepage);
 #endif                 /* _CIFSPROTO_H */
index c748d15..dc9e0fd 100644 (file)
@@ -2287,7 +2287,7 @@ QFSInfoRetry:
 }
 
 int
-CIFSSMBQFSAttributeInfo(int xid, struct cifsTconInfo *tcon,
+CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon,
                        const struct nls_table *nls_codepage)
 {
 /* level 0x105  SMB_QUERY_FILE_SYSTEM_INFO */
@@ -2359,7 +2359,7 @@ QFSAttributeRetry:
 }
 
 int
-CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon,
+CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon,
                     const struct nls_table *nls_codepage)
 {
 /* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */
@@ -2432,7 +2432,7 @@ QFSDeviceRetry:
 }
 
 int
-CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon,
+CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
                   const struct nls_table *nls_codepage)
 {
 /* level 0x200  SMB_QUERY_CIFS_UNIX_INFO */
@@ -2512,7 +2512,7 @@ QFSUnixRetry:
    in Samba which this routine can run into */
 
 int
-CIFSSMBSetEOF(int xid, struct cifsTconInfo *tcon, char *fileName,
+CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
              __u64 size, int SetAllocation, const struct nls_table *nls_codepage)
 {
        struct smb_com_transaction2_spi_req *pSMB = NULL;
@@ -2692,8 +2692,9 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
 }
 
 int
-CIFSSMBSetTimes(int xid, struct cifsTconInfo *tcon, char *fileName,
-               FILE_BASIC_INFO * data, const struct nls_table *nls_codepage)
+CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
+               const FILE_BASIC_INFO * data, 
+               const struct nls_table *nls_codepage)
 {
        TRANSACTION2_SPI_REQ *pSMB = NULL;
        TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -2770,6 +2771,89 @@ SetTimesRetry:
        return rc;
 }
 
+
+int
+CIFSSMBSetTimesLegacy(int xid, struct cifsTconInfo *tcon, char *fileName,
+               FILE_INFO_STANDARD * data, const struct nls_table *nls_codepage)
+{
+       TRANSACTION2_SPI_REQ *pSMB = NULL;
+       TRANSACTION2_SPI_RSP *pSMBr = NULL;
+       int name_len;
+       int rc = 0;
+       int bytes_returned = 0;
+       char *data_offset;
+
+       cFYI(1, ("In SetTimesLegacy"));
+
+SetTimesRetryLegacy:
+       rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
+                     (void **) &pSMBr);
+       if (rc)
+               return rc;
+
+       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+               name_len =
+                   cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+                                 /* find define for this maxpathcomponent */
+                                 , nls_codepage);
+               name_len++;     /* trailing null */
+               name_len *= 2;
+       } else {                /* BB improve the check for buffer overruns BB */
+               name_len = strnlen(fileName, 530);
+               name_len++;     /* trailing null */
+               strncpy(pSMB->FileName, fileName, name_len);
+       }
+/* BB fixme - we have to map to FILE_STANDARD_INFO (level 1 info
+       in parent function, from the better and ususal FILE_BASIC_INFO */
+       pSMB->ParameterCount = 6 + name_len;
+       pSMB->DataCount = sizeof (FILE_INFO_STANDARD);
+       pSMB->MaxParameterCount = cpu_to_le16(2);
+       pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */
+       pSMB->MaxSetupCount = 0;
+       pSMB->Reserved = 0;
+       pSMB->Flags = 0;
+       pSMB->Timeout = 0;
+       pSMB->Reserved2 = 0;
+       pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
+                                     InformationLevel) - 4;
+       pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
+       data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset;
+       pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset);
+       pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset);
+       pSMB->SetupCount = 1;
+       pSMB->Reserved3 = 0;
+       pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
+       pSMB->ByteCount = 3 /* pad */  + pSMB->ParameterCount + pSMB->DataCount;
+
+       pSMB->DataCount = cpu_to_le16(pSMB->DataCount);
+       pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount);
+       pSMB->TotalDataCount = pSMB->DataCount;
+       pSMB->TotalParameterCount = pSMB->ParameterCount;
+       /* I doubt that passthrough levels apply to this old
+       preNT info level */
+/*     if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)
+               pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_BASIC_INFO2);
+       else*/
+               pSMB->InformationLevel = cpu_to_le16(SMB_INFO_STANDARD);
+       pSMB->Reserved4 = 0;
+       pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+       memcpy(data_offset, data, sizeof (FILE_INFO_STANDARD));
+       pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
+       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
+       if (rc) {
+               cFYI(1, ("SetPathInfo (times legacy) returned %d", rc));
+       }
+
+       if (pSMB)
+               cifs_buf_release(pSMB);
+
+       if (rc == -EAGAIN)
+               goto SetTimesRetryLegacy;
+
+       return rc;
+}
+
 int
 CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
                    char *fileName, __u64 mode, __u64 uid, __u64 gid,
@@ -2915,10 +2999,10 @@ int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
        return rc;      
 }
 #ifdef CONFIG_CIFS_XATTR
-int
+ssize_t
 CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
                 const unsigned char *searchName,
-                char * EAData, size_t size,
+                char * EAData, size_t buf_size,
                 const struct nls_table *nls_codepage)
 {
                /* BB assumes one setup word */
@@ -2927,6 +3011,8 @@ CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
        int rc = 0;
        int bytes_returned;
        int name_len;
+       struct fea * temp_fea;
+       char * temp_ptr;
 
        cFYI(1, ("In Query All EAs path %s", searchName));
 QAllEAsRetry:
@@ -2942,7 +3028,7 @@ QAllEAsRetry:
                                  , nls_codepage);
                name_len++;     /* trailing null */
                name_len *= 2;
-       } else {                /* BB improve the check for buffer overruns BB */
+       } else {        /* BB improve the check for buffer overruns BB */
                name_len = strnlen(searchName, 530);
                name_len++;     /* trailing null */
                strncpy(pSMB->FileName, searchName, name_len);
@@ -3001,7 +3087,53 @@ QAllEAsRetry:
                        ea_response_data = (struct fealist *)
                                (((char *) &pSMBr->hdr.Protocol) +
                                pSMBr->DataOffset);
+                       ea_response_data->list_len = 
+                               cpu_to_le32(ea_response_data->list_len);
                        cFYI(1,("ea length %d",ea_response_data->list_len));
+                       name_len = ea_response_data->list_len;
+                       if(name_len <= 8) {
+                       /* returned EA size zeroed at top of function */
+                               cFYI(1,("empty EA list returned from server"));
+                       } else {
+                               /* account for ea list len */
+                               name_len -= 4;
+                               temp_fea = ea_response_data->list;
+                               temp_ptr = (char *)temp_fea;
+                               while(name_len > 0) {
+                                       name_len -= 4;
+                                       temp_ptr += 4;
+                                       rc += temp_fea->name_len;
+                               /* account for prefix user. and trailing null */
+                                       rc = rc + 5 + 1; 
+                                       if(rc<buf_size) {
+                                               memcpy(EAData,"user.",5);
+                                               EAData+=5;
+                                               memcpy(EAData,temp_ptr,temp_fea->name_len);
+                                               EAData+=temp_fea->name_len;
+                                               /* null terminate name */
+                                               *EAData = 0;
+                                               EAData = EAData + 1;
+                                       } else if(buf_size == 0) {
+                                               /* skip copy - calc size only */
+                                       } else {
+                                               /* stop before overrun buffer */
+                                               rc = -ERANGE;
+                                               break;
+                                       }
+                                       name_len -= temp_fea->name_len;
+                                       temp_ptr += temp_fea->name_len;
+                                       /* account for trailing null */
+                                       name_len--;
+                                       temp_ptr++;
+                                       temp_fea->value_len = cpu_to_le16(temp_fea->value_len);
+                                       name_len -= temp_fea->value_len;
+                                       temp_ptr += temp_fea->value_len;
+                                       /* BB check that temp_ptr is still within smb BB*/
+                               /* no trailing null to account for in value len */
+                                       /* go on to next EA */
+                                       temp_fea = (struct fea *)temp_ptr;
+                               }
+                       }
                }
        }
        if (pSMB)
@@ -3011,4 +3143,255 @@ QAllEAsRetry:
 
        return rc;
 }
+
+ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
+               const unsigned char * searchName,const unsigned char * ea_name,
+               unsigned char * ea_value, size_t buf_size, 
+               const struct nls_table *nls_codepage)
+{
+       TRANSACTION2_QPI_REQ *pSMB = NULL;
+       TRANSACTION2_QPI_RSP *pSMBr = NULL;
+       int rc = 0;
+       int bytes_returned;
+       int name_len;
+       struct fea * temp_fea;
+       char * temp_ptr;
+
+       cFYI(1, ("In Query EA path %s", searchName));
+QEARetry:
+       rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
+                     (void **) &pSMBr);
+       if (rc)
+               return rc;
+
+       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+               name_len =
+                   cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 530
+                                 /* find define for this maxpathcomponent */
+                                 , nls_codepage);
+               name_len++;     /* trailing null */
+               name_len *= 2;
+       } else {        /* BB improve the check for buffer overruns BB */
+               name_len = strnlen(searchName, 530);
+               name_len++;     /* trailing null */
+               strncpy(pSMB->FileName, searchName, name_len);
+       }
+
+       pSMB->TotalParameterCount = 2 /* level */  + 4 /* reserved */  +
+           name_len /* includes null */ ;
+       pSMB->TotalDataCount = 0;
+       pSMB->MaxParameterCount = cpu_to_le16(2);
+       pSMB->MaxDataCount = cpu_to_le16(4000); /* BB find exact max SMB PDU from sess structure BB */
+       pSMB->MaxSetupCount = 0;
+       pSMB->Reserved = 0;
+       pSMB->Flags = 0;
+       pSMB->Timeout = 0;
+       pSMB->Reserved2 = 0;
+       pSMB->ParameterOffset = cpu_to_le16(offsetof(
+        struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
+       pSMB->DataCount = 0;
+       pSMB->DataOffset = 0;
+       pSMB->SetupCount = 1;
+       pSMB->Reserved3 = 0;
+       pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_PATH_INFORMATION);
+       pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
+       pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
+       pSMB->ParameterCount = pSMB->TotalParameterCount;
+       pSMB->InformationLevel = cpu_to_le16(SMB_INFO_QUERY_ALL_EAS);
+       pSMB->Reserved4 = 0;
+       pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+       pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
+
+       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
+       if (rc) {
+               cFYI(1, ("Send error in Query EA = %d", rc));
+       } else {                /* decode response */
+               pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
+               /* BB also check enough total bytes returned */
+               /* BB we need to improve the validity checking
+               of these trans2 responses */
+               if ((pSMBr->ByteCount < 4) || (pSMBr->DataOffset > 512)) 
+                       rc = -EIO;      /* bad smb */
+          /* else if (pFindData){
+                       memcpy((char *) pFindData,
+                              (char *) &pSMBr->hdr.Protocol +
+                              pSMBr->DataOffset, kl);
+               }*/ else {
+                       /* check that length of list is not more than bcc */
+                       /* check that each entry does not go beyond length
+                          of list */
+                       /* check that each element of each entry does not
+                          go beyond end of list */
+                       struct fealist * ea_response_data;
+                       rc = -ENOENT;
+                       /* validate_trans2_offsets() */
+                       /* BB to check if(start of smb + pSMBr->DataOffset > &bcc+ bcc)*/
+                       ea_response_data = (struct fealist *)
+                               (((char *) &pSMBr->hdr.Protocol) +
+                               pSMBr->DataOffset);
+                       ea_response_data->list_len = 
+                               cpu_to_le32(ea_response_data->list_len);
+                       cFYI(1,("ea length %d",ea_response_data->list_len));
+                       name_len = ea_response_data->list_len;
+                       if(name_len <= 8) {
+                       /* returned EA size zeroed at top of function */
+                               cFYI(1,("empty EA list returned from server"));
+                       } else {
+                               /* account for ea list len */
+                               name_len -= 4;
+                               temp_fea = ea_response_data->list;
+                               temp_ptr = (char *)temp_fea;
+                               /* loop through checking if we have a matching
+                               name and then return the associated value */
+                               while(name_len > 0) {
+                                       name_len -= 4;
+                                       temp_ptr += 4;
+                                       temp_fea->value_len = cpu_to_le16(temp_fea->value_len);
+                               /* BB validate that value_len falls within SMB, 
+                               even though maximum for name_len is 255 */ 
+                                       if(memcmp(temp_fea->name,ea_name,
+                                                 temp_fea->name_len) == 0) {
+                                               /* found a match */
+                                               rc = temp_fea->value_len;
+                               /* account for prefix user. and trailing null */
+                                               if(rc<=buf_size) {
+                                                       memcpy(ea_value,
+                                                               temp_fea->name+temp_fea->name_len+1,
+                                                               rc);
+                                                       /* ea values, unlike ea names,
+                                                       are not null terminated */
+                                               } else if(buf_size == 0) {
+                                               /* skip copy - calc size only */
+                                               } else {
+                                                       /* stop before overrun buffer */
+                                                       rc = -ERANGE;
+                                               }
+                                               break;
+                                       }
+                                       name_len -= temp_fea->name_len;
+                                       temp_ptr += temp_fea->name_len;
+                                       /* account for trailing null */
+                                       name_len--;
+                                       temp_ptr++;
+                                       name_len -= temp_fea->value_len;
+                                       temp_ptr += temp_fea->value_len;
+                               /* no trailing null to account for in value len */
+                                       /* go on to next EA */
+                                       temp_fea = (struct fea *)temp_ptr;
+                               }
+                       } 
+               }
+       }
+       if (pSMB)
+               cifs_buf_release(pSMB);
+       if (rc == -EAGAIN)
+               goto QEARetry;
+
+       return rc;
+}
+
+int
+CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName,
+               const char * ea_name, const void * ea_value, 
+               const __u16 ea_value_len, const struct nls_table *nls_codepage)
+{
+       struct smb_com_transaction2_spi_req *pSMB = NULL;
+       struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
+       struct fealist *parm_data;
+       int name_len;
+       int rc = 0;
+       int bytes_returned = 0;
+
+       cFYI(1, ("In SetEA"));
+SetEARetry:
+       rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
+                     (void **) &pSMBr);
+       if (rc)
+               return rc;
+
+       if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
+               name_len =
+                   cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, 530
+                                 /* find define for this maxpathcomponent */
+                                 , nls_codepage);
+               name_len++;     /* trailing null */
+               name_len *= 2;
+       } else {                /* BB improve the check for buffer overruns BB */
+               name_len = strnlen(fileName, 530);
+               name_len++;     /* trailing null */
+               strncpy(pSMB->FileName, fileName, name_len);
+       }
+
+       pSMB->ParameterCount = 6 + name_len;
+
+       /* done calculating parms using name_len of file name,
+       now use name_len to calculate length of ea name
+       we are going to create in the inode xattrs */
+       if(ea_name == NULL)
+               name_len = 0;
+       else
+               name_len = strnlen(ea_name,255);
+
+       pSMB->DataCount = sizeof(*parm_data) + ea_value_len + name_len + 1;
+       pSMB->MaxParameterCount = cpu_to_le16(2);
+       pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */
+       pSMB->MaxSetupCount = 0;
+       pSMB->Reserved = 0;
+       pSMB->Flags = 0;
+       pSMB->Timeout = 0;
+       pSMB->Reserved2 = 0;
+       pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
+                                     InformationLevel) - 4;
+       pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
+       pSMB->InformationLevel =
+               cpu_to_le16(SMB_SET_FILE_EA);
+
+       parm_data =
+               (struct fealist *) (((char *) &pSMB->hdr.Protocol) +
+                                      pSMB->DataOffset);
+       pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset);
+       pSMB->DataOffset = cpu_to_le16(pSMB->DataOffset);
+       pSMB->SetupCount = 1;
+       pSMB->Reserved3 = 0;
+       pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
+       pSMB->ByteCount = 3 /* pad */  + pSMB->ParameterCount + pSMB->DataCount;
+       pSMB->DataCount = cpu_to_le16(pSMB->DataCount);
+       parm_data->list_len = (__u32)(pSMB->DataCount);
+       parm_data->list[0].EA_flags = 0;
+       /* we checked above that name len is less than 255 */
+       parm_data->list[0].name_len = (__u8)name_len;;
+       /* EA names are always ASCII */
+       strncpy(parm_data->list[0].name,ea_name,name_len);
+       parm_data->list[0].name[name_len] = 0;
+       parm_data->list[0].value_len = cpu_to_le16(ea_value_len);
+       /* caller ensures that ea_value_len is less than 64K but
+       we need to ensure that it fits within the smb */
+
+       /*BB add length check that it would fit in negotiated SMB buffer size BB */
+       /* if(ea_value_len > buffer_size - 512 (enough for header)) */
+       if(ea_value_len)
+               memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len);
+
+       pSMB->TotalDataCount = pSMB->DataCount;
+       pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount);
+       pSMB->TotalParameterCount = pSMB->ParameterCount;
+       pSMB->Reserved4 = 0;
+       pSMB->hdr.smb_buf_length += pSMB->ByteCount;
+       pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
+       rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
+                        (struct smb_hdr *) pSMBr, &bytes_returned, 0);
+       if (rc) {
+               cFYI(1, ("SetPathInfo (EA) returned %d", rc));
+       }
+
+       if (pSMB)
+               cifs_buf_release(pSMB);
+
+       if (rc == -EAGAIN)
+               goto SetEARetry;
+
+       return rc;
+}
+
 #endif
index 0e59f79..bb6b0f3 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/pagemap.h>
 #include <linux/ctype.h>
 #include <linux/utsname.h>
+#include <linux/mempool.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
 #include "cifspdu.h"
@@ -49,6 +50,8 @@ extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
                         unsigned char *p24);
 extern int cifs_inet_pton(int, const char *, void *dst);
 
+extern mempool_t *cifs_req_poolp;
+
 struct smb_vol {
        char *username;
        char *password;
@@ -64,6 +67,8 @@ struct smb_vol {
        int rw:1;
        int retry:1;
        int intr:1;
+       int setuids:1;
+       int noperm:1;
        unsigned int rsize;
        unsigned int wsize;
        unsigned int sockopt;
@@ -189,8 +194,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
        unsigned int pdu_length, total_read;
        struct smb_hdr *smb_buffer = NULL;
        struct msghdr smb_msg;
-       mm_segment_t temp_fs;
-       struct iovec iov;
+       struct kvec iov;
        struct socket *csocket = server->ssocket;
        struct list_head *tmp;
        struct cifsSesInfo *ses;
@@ -203,9 +207,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
        current->flags |= PF_MEMALLOC;
        server->tsk = current;  /* save process info to wake at shutdown */
        cFYI(1, ("Demultiplex PID: %d", current->pid));
-
-       temp_fs = get_fs();     /* we must turn off socket api parm checking */
-       set_fs(get_ds());
+       write_lock(&GlobalSMBSeslock);
+       atomic_inc(&tcpSesAllocCount);
+       length = tcpSesAllocCount.counter;
+       write_unlock(&GlobalSMBSeslock);
+       if(length  > 1) {
+               mempool_resize(cifs_req_poolp,
+                       length + CIFS_MIN_RCV_POOL,
+                       GFP_KERNEL);
+       }
 
        while (server->tcpStatus != CifsExiting) {
                if (smb_buffer == NULL)
@@ -222,16 +232,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                iov.iov_base = smb_buffer;
                iov.iov_len = sizeof (struct smb_hdr) - 1;      
         /* 1 byte less above since wct is not always returned in error cases */
-               smb_msg.msg_iov = &iov;
-               smb_msg.msg_iovlen = 1;
                smb_msg.msg_control = NULL;
                smb_msg.msg_controllen = 0;
 
                length =
-                   sock_recvmsg(csocket, &smb_msg,
-                                sizeof (struct smb_hdr) -
-                                1 /* RFC1001 header and SMB header */ ,
-                                MSG_PEEK /* flags see socket.h */ );
+                   kernel_recvmsg(csocket, &smb_msg,
+                                  &iov, 1,
+                                  sizeof (struct smb_hdr) -
+                                  1 /* RFC1001 header and SMB header */ ,
+                                  MSG_PEEK /* flags see socket.h */ );
 
                if(server->tcpStatus == CifsExiting) {
                        break;
@@ -276,12 +285,14 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                        if (temp[0] == (char) RFC1002_SESSION_KEEP_ALIVE) {
                                iov.iov_base = smb_buffer;
                                iov.iov_len = 4;
-                               length = sock_recvmsg(csocket, &smb_msg, 4, 0);
+                               length = kernel_recvmsg(csocket, &smb_msg,
+                                                       &iov, 1, 4, 0);
                                cFYI(0,("Received 4 byte keep alive packet"));
                        } else if (temp[0] == (char) RFC1002_POSITIVE_SESSION_RESPONSE) {
-                                       iov.iov_base = smb_buffer;
-                                       iov.iov_len = 4;
-                                       length = sock_recvmsg(csocket, &smb_msg, 4, 0);
+                               iov.iov_base = smb_buffer;
+                               iov.iov_len = 4;
+                               length = kernel_recvmsg(csocket, &smb_msg,
+                                                       &iov, 1, 4, 0);
                                        cFYI(1,("Good RFC 1002 session rsp"));
                        } else if ((temp[0] == (char)RFC1002_NEGATIVE_SESSION_RESPONSE)
                                   && (length == 5)) {
@@ -341,7 +352,8 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                                        for (total_read = 0; 
                                             total_read < pdu_length;
                                             total_read += length) {    
-                                               length = sock_recvmsg(csocket, &smb_msg, 
+                                               length = kernel_recvmsg(csocket, &smb_msg, 
+                                                       &iov, 1,
                                                        pdu_length - total_read, 0);
                                                if (length == 0) {
                                                        cERROR(1,
@@ -392,7 +404,9 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                             ("Frame less than four bytes received  %d bytes long.",
                              length));
                        if (length > 0) {
-                               length = sock_recvmsg(csocket, &smb_msg, length, 0);    /* throw away junk frame */
+                               length = kernel_recvmsg(csocket, &smb_msg,
+                                       &iov, 1,
+                                       length, 0);     /* throw away junk frame */
                                cFYI(1,
                                     (" with junk  0x%x in it ",
                                      *(__u32 *) smb_buffer));
@@ -418,7 +432,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
                sock_release(csocket);
                server->ssocket = NULL;
        }
-       set_fs(temp_fs);
        if (smb_buffer) /* buffer usually freed in free_mid - need to free it on error or exit */
                cifs_buf_release(smb_buffer);
 
@@ -466,6 +479,16 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
        }
        kfree(server);
 
+       write_lock(&GlobalSMBSeslock);
+       atomic_dec(&tcpSesAllocCount);
+       length = tcpSesAllocCount.counter;
+       write_unlock(&GlobalSMBSeslock);
+       if(length  > 0) {
+               mempool_resize(cifs_req_poolp,
+                       length + CIFS_MIN_RCV_POOL,
+                       GFP_KERNEL);
+       }
+
        set_current_state(TASK_INTERRUPTIBLE);
        schedule_timeout(HZ/4);
        return 0;
@@ -741,6 +764,14 @@ cifs_parse_mount_options(char *options, const char *devname, struct smb_vol *vol
                        vol->retry = 1;
                } else if (strnicmp(data, "soft", 4) == 0) {
                        vol->retry = 0;
+               } else if (strnicmp(data, "perm", 4) == 0) {
+                       vol->noperm = 0;
+               } else if (strnicmp(data, "noperm", 6) == 0) {
+                       vol->noperm = 1;
+               } else if (strnicmp(data, "setuids", 7) == 0) {
+                       vol->setuids = 1;
+               } else if (strnicmp(data, "nosetuids", 9) == 0) {
+                       vol->setuids = 0;
                } else if (strnicmp(data, "nohard", 6) == 0) {
                        vol->retry = 0;
                } else if (strnicmp(data, "nosoft", 6) == 0) {
@@ -1315,6 +1346,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
                cifs_sb->mnt_file_mode = volume_info.file_mode;
                cifs_sb->mnt_dir_mode = volume_info.dir_mode;
                cFYI(1,("file mode: 0x%x  dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode));
+
+               if(volume_info.noperm)
+                       cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM;
+               if(volume_info.setuids)
+                       cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID;
+
                tcon =
                    find_unc(sin_server.sin_addr.s_addr, volume_info.UNC,
                             volume_info.username);
index 95d68da..91567f6 100644 (file)
@@ -243,11 +243,19 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
                then we now have to set the mode if possible */
                if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) &&
                        (oplock & CIFS_CREATE_ACTION))
-                       CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                               CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+                                       (__u64)current->euid,
+                                       (__u64)current->egid,
+                                       0 /* dev */,
+                                       cifs_sb->local_nls);
+                       } else {
+                               CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
                                        (__u64)-1,
                                        (__u64)-1,
                                        0 /* dev */,
                                        cifs_sb->local_nls);
+                       }
                else {
                        /* BB implement via Windows security descriptors */
                        /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
@@ -348,9 +356,16 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
                rc = -ENOMEM;
        
        if (full_path && (pTcon->ses->capabilities & CAP_UNIX)) {
-               rc = CIFSSMBUnixSetPerms(xid, pTcon,
-                       full_path, mode, current->euid, current->egid,
-                       device_number, cifs_sb->local_nls);
+               if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                       rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
+                               mode,(__u64)current->euid,(__u64)current->egid,
+                               device_number, cifs_sb->local_nls);
+               } else {
+                       rc = CIFSSMBUnixSetPerms(xid, pTcon,
+                               full_path, mode, (__u64)-1, (__u64)-1,
+                               device_number, cifs_sb->local_nls);
+               }
+
                if(!rc) {
                        rc = cifs_get_inode_info_unix(&newinode, full_path,
                                                inode->i_sb,xid);
index 1469a40..b908768 100644 (file)
@@ -28,7 +28,7 @@
 #include "cifs_unicode.h"
 #include "cifs_debug.h"
 
-int cifs_directory_notify(unsigned long arg, struct file * file)
+int cifs_dir_notify(struct file * file, unsigned long arg)
 {
        int xid;
        int rc = -EINVAL;
@@ -70,53 +70,3 @@ int cifs_directory_notify(unsigned long arg, struct file * file)
        FreeXid(xid);
        return rc;
 }
-
-
-long cifs_fcntl(int file_desc, unsigned int command, unsigned long arg,
-                               struct file * file)
-{
-       /* Few few file control functions need to be specially mapped. So far
-       only:
-               F_NOTIFY (for directory change notification)
-       And eventually:
-               F_GETLEASE
-               F_SETLEASE 
-       need to be mapped here. The others either already are mapped downstream
-       or do not need to go to the server (client only sideeffects):
-               F_DUPFD:
-               F_GETFD:
-               F_SETFD:
-               F_GETFL:
-               F_SETFL:
-               F_GETLK:
-               F_SETLK:
-               F_SETLKW:
-               F_GETOWN:
-               F_SETOWN:
-               F_GETSIG:
-               F_SETSIG:
-       */
-       long rc = 0;
-
-       cFYI(1,("cifs_fcntl: command %d with arg %lx",command,arg)); /* BB removeme BB */
-
-       switch (command) {
-       case F_NOTIFY:
-               /* let the local call have a chance to fail first */
-               rc = generic_file_fcntl(file_desc,command,arg,file);
-               if(rc)
-                       return rc;
-               else {
-                       /* local call succeeded try to do remote notify to
-                       pick up changes from other clients to server file */
-                       cifs_directory_notify(arg, file);
-                       /* BB add case to long and return rc from above */
-                       return rc;
-               }
-               break;
-       default:
-               break;
-       }
-       return generic_file_fcntl(file_desc,command,arg,file);
-}
-                
index 8434166..a2965cf 100644 (file)
@@ -480,12 +480,20 @@ cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
                d_instantiate(direntry, newinode);
                if(direntry->d_inode)
                        direntry->d_inode->i_nlink = 2;
-               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)                
-                       CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
-                               (__u64)-1,  
-                               (__u64)-1,
-                               0 /* dev_t */,
-                               cifs_sb->local_nls);
+               if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
+                       if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                               CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+                                               (__u64)current->euid,  
+                                               (__u64)current->egid,
+                                               0 /* dev_t */,
+                                               cifs_sb->local_nls);
+                       } else {
+                               CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+                                               (__u64)-1,  
+                                               (__u64)-1,
+                                               0 /* dev_t */,
+                                               cifs_sb->local_nls);
+                       }
                else { /* BB to be implemented via Windows secrty descriptors*/
                /* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
                }
index f3824d5..cdc7ed3 100644 (file)
@@ -122,8 +122,7 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
        int rc = 0;
        int i = 0;
        struct msghdr smb_msg;
-       struct iovec iov;
-       mm_segment_t temp_fs;
+       struct kvec iov;
 
        if(ssocket == NULL)
                return -ENOTSOCK; /* BB eventually add reconnect code here */
@@ -132,8 +131,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
 
        smb_msg.msg_name = sin;
        smb_msg.msg_namelen = sizeof (struct sockaddr);
-       smb_msg.msg_iov = &iov;
-       smb_msg.msg_iovlen = 1;
        smb_msg.msg_control = NULL;
        smb_msg.msg_controllen = 0;
        smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; /* BB add more flags?*/
@@ -147,10 +144,8 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
        cFYI(1, ("Sending smb of length %d ", smb_buf_length));
        dump_smb(smb_buffer, smb_buf_length + 4);
 
-       temp_fs = get_fs();     /* we must turn off socket api parm checking */
-       set_fs(get_ds());
        while(iov.iov_len > 0) {
-               rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
+               rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, smb_buf_length + 4);
                if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
                        i++;
                        if(i > 60) {
@@ -169,7 +164,6 @@ smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
                iov.iov_base += rc;
                iov.iov_len -= rc;
        }
-       set_fs(temp_fs);
 
        if (rc < 0) {
                cERROR(1,("Error %d sending data on socket to server.", rc));
index 60fc6f9..fd98626 100644 (file)
@@ -69,12 +69,12 @@ void reset_coda_cache_inv_stats( void )
 }
 
 int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
-                            void __user * buffer, size_t * lenp )
+                            void __user * buffer, size_t * lenp, loff_t * ppos )
 {
        if ( write ) {
                reset_coda_vfs_stats();
 
-               filp->f_pos += *lenp;
+               *ppos += *lenp;
        } else {
                *lenp = 0;
        }
@@ -84,12 +84,12 @@ int do_reset_coda_vfs_stats( ctl_table * table, int write, struct file * filp,
 
 int do_reset_coda_cache_inv_stats( ctl_table * table, int write, 
                                   struct file * filp, void __user * buffer, 
-                                  size_t * lenp )
+                                  size_t * lenp, loff_t * ppos )
 {
        if ( write ) {
                reset_coda_cache_inv_stats();
 
-               filp->f_pos += *lenp;
+               *ppos += *lenp;
        } else {
                *lenp = 0;
        }
index 145e974..dc1a2d2 100644 (file)
@@ -851,7 +851,7 @@ struct fb_cmap32 {
 
 static int fb_getput_cmap(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
-       struct fb_cmap __user *cmap;
+       struct fb_cmap_user __user *cmap;
        struct fb_cmap32 __user *cmap32;
        __u32 data;
        int err;
index 1ab2caf..e779a1c 100644 (file)
@@ -86,6 +86,10 @@ static void d_free(struct dentry *dentry)
 {
        if (dentry->d_op && dentry->d_op->d_release)
                dentry->d_op->d_release(dentry);
+       if (dentry->d_extra_attributes) {
+               kfree(dentry->d_extra_attributes);
+               dentry->d_extra_attributes = NULL;
+       }
        call_rcu(&dentry->d_rcu, d_callback);
 }
 
@@ -633,7 +637,7 @@ void shrink_dcache_anon(struct hlist_head *head)
                        struct dentry *this = hlist_entry(lp, struct dentry, d_hash);
                        if (!list_empty(&this->d_lru)) {
                                dentry_stat.nr_unused--;
-                               list_del(&this->d_lru);
+                               list_del_init(&this->d_lru);
                        }
 
                        /* 
@@ -729,6 +733,7 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name)
        dentry->d_sb = NULL;
        dentry->d_op = NULL;
        dentry->d_fsdata = NULL;
+       dentry->d_extra_attributes = NULL;
        dentry->d_mounted = 0;
        dentry->d_cookie = NULL;
        dentry->d_bucket = NULL;
@@ -1251,6 +1256,16 @@ already_unhashed:
        /* Unhash the target: dput() will then get rid of it */
        __d_drop(target);
 
+       /* flush any possible attributes */
+       if (dentry->d_extra_attributes) {
+               kfree(dentry->d_extra_attributes);
+               dentry->d_extra_attributes = NULL;
+       }
+       if (target->d_extra_attributes) {
+               kfree(target->d_extra_attributes);
+               target->d_extra_attributes = NULL;
+       }
+
        list_del(&dentry->d_child);
        list_del(&target->d_child);
 
@@ -1295,7 +1310,7 @@ already_unhashed:
  *
  * "buflen" should be positive. Caller holds the dcache_lock.
  */
-static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
+char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
                        struct dentry *root, struct vfsmount *rootmnt,
                        char *buffer, int buflen)
 {
@@ -1363,6 +1378,8 @@ Elong:
        return ERR_PTR(-ENAMETOOLONG);
 }
 
+EXPORT_SYMBOL_GPL(__d_path);
+
 /* write full pathname into buffer and return start of pathname */
 char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
                                char *buf, int buflen)
@@ -1598,6 +1615,23 @@ static void __init dcache_init_early(void)
                INIT_HLIST_HEAD(&dentry_hashtable[loop]);
 }
 
+void flush_dentry_attributes (void)
+{
+       struct hlist_node *tmp;
+       struct dentry *dentry;
+       int i;
+
+       spin_lock(&dcache_lock);
+       for (i = 0; i <= d_hash_mask; i++)
+               hlist_for_each_entry(dentry, tmp, dentry_hashtable+i, d_hash) {
+                       kfree(dentry->d_extra_attributes);
+                       dentry->d_extra_attributes = NULL;
+               }
+       spin_unlock(&dcache_lock);
+}
+
+EXPORT_SYMBOL_GPL(flush_dentry_attributes);
+
 static void __init dcache_init(unsigned long mempages)
 {
        /* 
index b0fb348..a62d941 100644 (file)
@@ -857,12 +857,14 @@ static int devfsd_close(struct inode *inode, struct file *file);
 static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
                         loff_t * ppos);
 static struct file_operations stat_fops = {
+       .open = nonseekable_open,
        .read = stat_read,
 };
 #endif
 
 /*  Devfs daemon file operations  */
 static struct file_operations devfsd_fops = {
+       .open = nonseekable_open,
        .read = devfsd_read,
        .ioctl = devfsd_ioctl,
        .release = devfsd_close,
@@ -2574,9 +2576,6 @@ static ssize_t devfsd_read(struct file *file, char __user *buf, size_t len,
        struct devfsd_notify_struct *info = fs_info->devfsd_info;
        DECLARE_WAITQUEUE(wait, current);
 
-       /*  Can't seek (pread) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        /*  Verify the task has grabbed the queue  */
        if (fs_info->devfsd_task != current)
                return -EPERM;
@@ -2763,9 +2762,6 @@ static ssize_t stat_read(struct file *file, char __user *buf, size_t len,
 
        num = sprintf(txt, "Number of entries: %u  number of bytes: %u\n",
                      stat_num_entries, stat_num_bytes) + 1;
-       /*  Can't seek (pread) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (*ppos >= num)
                return 0;
        if (*ppos + len > num)
index 2801eb4..f3b540d 100644 (file)
@@ -104,6 +104,9 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
        dn->dn_next = inode->i_dnotify;
        inode->i_dnotify = dn;
        spin_unlock(&inode->i_lock);
+
+       if (filp->f_op && filp->f_op->dir_notify)
+               return filp->f_op->dir_notify(filp, arg);
        return 0;
 
 out_free:
index 6715972..a6763ce 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -556,6 +556,7 @@ static int exec_mmap(struct mm_struct *mm)
        tsk->active_mm = mm;
        activate_mm(active_mm, mm);
        task_unlock(tsk);
+       arch_pick_mmap_layout(mm);
        if (old_mm) {
                if (active_mm != old_mm) BUG();
                mmput(old_mm);
@@ -899,11 +900,8 @@ int prepare_binprm(struct linux_binprm *bprm)
        if(!(bprm->file->f_vfsmnt->mnt_flags & MNT_NOSUID)) {
                /* Set-uid? */
                if (mode & S_ISUID) {
+                       current->personality &= ~PER_CLEAR_ON_SETID;
                        bprm->e_uid = inode->i_uid;
-#ifdef __i386__
-                       /* reset personality */
-                       current->personality = PER_LINUX;
-#endif
                }
 
                /* Set-gid? */
@@ -913,11 +911,8 @@ int prepare_binprm(struct linux_binprm *bprm)
                 * executable.
                 */
                if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) {
+                       current->personality &= ~PER_CLEAR_ON_SETID;
                        bprm->e_gid = inode->i_gid;
-#ifdef __i386__
-                       /* reset personality */
-                       current->personality = PER_LINUX;
-#endif
                }
        }
 
index 2676d70..16586d9 100644 (file)
@@ -131,7 +131,7 @@ out:
        return error;
 }
 
-static int dupfd(struct file *file, unsigned int start)
+int dupfd(struct file *file, unsigned int start)
 {
        struct files_struct * files = current->files;
        int fd;
@@ -152,6 +152,8 @@ static int dupfd(struct file *file, unsigned int start)
        return fd;
 }
 
+EXPORT_SYMBOL_GPL(dupfd);
+
 asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
 {
        int err = -EBADF;
@@ -244,6 +246,11 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
                                return -EINVAL;
        }
 
+       if (filp->f_op && filp->f_op->check_flags)
+               error = filp->f_op->check_flags(arg);
+       if (error)
+               return error;
+
        lock_kernel();
        if ((arg ^ filp->f_flags) & FASYNC) {
                if (filp->f_op && filp->f_op->fasync) {
@@ -292,8 +299,8 @@ void f_delown(struct file *filp)
 
 EXPORT_SYMBOL(f_delown);
 
-long generic_file_fcntl(int fd, unsigned int cmd,
-                       unsigned long arg, struct file *filp)
+static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
+               struct file *filp)
 {
        long err = -EINVAL;
 
@@ -361,15 +368,6 @@ long generic_file_fcntl(int fd, unsigned int cmd,
        }
        return err;
 }
-EXPORT_SYMBOL(generic_file_fcntl);
-
-static long do_fcntl(int fd, unsigned int cmd,
-                       unsigned long arg, struct file *filp)
-{
-       if (filp->f_op && filp->f_op->fcntl)
-               return filp->f_op->fcntl(fd, cmd, arg, filp);
-       return generic_file_fcntl(fd, cmd, arg, filp);
-}
 
 asmlinkage long sys_fcntl(int fd, unsigned int cmd, unsigned long arg)
 {      
index 7faf2b8..8996d4d 100644 (file)
@@ -119,7 +119,7 @@ int open_private_file(struct file *filp, struct dentry *dentry, int flags)
        memset(filp, 0, sizeof(*filp));
        eventpoll_init_file(filp);
        filp->f_flags  = flags;
-       filp->f_mode   = (flags+1) & O_ACCMODE;
+       filp->f_mode   = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
        atomic_set(&filp->f_count, 1);
        filp->f_dentry = dentry;
        filp->f_mapping = dentry->d_inode->i_mapping;
index c150fb8..1369676 100644 (file)
@@ -213,8 +213,9 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
                } else if (inode->i_state & I_DIRTY) {
                        /*
                         * Someone redirtied the inode while were writing back
-                        * the pages: nothing to do.
+                        * the pages.
                         */
+                       list_move(&inode->i_list, &sb->s_dirty);
                } else if (atomic_read(&inode->i_count)) {
                        /*
                         * The inode is clean, inuse
index 4cecb7a..794f9e5 100644 (file)
@@ -50,6 +50,9 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
        loff_t len, vma_len;
        int ret;
 
+       if (vma->vm_pgoff & (HPAGE_SIZE / PAGE_SIZE - 1))
+               return -EINVAL;
+
        if (vma->vm_start & ~HPAGE_MASK)
                return -EINVAL;
 
@@ -276,16 +279,16 @@ hugetlb_vmtruncate_list(struct prio_tree_root *root, unsigned long h_pgoff)
                unsigned long v_length;
                unsigned long v_offset;
 
-               h_vm_pgoff = vma->vm_pgoff << (HPAGE_SHIFT - PAGE_SHIFT);
-               v_length = vma->vm_end - vma->vm_start;
+               h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
                v_offset = (h_pgoff - h_vm_pgoff) << HPAGE_SHIFT;
-
                /*
                 * Is this VMA fully outside the truncation point?
                 */
                if (h_vm_pgoff >= h_pgoff)
                        v_offset = 0;
 
+               v_length = vma->vm_end - vma->vm_start;
+
                zap_hugepage_range(vma,
                                vma->vm_start + v_offset,
                                v_length - v_offset);
@@ -715,19 +718,22 @@ static unsigned long hugetlbfs_counter(void)
 
 struct file *hugetlb_zero_setup(size_t size)
 {
-       int error;
+       int error = -ENOMEM;
        struct file *file;
        struct inode *inode;
        struct dentry *dentry, *root;
        struct qstr quick_string;
        char buf[16];
 
-       if (!can_do_mlock())
+       if (!capable(CAP_IPC_LOCK))
                return ERR_PTR(-EPERM);
 
        if (!is_hugepage_mem_enough(size))
                return ERR_PTR(-ENOMEM);
 
+       if (!user_shm_lock(size, current->user))
+               return ERR_PTR(-ENOMEM);
+
        root = hugetlbfs_vfsmount->mnt_root;
        snprintf(buf, 16, "%lu", hugetlbfs_counter());
        quick_string.name = buf;
@@ -735,7 +741,7 @@ struct file *hugetlb_zero_setup(size_t size)
        quick_string.hash = 0;
        dentry = d_alloc(root, &quick_string);
        if (!dentry)
-               return ERR_PTR(-ENOMEM);
+               goto out_shm_unlock;
 
        error = -ENFILE;
        file = get_empty_filp();
@@ -762,6 +768,8 @@ out_file:
        put_filp(file);
 out_dentry:
        dput(dentry);
+out_shm_unlock:
+       user_shm_unlock(size, current->user);
        return ERR_PTR(error);
 }
 
index 8f69595..18a678c 100644 (file)
@@ -1773,14 +1773,10 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
        jbd_lock_bh_state(bh);
        spin_lock(&journal->j_list_lock);
 
-       /*
-        * Now we have the locks, check again to see whether kjournald has
-        * taken the buffer off the transaction.
-        */
-       if (!buffer_jbd(bh))
-               goto zap_buffer;
+       jh = journal_grab_journal_head(bh);
+       if (!jh)
+               goto zap_buffer_no_jh;
 
-       jh = bh2jh(bh);
        transaction = jh->b_transaction;
        if (transaction == NULL) {
                /* First case: not on any transaction.  If it
@@ -1811,6 +1807,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                        spin_unlock(&journal->j_list_lock);
                        jbd_unlock_bh_state(bh);
                        spin_unlock(&journal->j_state_lock);
+                       journal_put_journal_head(jh);
                        return ret;
                } else {
                        /* There is no currently-running transaction. So the
@@ -1824,6 +1821,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                                spin_unlock(&journal->j_list_lock);
                                jbd_unlock_bh_state(bh);
                                spin_unlock(&journal->j_state_lock);
+                               journal_put_journal_head(jh);
                                return ret;
                        } else {
                                /* The orphan record's transaction has
@@ -1847,6 +1845,7 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
                spin_unlock(&journal->j_list_lock);
                jbd_unlock_bh_state(bh);
                spin_unlock(&journal->j_state_lock);
+               journal_put_journal_head(jh);
                return 0;
        } else {
                /* Good, the buffer belongs to the running transaction.
@@ -1860,6 +1859,8 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
        }
 
 zap_buffer:
+       journal_put_journal_head(jh);
+zap_buffer_no_jh:
        spin_unlock(&journal->j_list_lock);
        jbd_unlock_bh_state(bh);
        spin_unlock(&journal->j_state_lock);
index 73ee110..27eaa6a 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Makefile for the Linux Journalling Flash File System v2 (JFFS2)
 #
-# $Id: Makefile.common,v 1.5 2004/07/15 16:06:41 dwmw2 Exp $
+# $Id: Makefile.common,v 1.6 2004/07/16 15:17:57 dwmw2 Exp $
 #
 
 obj-$(CONFIG_JFFS2_FS) += jffs2.o
@@ -15,4 +15,3 @@ jffs2-$(CONFIG_JFFS2_FS_NAND) += wbuf.o
 jffs2-$(CONFIG_JFFS2_RUBIN)    += compr_rubin.o
 jffs2-$(CONFIG_JFFS2_RTIME)    += compr_rtime.o
 jffs2-$(CONFIG_JFFS2_ZLIB)     += compr_zlib.o
-jffs2-$(CONFIG_JFFS2_PROC)     += proc.o
index 4856f36..f6efdba 100644 (file)
@@ -402,7 +402,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
                        goto bad2;
                }
                if (retlen != sizeof(marker)) {
-                       printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %d, got %zd\n",
+                       printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
                               jeb->offset, sizeof(marker), retlen);
                        goto bad2;
                }
index f4d16ad..dc25d81 100644 (file)
@@ -824,7 +824,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
                                continue;
                        }
                        if (retlen != rawlen) {
-                               printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %zd) reading header from obsolete node at %08x\n",
+                               printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %u) reading header from obsolete node at %08x\n",
                                       retlen, rawlen, ref_offset(raw));
                                continue;
                        }
diff --git a/fs/jffs2/proc.c b/fs/jffs2/proc.c
deleted file mode 100644 (file)
index 36c0a0e..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * JFFS2 -- Journalling Flash File System, Version 2.
- *
- * Copyright (C) 2004 Ferenc Havasi <havasi@inf.u-szeged.hu>,
- *                    University of Szeged, Hungary
- *
- * For licensing information, see the file 'LICENCE' in this directory.
- *
- * $Id: proc.c,v 1.3 2004/06/24 09:51:38 havasi Exp $
- *
- * Files in /proc/fs/jffs2 directory:
- *   compr_list
- *         read:  shows the list of the loaded compressors 
- *                (name, priority, enadbled/disabled)
- *         write: compressors can be enabled/disabled and
- *                the priority of them can be changed,
- *                required formats:
- *                    enable COMPRESSOR_NAME
- *                    disble COMPRESSOR_NAME
- *                    priority NEW_PRIORITY COMPRESSOR_NAME
- *   compr_mode
- *         read:  shows the name of the actual compression mode
- *         write: sets the actual comperession mode
- *   compr_stat
- *         read:  shows compression statistics
- */
-
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/jffs.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/proc_fs.h>
-#include "compr.h"
-
-extern struct proc_dir_entry *jffs_proc_root;
-
-/* Structure for top-level entry in '/proc/fs' directory */
-static struct proc_dir_entry *jffs2_proc_root;
-
-/* Structure for files in /proc/fs/jffs2 directory */
-static struct proc_dir_entry *jffs2_proc_compr_stat;
-static struct proc_dir_entry *jffs2_proc_compr_mode;
-
-/* Read the JFFS2 'compr_stat' file */
-
-static int jffs2_proc_stat_read (char *page, char **start, off_t off,
-               int count, int *eof, void *data)
-{
-       int len = 0,i;
-        char *stat = jffs2_stats();
-        
-        if (strlen(stat)<off) {
-               *eof = 1;
-                kfree(stat);
-               return len;
-        }        
-        for (i=off;((stat[i]!=0)&&(len<count));i++,len++) {
-                page[len]=stat[i];
-        }
-        if (off+len>=strlen(stat)) *eof = 1;
-        else *eof = 0;
-        kfree(stat);
-       return len;
-}
-
-
-/* Read the JFFS2 'compr_mode' file */
-
-static int jffs2_proc_mode_read (char *page, char **start, off_t off,
-               int count, int *eof, void *data)
-{
-       int len = 0;
-        if (strlen(jffs2_get_compression_mode_name())+1>count) {
-                /* it should not happen */
-               *eof = 1;
-                return 0;
-        }
-       len += sprintf(page, "%s\n",jffs2_get_compression_mode_name());
-       *eof = 1;
-       return len;
-}
-
-/* Write the JFFS2 'compr_mode' file
- *   sets the actual compression mode
- */
-
-static int jffs2_proc_mode_write(struct file *file, const char *buffer,
-                           unsigned long count, void *data)
-{
-        char *compr_name;
-
-        /* collect the name of the compression mode and set it */
-        compr_name = kmalloc(count+1,GFP_KERNEL);
-        if (sscanf(buffer,"%s",compr_name)>0) {
-                if (jffs2_set_compression_mode_name(compr_name)) {
-                        printk(KERN_WARNING "JFFS2: error switching compression mode. Invalid parameter (%s)?\n",compr_name);
-                }
-        }
-        else {
-                printk(KERN_WARNING "JFFS2: error: parameter missing\n");
-        }
-        kfree(compr_name);
-        return count;
-}
-
-/* Read the JFFS2 'compr_list' file */
-
-static int jffs2_proc_list_read (char *page, char **start, off_t off,
-               int count, int *eof, void *data)
-{
-       int len = 0;
-        char *list = jffs2_list_compressors();
-        if (strlen(list)+1>count) {
-                /* it should not happen */
-               *eof = 1;
-                kfree(list);
-                return 0;
-        }
-       len += sprintf(page,"%s",list);
-       *eof = 1;
-        kfree(list);
-       return len;
-}
-
-/* Write the JFFS2 'compr_list' file 
- *   enable/disable a compressor or set the priority of it
- */
-
-static int jffs2_proc_list_write(struct file *file, const char *buffer,
-                           unsigned long count, void *data)
-{
-        int prior;
-        char *compr_name,*compr_cmd;
-
-        compr_name = kmalloc(count+1,GFP_KERNEL);
-        compr_cmd = kmalloc(count+1,GFP_KERNEL);
-        if (!compr_name) {
-                printk(KERN_WARNING "JFFS2: unable to allocate memory\n");
-                goto list_write_end;
-        }
-        compr_name[0] = 0;
-
-        if (sscanf(buffer,"priority %d %s",&prior,compr_name)>1) {
-                jffs2_set_compressor_priority(compr_name, prior);
-                goto list_write_end;
-        }
-        if (sscanf(buffer,"enable %s",compr_name)>0) {
-                jffs2_enable_compressor_name(compr_name);
-                goto list_write_end;
-        }
-        if (sscanf(buffer,"disable %s",compr_name)>0) {
-                jffs2_disable_compressor_name(compr_name);
-                goto list_write_end;
-        }
-        printk(KERN_WARNING "JFFS2: usage of /proc/fs/jffs2/compr_list:\n"
-               "  echo \"enable COMPRESSOR_NAME\"  >/proc/fs/jffs2/compr_list\n"
-               "  echo \"disable COMPRESSOR_NAME\" >/proc/fs/jffs2/compr_list\n"
-               "  echo \"priority NEW_PRIORITY COMPRESSOR_NAME\" >/proc/fs/jffs2/compr_list\n");
-list_write_end:
-        kfree(compr_cmd);
-        kfree(compr_name);
-       return count;
-}
-
-/* Register a JFFS2 proc directory */
-
-int jffs2_proc_init(void)
-{
-       jffs2_proc_root = proc_mkdir("jffs2", proc_root_fs);
-
-       /* create entry for 'compr_stat' file */
-       if ((jffs2_proc_compr_stat = create_proc_entry ("compr_stat", 0, jffs2_proc_root))) {
-               jffs2_proc_compr_stat->read_proc = jffs2_proc_stat_read;
-       }
-       else {
-               return -ENOMEM;
-       }
-       /* create entry for 'compr_mode' file */
-       if ((jffs2_proc_compr_mode = create_proc_entry ("compr_mode", 0, jffs2_proc_root))) {
-               jffs2_proc_compr_mode->read_proc  = jffs2_proc_mode_read;
-               jffs2_proc_compr_mode->write_proc = jffs2_proc_mode_write;
-       }
-       else {
-               return -ENOMEM;
-       }
-       /* create entry for 'compr_list' file */
-       if ((jffs2_proc_compr_mode = create_proc_entry ("compr_list", 0, jffs2_proc_root))) {
-               jffs2_proc_compr_mode->read_proc  = jffs2_proc_list_read;
-               jffs2_proc_compr_mode->write_proc = jffs2_proc_list_write;
-       }
-       else {
-               return -ENOMEM;
-       }
-       return 0;
-}
-
-
-/* Unregister a JFFS2 proc directory */
-
-int jffs2_proc_exit(void)
-{
-#if LINUX_VERSION_CODE < 0x020300
-       remove_proc_entry ("compr_stat", &jffs2_proc_root);
-       remove_proc_entry ("compr_mode", &jffs2_proc_root);
-       remove_proc_entry ("compr_list", &jffs2_proc_root);
-       remove_proc_entry ("jffs2", &proc_root_fs);
-#else
-       remove_proc_entry ("compr_stat", jffs2_proc_root);
-       remove_proc_entry ("compr_mode", jffs2_proc_root);
-       remove_proc_entry ("compr_list", jffs2_proc_root);
-       remove_proc_entry ("jffs2", proc_root_fs);
-#endif
-        return 0;
-}
index 23dad47..c37fb16 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: super.c,v 1.96 2004/07/13 08:57:30 dwmw2 Exp $
+ * $Id: super.c,v 1.97 2004/07/16 15:17:57 dwmw2 Exp $
  *
  */
 
@@ -308,13 +308,6 @@ static int __init init_jffs2_fs(void)
                printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n");
                return -ENOMEM;
        }
-#ifdef CONFIG_JFFS2_PROC
-       ret = jffs2_proc_init();
-       if (ret) {
-               printk(KERN_ERR "JFFS2 error: Failed to initialise proc interface\n");
-               goto out;
-       }
-#endif
        ret = jffs2_compressors_init();
        if (ret) {
                printk(KERN_ERR "JFFS2 error: Failed to initialise compressors\n");
@@ -336,9 +329,6 @@ static int __init init_jffs2_fs(void)
        jffs2_destroy_slab_caches();
  out_compressors:
        jffs2_compressors_exit();
-#ifdef CONFIG_JFFS2_PROC
-        jffs2_proc_exit();
-#endif
  out:
        return ret;
 }
@@ -348,9 +338,6 @@ static void __exit exit_jffs2_fs(void)
        unregister_filesystem(&jffs2_fs_type);
        jffs2_destroy_slab_caches();
        jffs2_compressors_exit();
-#ifdef CONFIG_JFFS2_PROC
-        jffs2_proc_exit();
-#endif
        kmem_cache_destroy(jffs2_inode_cachep);
 }
 
index fc25e63..0204acb 100644 (file)
@@ -60,7 +60,7 @@
  *
  *  Initial implementation of mandatory locks. SunOS turned out to be
  *  a rotten model, so I implemented the "obvious" semantics.
- *  See 'linux/Documentation/mandatory.txt' for details.
+ *  See 'Documentation/mandatory.txt' for details.
  *  Andy Walker (andy@lysaker.kvaerner.no), April 06, 1996.
  *
  *  Don't allow mandatory locks on mmap()'ed files. Added simple functions to
index 79fdc78..71c7ca3 100644 (file)
@@ -553,7 +553,12 @@ alloc_new:
                        bh = bh->b_this_page;
                } while (bh != head);
 
-               if (buffer_heads_over_limit)
+               /*
+                * we cannot drop the bh if the page is not uptodate
+                * or a concurrent readpage would fail to serialize with the bh
+                * and it would read from disk before we reach the platter.
+                */
+               if (buffer_heads_over_limit && PageUptodate(page))
                        try_to_free_buffers(page);
        }
 
index 89281b7..89a748b 100644 (file)
@@ -674,9 +674,11 @@ int fastcall link_path_walk(const char * name, struct nameidata *nd)
 {
        struct path next;
        struct inode *inode;
-       int err;
+       int err, atomic;
        unsigned int lookup_flags = nd->flags;
-       
+
+       atomic = (lookup_flags & LOOKUP_ATOMIC);
+
        while (*name=='/')
                name++;
        if (!*name)
@@ -744,6 +746,9 @@ int fastcall link_path_walk(const char * name, struct nameidata *nd)
                        if (err < 0)
                                break;
                }
+               err = -EWOULDBLOCKIO;
+               if (atomic)
+                       break;
                nd->flags |= LOOKUP_CONTINUE;
                /* This does the actual lookups.. */
                err = do_lookup(nd, &this, &next);
@@ -808,6 +813,9 @@ last_component:
                        if (err < 0)
                                break;
                }
+               err = -EWOULDBLOCKIO;
+               if (atomic)
+                       break;
                err = do_lookup(nd, &this, &next);
                if (err)
                        break;
@@ -1174,6 +1182,8 @@ static inline int lookup_flags(unsigned int f)
        
        if (f & O_DIRECTORY)
                retval |= LOOKUP_DIRECTORY;
+       if (f & O_ATOMICLOOKUP)
+               retval |= LOOKUP_ATOMIC;
 
        return retval;
 }
index b5e7224..c186ab4 100644 (file)
@@ -1065,6 +1065,7 @@ int copy_namespace(int flags, struct task_struct *tsk)
        struct namespace *new_ns;
        struct vfsmount *rootmnt = NULL, *pwdmnt = NULL, *altrootmnt = NULL;
        struct fs_struct *fs = tsk->fs;
+       struct vfsmount *p, *q;
 
        if (!namespace)
                return 0;
@@ -1099,14 +1100,16 @@ int copy_namespace(int flags, struct task_struct *tsk)
        list_add_tail(&new_ns->list, &new_ns->root->mnt_list);
        spin_unlock(&vfsmount_lock);
 
-       /* Second pass: switch the tsk->fs->* elements */
-       if (fs) {
-               struct vfsmount *p, *q;
-               write_lock(&fs->lock);
-
-               p = namespace->root;
-               q = new_ns->root;
-               while (p) {
+       /*
+        * Second pass: switch the tsk->fs->* elements and mark new vfsmounts
+        * as belonging to new namespace.  We have already acquired a private
+        * fs_struct, so tsk->fs->lock is not needed.
+        */
+       p = namespace->root;
+       q = new_ns->root;
+       while (p) {
+               q->mnt_namespace = new_ns;
+               if (fs) {
                        if (p == fs->rootmnt) {
                                rootmnt = p;
                                fs->rootmnt = mntget(q);
@@ -1119,10 +1122,9 @@ int copy_namespace(int flags, struct task_struct *tsk)
                                altrootmnt = p;
                                fs->altrootmnt = mntget(q);
                        }
-                       p = next_mnt(p, namespace->root);
-                       q = next_mnt(q, new_ns->root);
                }
-               write_unlock(&fs->lock);
+               p = next_mnt(p, namespace->root);
+               q = next_mnt(q, new_ns->root);
        }
        up_write(&tsk->namespace->sem);
 
index 26e0f13..0ca23f2 100644 (file)
@@ -958,7 +958,7 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
 #endif
        }
        if (!result)
-               inode_setattr(inode, attr);
+               result = inode_setattr(inode, attr);
 out:
        unlock_kernel();
        return result;
index 02deae0..6d9150d 100644 (file)
@@ -33,8 +33,6 @@
 
 #define NFSDBG_FACILITY                NFSDBG_FILE
 
-static long nfs_file_fcntl(int fd, unsigned int cmd,
-                       unsigned long arg, struct file *filp);
 static int nfs_file_open(struct inode *, struct file *);
 static int nfs_file_release(struct inode *, struct file *);
 static int  nfs_file_mmap(struct file *, struct vm_area_struct *);
@@ -43,6 +41,7 @@ static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t);
 static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t);
 static int  nfs_file_flush(struct file *);
 static int  nfs_fsync(struct file *, struct dentry *dentry, int datasync);
+static int nfs_check_flags(int flags);
 
 struct file_operations nfs_file_operations = {
        .llseek         = remote_llseek,
@@ -57,7 +56,7 @@ struct file_operations nfs_file_operations = {
        .fsync          = nfs_fsync,
        .lock           = nfs_lock,
        .sendfile       = nfs_file_sendfile,
-       .fcntl          = nfs_file_fcntl,
+       .check_flags    = nfs_check_flags,
 };
 
 struct inode_operations nfs_file_inode_operations = {
@@ -71,26 +70,12 @@ struct inode_operations nfs_file_inode_operations = {
 # define IS_SWAPFILE(inode)    (0)
 #endif
 
-#define nfs_invalid_flags      (O_APPEND | O_DIRECT)
-
-/*
- * Check for special cases that NFS doesn't support, and
- * pass the rest to the generic fcntl function.
- */
-static long
-nfs_file_fcntl(int fd, unsigned int cmd,
-               unsigned long arg, struct file *filp)
+static int nfs_check_flags(int flags)
 {
-       switch (cmd) {
-       case F_SETFL:
-               if ((filp->f_flags & nfs_invalid_flags) == nfs_invalid_flags)
-                       return -EINVAL;
-               break;
-       default:
-               break;
-       }
+       if ((flags & (O_APPEND | O_DIRECT)) == (O_APPEND | O_DIRECT))
+               return -EINVAL;
 
-       return generic_file_fcntl(fd, cmd, arg, filp);
+       return 0;
 }
 
 /*
@@ -101,10 +86,11 @@ nfs_file_open(struct inode *inode, struct file *filp)
 {
        struct nfs_server *server = NFS_SERVER(inode);
        int (*open)(struct inode *, struct file *);
-       int res = 0;
+       int res;
 
-       if ((filp->f_flags & nfs_invalid_flags) == nfs_invalid_flags)
-               return -EINVAL;
+       res = nfs_check_flags(filp->f_flags);
+       if (res)
+               return res;
 
        lock_kernel();
        /* Do NFSv4 open() call */
index 6a32483..01aebbf 100644 (file)
@@ -231,7 +231,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args)
 static int
 nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
 {
-       struct iovec *iov = req->rq_rcv_buf.head;
+       struct kvec *iov = req->rq_rcv_buf.head;
        int     status, count, recvd, hdrlen;
 
        if ((status = ntohl(*p++)))
@@ -375,7 +375,7 @@ static int
 nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy)
 {
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
-       struct iovec *iov = rcvbuf->head;
+       struct kvec *iov = rcvbuf->head;
        struct page **page;
        int hdrlen, recvd;
        int status, nr;
@@ -530,7 +530,7 @@ static int
 nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy)
 {
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
-       struct iovec *iov = rcvbuf->head;
+       struct kvec *iov = rcvbuf->head;
        unsigned int hdrlen;
        u32     *strlen, len;
        char    *string;
index 4708e63..30d7151 100644 (file)
@@ -485,7 +485,7 @@ static int
 nfs3_xdr_readdirres(struct rpc_rqst *req, u32 *p, struct nfs3_readdirres *res)
 {
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
-       struct iovec *iov = rcvbuf->head;
+       struct kvec *iov = rcvbuf->head;
        struct page **page;
        int hdrlen, recvd;
        int status, nr;
@@ -722,7 +722,7 @@ static int
 nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
 {
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
-       struct iovec *iov = rcvbuf->head;
+       struct kvec *iov = rcvbuf->head;
        unsigned int hdrlen;
        u32     *strlen, len;
        char    *string;
@@ -762,7 +762,7 @@ nfs3_xdr_readlinkres(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr)
 static int
 nfs3_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res)
 {
-       struct iovec *iov = req->rq_rcv_buf.head;
+       struct kvec *iov = req->rq_rcv_buf.head;
        int     status, count, ocount, recvd, hdrlen;
 
        status = ntohl(*p++);
index a2cd117..a14079f 100644 (file)
@@ -933,7 +933,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg
        WRITE32(FATTR4_WORD0_FILEID);
        WRITE32(0);
 
-       /* set up reply iovec
+       /* set up reply kvec
         *    toplevel_status + taglen + rescount + OP_PUTFH + status
         *      + OP_READDIR + status + verifer(2)  = 9
         */
@@ -954,7 +954,7 @@ static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *r
        RESERVE_SPACE(4);
        WRITE32(OP_READLINK);
 
-       /* set up reply iovec
+       /* set up reply kvec
         *    toplevel_status + taglen + rescount + OP_PUTFH + status
         *      + OP_READLINK + status  = 7
         */
@@ -1501,7 +1501,7 @@ static int nfs4_xdr_enc_read(struct rpc_rqst *req, uint32_t *p, struct nfs_reada
        if (status)
                goto out;
 
-       /* set up reply iovec
+       /* set up reply kvec
         *    toplevel status + taglen=0 + rescount + OP_PUTFH + status
         *       + OP_READ + status + eof + datalen = 9
         */
@@ -2785,7 +2785,7 @@ static int decode_putrootfh(struct xdr_stream *xdr)
 
 static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs_readres *res)
 {
-       struct iovec *iov = req->rq_rcv_buf.head;
+       struct kvec *iov = req->rq_rcv_buf.head;
        uint32_t *p;
        uint32_t count, eof, recvd, hdrlen;
        int status;
@@ -2814,7 +2814,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
 {
        struct xdr_buf  *rcvbuf = &req->rq_rcv_buf;
        struct page     *page = *rcvbuf->pages;
-       struct iovec    *iov = rcvbuf->head;
+       struct kvec     *iov = rcvbuf->head;
        unsigned int    nr, pglen = rcvbuf->page_len;
        uint32_t        *end, *entry, *p, *kaddr;
        uint32_t        len, attrlen, word;
@@ -2897,7 +2897,7 @@ err_unmap:
 static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
 {
        struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
-       struct iovec *iov = rcvbuf->head;
+       struct kvec *iov = rcvbuf->head;
        uint32_t *strlen;
        unsigned int hdrlen, len;
        char *string;
index a45bd68..0a94be4 100644 (file)
@@ -75,7 +75,7 @@ decode_fh(u32 *p, struct svc_fh *fhp)
 static inline u32 *
 encode_fh(u32 *p, struct svc_fh *fhp)
 {
-       int size = fhp->fh_handle.fh_size;
+       unsigned int size = fhp->fh_handle.fh_size;
        *p++ = htonl(size);
        if (size) p[XDR_QUADLEN(size)-1]=0;
        memcpy(p, &fhp->fh_handle.fh_base, size);
@@ -331,7 +331,7 @@ int
 nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd3_readargs *args)
 {
-       int len;
+       unsigned int len;
        int v,pn;
 
        if (!(p = decode_fh(p, &args->fh))
@@ -343,15 +343,15 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
        if (len > NFSSVC_MAXBLKSIZE)
                len = NFSSVC_MAXBLKSIZE;
 
-       /* set up the iovec */
+       /* set up the kvec */
        v=0;
        while (len > 0) {
                pn = rqstp->rq_resused;
                svc_take_page(rqstp);
                args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]);
                args->vec[v].iov_len = len < PAGE_SIZE? len : PAGE_SIZE;
+               len -= args->vec[v].iov_len;
                v++;
-               len -= PAGE_SIZE;
        }
        args->vlen = v;
        return xdr_argsize_check(rqstp, p);
@@ -361,7 +361,7 @@ int
 nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd3_writeargs *args)
 {
-       int len, v;
+       unsigned int len, v, hdr;
 
        if (!(p = decode_fh(p, &args->fh))
         || !(p = xdr_decode_hyper(p, &args->offset)))
@@ -371,9 +371,12 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
        args->stable = ntohl(*p++);
        len = args->len = ntohl(*p++);
 
+       hdr = (void*)p - rqstp->rq_arg.head[0].iov_base;
+       if (rqstp->rq_arg.len < len + hdr)
+               return 0;
+
        args->vec[0].iov_base = (void*)p;
-       args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len -
-               (((void*)p) - rqstp->rq_arg.head[0].iov_base);
+       args->vec[0].iov_len = rqstp->rq_arg.head[0].iov_len - hdr;
 
        if (len > NFSSVC_MAXBLKSIZE)
                len = NFSSVC_MAXBLKSIZE;
@@ -430,10 +433,10 @@ int
 nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd3_symlinkargs *args)
 {
-       int len;
+       unsigned int len;
        int avail;
        char *old, *new;
-       struct iovec *vec;
+       struct kvec *vec;
 
        if (!(p = decode_fh(p, &args->ffh))
         || !(p = decode_filename(p, &args->fname, &args->flen))
@@ -447,7 +450,7 @@ nfs3svc_decode_symlinkargs(struct svc_rqst *rqstp, u32 *p,
         */
        svc_take_page(rqstp);
        len = ntohl(*p++);
-       if (len <= 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE)
+       if (len == 0 || len > NFS3_MAXPATHLEN || len >= PAGE_SIZE)
                return 0;
        args->tname = new = page_address(rqstp->rq_respages[rqstp->rq_resused-1]);
        args->tlen = len;
index 4df0ded..0ff4425 100644 (file)
@@ -1140,10 +1140,9 @@ int status;
 
        if (share_access & NFS4_SHARE_ACCESS_WRITE) {
                status = get_write_access(filp->f_dentry->d_inode);
-               if (!status)
-                       filp->f_mode = FMODE_WRITE;
-               else
+               if (status)
                        return nfserrno(status);
+               filp->f_mode = (filp->f_mode | FMODE_WRITE) & ~FMODE_READ;
        }
        return nfs_ok;
 }
@@ -1153,7 +1152,7 @@ nfs4_file_downgrade(struct file *filp, unsigned int share_access)
 {
        if (share_access & NFS4_SHARE_ACCESS_WRITE) {
                put_write_access(filp->f_dentry->d_inode);
-               filp->f_mode = FMODE_READ;
+               filp->f_mode = (filp->f_mode | FMODE_READ) & ~FMODE_WRITE;
        }
 }
 
index 41b6d12..5710f79 100644 (file)
@@ -2522,7 +2522,7 @@ nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compound
        /*
         * All that remains is to write the tag and operation count...
         */
-       struct iovec *iov;
+       struct kvec *iov;
        p = resp->tagp;
        *p++ = htonl(resp->taglen);
        memcpy(p, resp->tag, resp->taglen);
index 6e230b5..6bee45f 100644 (file)
@@ -237,7 +237,7 @@ int
 nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd_readargs *args)
 {
-       int len;
+       unsigned int len;
        int v,pn;
        if (!(p = decode_fh(p, &args->fh)))
                return 0;
@@ -258,8 +258,8 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, u32 *p,
                svc_take_page(rqstp);
                args->vec[v].iov_base = page_address(rqstp->rq_respages[pn]);
                args->vec[v].iov_len = len < PAGE_SIZE?len:PAGE_SIZE;
+               len -= args->vec[v].iov_len;
                v++;
-               len -= PAGE_SIZE;
        }
        args->vlen = v;
        return xdr_argsize_check(rqstp, p);
@@ -269,7 +269,7 @@ int
 nfssvc_decode_writeargs(struct svc_rqst *rqstp, u32 *p,
                                        struct nfsd_writeargs *args)
 {
-       int len;
+       unsigned int len;
        int v;
        if (!(p = decode_fh(p, &args->fh)))
                return 0;
index b5ebd40..b2eb466 100644 (file)
@@ -641,7 +641,7 @@ nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset
  */
 int
 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
-          struct iovec *vec, int vlen, unsigned long *count)
+          struct kvec *vec, int vlen, unsigned long *count)
 {
        struct raparms  *ra;
        mm_segment_t    oldfs;
@@ -673,7 +673,7 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
        } else {
                oldfs = get_fs();
                set_fs(KERNEL_DS);
-               err = vfs_readv(&file, vec, vlen, &offset);
+               err = vfs_readv(&file, (struct iovec __user *)vec, vlen, &offset);
                set_fs(oldfs);
        }
 
@@ -704,7 +704,7 @@ out:
  */
 int
 nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
-                               struct iovec *vec, int vlen,
+                               struct kvec *vec, int vlen,
                                unsigned long cnt, int *stablep)
 {
        struct svc_export       *exp;
@@ -753,7 +753,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset,
 
        /* Write the data. */
        oldfs = get_fs(); set_fs(KERNEL_DS);
-       err = vfs_writev(&file, vec, vlen, &offset);
+       err = vfs_writev(&file, (struct iovec __user *)vec, vlen, &offset);
        set_fs(oldfs);
        if (err >= 0) {
                nfsdstats.io_write += cnt;
index f9aca53..c39391b 100644 (file)
@@ -195,7 +195,7 @@ static int ntfs_decompress(struct page *dest_pages[], int *dest_index,
 
        ntfs_debug("Entering, cb_size = 0x%x.", cb_size);
 do_next_sb:
-       ntfs_debug("Beginning sub-block at offset = 0x%x in the cb.",
+       ntfs_debug("Beginning sub-block at offset = 0x%zx in the cb.",
                        cb - cb_start);
        /*
         * Have we reached the end of the compression block or the end of the
index aad3a12..2468622 100644 (file)
@@ -1222,7 +1222,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
         * or signals an error (both covered by the rc test).
         */
        for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
-               ntfs_debug("In index root, offset 0x%x.", (u8*)ie - (u8*)ir);
+               ntfs_debug("In index root, offset 0x%zx.", (u8*)ie - (u8*)ir);
                /* Bounds checks. */
                if (unlikely((u8*)ie < (u8*)ir || (u8*)ie +
                                sizeof(INDEX_ENTRY_HEADER) > index_end ||
index a0ca90d..e494285 100644 (file)
@@ -1190,7 +1190,7 @@ read_partial_upcase_page:
                        goto read_partial_upcase_page;
        }
        vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS;
-       ntfs_debug("Read %llu bytes from $UpCase (expected %u bytes).",
+       ntfs_debug("Read %llu bytes from $UpCase (expected %zu bytes).",
                        ino->i_size, 64 * 1024 * sizeof(ntfschar));
        iput(ino);
        down(&ntfs_lock);
index 07f7124..f8e7015 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -795,7 +795,7 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags)
        if (!f)
                goto cleanup_dentry;
        f->f_flags = flags;
-       f->f_mode = (flags+1) & O_ACCMODE;
+       f->f_mode = ((flags+1) & O_ACCMODE) | FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
        inode = dentry->d_inode;
        if (f->f_mode & FMODE_WRITE) {
                error = get_write_access(inode);
@@ -1084,3 +1084,15 @@ int generic_file_open(struct inode * inode, struct file * filp)
 }
 
 EXPORT_SYMBOL(generic_file_open);
+
+/*
+ * This is used by subsystems that don't want seekable
+ * file descriptors
+ */
+int nonseekable_open(struct inode *inode, struct file *filp)
+{
+       filp->f_mode &= ~(FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE);
+       return 0;
+}
+
+EXPORT_SYMBOL(nonseekable_open);
index cc37e01..ed30849 100644 (file)
@@ -395,7 +395,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
        if (disk->fops->revalidate_disk)
                disk->fops->revalidate_disk(disk);
        if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
-               return res;
+               return -EIO;
        for (p = 1; p < state->limit; p++) {
                sector_t size = state->parts[p].size;
                sector_t from = state->parts[p].from;
@@ -408,7 +408,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
 #endif
        }
        kfree(state);
-       return res;
+       return 0;
 }
 
 unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p)
index 737271c..36264d5 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -94,10 +94,6 @@ pipe_readv(struct file *filp, const struct iovec *_iov,
        struct iovec *iov = (struct iovec *)_iov;
        size_t total_len;
 
-       /* pread is not allowed on pipes. */
-       if (unlikely(ppos != &filp->f_pos))
-               return -ESPIPE;
-
        total_len = iov_length(iov, nr_segs);
        /* Null read succeeds. */
        if (unlikely(total_len == 0))
@@ -187,10 +183,6 @@ pipe_writev(struct file *filp, const struct iovec *_iov,
        struct iovec *iov = (struct iovec *)_iov;
        size_t total_len;
 
-       /* pwrite is not allowed on pipes. */
-       if (unlikely(ppos != &filp->f_pos))
-               return -ESPIPE;
-
        total_len = iov_length(iov, nr_segs);
        /* Null write succeeds. */
        if (unlikely(total_len == 0))
@@ -656,13 +648,13 @@ int do_pipe(int *fd)
        f1->f_pos = f2->f_pos = 0;
        f1->f_flags = O_RDONLY;
        f1->f_op = &read_pipe_fops;
-       f1->f_mode = 1;
+       f1->f_mode = FMODE_READ;
        f1->f_version = 0;
 
        /* write file */
        f2->f_flags = O_WRONLY;
        f2->f_op = &write_pipe_fops;
-       f2->f_mode = 2;
+       f2->f_mode = FMODE_WRITE;
        f2->f_version = 0;
 
        fd_install(i, f1);
@@ -688,6 +680,8 @@ no_files:
        return error;   
 }
 
+EXPORT_SYMBOL_GPL(do_pipe);
+
 /*
  * pipefs should _never_ be mounted by userland - too much of security hassle,
  * no real gain from having the whole whorehouse mounted. So we don't need
index d00c864..0f00cc9 100644 (file)
@@ -142,6 +142,7 @@ static inline const char * get_task_state(struct task_struct *tsk)
                                           TASK_INTERRUPTIBLE |
                                           TASK_UNINTERRUPTIBLE |
                                           TASK_ZOMBIE |
+                                          TASK_DEAD |
                                           TASK_STOPPED |
                                           TASK_ONHOLD);
        const char **p = &task_state_array[0];
index bf99867..7bf9572 100644 (file)
@@ -113,9 +113,12 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
 {
        loff_t (*fn)(struct file *, loff_t, int);
 
-       fn = default_llseek;
-       if (file->f_op && file->f_op->llseek)
-               fn = file->f_op->llseek;
+       fn = no_llseek;
+       if (file->f_mode & FMODE_LSEEK) {
+               fn = default_llseek;
+               if (file->f_op && file->f_op->llseek)
+                       fn = file->f_op->llseek;
+       }
        return fn(file, offset, origin);
 }
 EXPORT_SYMBOL(vfs_llseek);
@@ -266,6 +269,16 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
 
 EXPORT_SYMBOL(vfs_write);
 
+static inline loff_t file_pos_read(struct file *file)
+{
+       return file->f_pos;
+}
+
+static inline void file_pos_write(struct file *file, loff_t pos)
+{
+       file->f_pos = pos;
+}
+
 asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
 {
        struct file *file;
@@ -274,7 +287,9 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_read(file, buf, count, &file->f_pos);
+               loff_t pos = file_pos_read(file);
+               ret = vfs_read(file, buf, count, &pos);
+               file_pos_write(file, pos);
                fput_light(file, fput_needed);
        }
 
@@ -289,7 +304,9 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_write(file, buf, count, &file->f_pos);
+               loff_t pos = file_pos_read(file);
+               ret = vfs_write(file, buf, count, &pos);
+               file_pos_write(file, pos);
                fput_light(file, fput_needed);
        }
 
@@ -308,7 +325,9 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_read(file, buf, count, &pos);
+               ret = -ESPIPE;
+               if (file->f_mode & FMODE_PREAD)
+                       ret = vfs_read(file, buf, count, &pos);
                fput_light(file, fput_needed);
        }
 
@@ -327,7 +346,9 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_write(file, buf, count, &pos);
+               ret = -ESPIPE;
+               if (file->f_mode & FMODE_PWRITE)  
+                       ret = vfs_write(file, buf, count, &pos);
                fput_light(file, fput_needed);
        }
 
@@ -511,7 +532,9 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_readv(file, vec, vlen, &file->f_pos);
+               loff_t pos = file_pos_read(file);
+               ret = vfs_readv(file, vec, vlen, &pos);
+               file_pos_write(file, pos);
                fput_light(file, fput_needed);
        }
 
@@ -527,7 +550,9 @@ sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
 
        file = fget_light(fd, &fput_needed);
        if (file) {
-               ret = vfs_writev(file, vec, vlen, &file->f_pos);
+               loff_t pos = file_pos_read(file);
+               ret = vfs_writev(file, vec, vlen, &pos);
+               file_pos_write(file, pos);
                fput_light(file, fput_needed);
        }
 
@@ -558,8 +583,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
                goto fput_in;
        if (!in_file->f_op || !in_file->f_op->sendfile)
                goto fput_in;
+       retval = -ESPIPE;
        if (!ppos)
                ppos = &in_file->f_pos;
+       else
+               if (!(in_file->f_mode & FMODE_PREAD))
+                       goto fput_in;
        retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, *ppos, count);
        if (retval)
                goto fput_in;
index 6b7d6c1..d475904 100644 (file)
@@ -20,6 +20,7 @@
 #define O_DIRECTORY    0100000 /* must be a directory */
 #define O_NOFOLLOW     0200000 /* don't follow links */
 #define O_LARGEFILE    0400000 /* will be set by the kernel on every open */
+#define O_ATOMICLOOKUP 01000000 /* do atomic file lookup */
 #define O_DIRECT       02000000 /* direct disk access - should check with OSF/1 */
 #define O_NOATIME      04000000
 
index b316fc6..d53c53e 100644 (file)
@@ -106,6 +106,7 @@ extern __inline__ int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS          (VM_READ | VM_WRITE | VM_EXEC | \
                                         VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
 #endif /* __KERNEL__ */
 
 #endif /* _ALPHA_PAGE_H */
index f9dd3eb..d2d03a4 100644 (file)
@@ -41,7 +41,7 @@
     {INR_OPEN, INR_OPEN},                      /* RLIMIT_NOFILE */     \
     {LONG_MAX, LONG_MAX},                      /* RLIMIT_AS */         \
     {LONG_MAX, LONG_MAX},                      /* RLIMIT_NPROC */      \
-    {PAGE_SIZE, PAGE_SIZE},                    /* RLIMIT_MEMLOCK */    \
+    {32768,    32768   },                      /* RLIMIT_MEMLOCK */    \
     {LONG_MAX, LONG_MAX},                      /* RLIMIT_LOCKS */      \
     {MAX_SIGPENDING, MAX_SIGPENDING},          /* RLIMIT_SIGPENDING */ \
     {MQ_BYTES_MAX, MQ_BYTES_MAX},              /* RLIMIT_MSGQUEUE */   \
index 192c23d..cc5394e 100644 (file)
@@ -107,7 +107,7 @@ extern void __get_user_unknown(void);
 #define __get_user_check(x,ptr,size,segment)                           \
 ({                                                                     \
        long __gu_err = -EFAULT, __gu_val = 0;                          \
-       const __typeof__(*(ptr)) *__gu_addr = (ptr);                    \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
        __chk_user_ptr(ptr);                                            \
        if (__access_ok((unsigned long)__gu_addr,size,segment)) {       \
                __gu_err = 0;                                           \
@@ -222,7 +222,7 @@ extern void __put_user_unknown(void);
 #define __put_user_check(x,ptr,size,segment)                           \
 ({                                                                     \
        long __pu_err = -EFAULT;                                        \
-       __typeof__(*(ptr)) *__pu_addr = (ptr);                          \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);                   \
        __chk_user_ptr(ptr);                                            \
        if (__access_ok((unsigned long)__pu_addr,size,segment)) {       \
                __pu_err = 0;                                           \
diff --git a/include/asm-arm/arch-lh7a40x/ide.h b/include/asm-arm/arch-lh7a40x/ide.h
deleted file mode 100644 (file)
index fb50c07..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/* include/asm-arm/arch-lh7a40x/ide.h
- *
- *  Copyright (C) 2004 Logic Product Development
- *
- *  This program is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU General Public License
- *  version 2 as published by the Free Software Foundation.
- *
- */
-
-#ifndef __ASM_ARCH_IDE_H
-#define __ASM_ARCH_IDE_H
-
-#if defined (CONFIG_MACH_LPD7A400) || defined (CONFIG_MACH_LPD7A404)
-
-/*  This implementation of ide.h only applies to the LPD CardEngines.
- *  Thankfully, there is less to do for the KEV.
- */
-
-#include <linux/config.h>
-#include <asm/irq.h>
-#include <asm/hardware.h>
-#include <asm/arch/registers.h>
-
-#define IDE_REG_LINE   (1<<12) /* A12 drives !REG  */
-#define IDE_ALT_LINE   (1<<11) /* Unused A11 allows non-overlapping regions */
-#define IDE_CONTROLREG_OFFSET  (0xe)
-
-void lpd7a40x_hwif_ioops (struct hwif_s* hwif);
-
-static __inline__ void ide_init_hwif_ports (hw_regs_t *hw, int data_port,
-                                           int ctrl_port, int *irq)
-{
-       ide_ioreg_t reg;
-        int i;
-        int regincr = 1;
-
-        memset (hw, 0, sizeof (*hw));
-
-        reg = (ide_ioreg_t) data_port;
-
-        for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
-                hw->io_ports[i] = reg;
-                reg += regincr;
-        }
-
-        hw->io_ports[IDE_CONTROL_OFFSET] = (ide_ioreg_t) ctrl_port;
-
-        if (irq)
-                *irq = IDE_NO_IRQ;
-}
-
-static __inline__  void ide_init_default_hwifs (void)
-{
-       hw_regs_t hw;
-       struct hwif_s* hwif;
-
-       ide_init_hwif_ports (&hw,
-                            CF_VIRT + IDE_REG_LINE,
-                            CF_VIRT + IDE_REG_LINE + IDE_ALT_LINE
-                            + IDE_CONTROLREG_OFFSET,
-                            NULL);
-
-       ide_register_hw (&hw, &hwif);
-       lpd7a40x_hwif_ioops (hwif); /* Override IO routines */
-}
-#endif
-
-#endif
index 048ed44..84d8752 100644 (file)
@@ -97,7 +97,7 @@
  *     Start addresses are inclusive and end addresses are exclusive;
  *     start addresses should be rounded down, end addresses up.
  *
- *     See linux/Documentation/cachetlb.txt for more information.
+ *     See Documentation/cachetlb.txt for more information.
  *     Please note that the implementation of these, and the required
  *     effects are cache-type (VIVT/VIPT/PIPT) specific.
  *
index b2b9b3d..cf9b1b3 100644 (file)
 #define MAX_HWIFS      4
 #endif
 
-#if defined(CONFIG_ARCH_LH7A40X) || defined(CONFIG_ARCH_SA1100)
+#if defined(CONFIG_ARCH_SA1100)
 # include <asm/arch/ide.h>     /* obsolete + broken */
 #endif
 
-#if !defined(CONFIG_ARCH_L7200) && !defined(CONFIG_ARCH_LH7A40X)
+#if !defined(CONFIG_ARCH_L7200)
 # define IDE_ARCH_OBSOLETE_INIT
 # ifdef CONFIG_ARCH_CLPS7500
 #  define ide_default_io_ctl(base)     ((base) + 0x206) /* obsolete */
 # else
 #  define ide_default_io_ctl(base)     (0)
 # endif
-#endif /* !ARCH_L7200 && !ARCH_LH7A40X */
+#endif /* !ARCH_L7200 */
 
 #define __ide_mm_insw(port,addr,len)   readsw(port,addr,len)
 #define __ide_mm_insl(port,addr,len)   readsl(port,addr,len)
index bb86668..05f6f1e 100644 (file)
@@ -196,6 +196,8 @@ static inline int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif
index b891b4b..f98f259 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { 0,             0             },       \
        { INR_OPEN,      INR_OPEN      },       \
-       { PAGE_SIZE,      PAGE_SIZE    },       \
+       { 32768,         32768         },       \
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { MAX_SIGPENDING, MAX_SIGPENDING},      \
index dc58da8..ac311c5 100644 (file)
@@ -8,7 +8,7 @@
  * published by the Free Software Foundation.
  *
  *  Structure passed to kernel to tell it about the
- *  hardware it's running on.  See linux/Documentation/arm/Setup
+ *  hardware it's running on.  See Documentation/arm/Setup
  *  for more info.
  */
 #ifndef __ASMARM_SETUP_H
index 8945189..f367152 100644 (file)
@@ -68,6 +68,7 @@ static inline void set_fs (mm_segment_t fs)
 /* We use 33-bit arithmetic here... */
 #define __range_ok(addr,size) ({ \
        unsigned long flag, sum; \
+       __chk_user_ptr(addr);   \
        __asm__("adds %1, %2, %3; sbcccs %1, %1, %0; movcc %0, #0" \
                : "=&r" (flag), "=&r" (sum) \
                : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit) \
@@ -117,7 +118,7 @@ extern int __get_user_bad(void);
 
 #define get_user(x,p)                                                  \
        ({                                                              \
-               const register typeof(*(p)) *__p asm("r0") = (p);       \
+               const register typeof(*(p)) __user *__p asm("r0") = (p);\
                register typeof(*(p)) __r1 asm("r1");                   \
                register int __e asm("r0");                             \
                switch (sizeof(*(__p))) {                               \
@@ -156,6 +157,7 @@ extern int __get_user_bad(void);
 do {                                                                   \
        unsigned long __gu_addr = (unsigned long)(ptr);                 \
        unsigned long __gu_val;                                         \
+       __chk_user_ptr(ptr);                                            \
        switch (sizeof(*(ptr))) {                                       \
        case 1: __get_user_asm_byte(__gu_val,__gu_addr,err);    break;  \
        case 2: __get_user_asm_half(__gu_val,__gu_addr,err);    break;  \
@@ -236,7 +238,7 @@ extern int __put_user_bad(void);
 #define put_user(x,p)                                                  \
        ({                                                              \
                const register typeof(*(p)) __r1 asm("r1") = (x);       \
-               const register typeof(*(p)) *__p asm("r0") = (p);       \
+               const register typeof(*(p)) __user *__p asm("r0") = (p);\
                register int __e asm("r0");                             \
                switch (sizeof(*(__p))) {                               \
                case 1:                                                 \
@@ -273,6 +275,7 @@ extern int __put_user_bad(void);
 do {                                                                   \
        unsigned long __pu_addr = (unsigned long)(ptr);                 \
        __typeof__(*(ptr)) __pu_val = (x);                              \
+       __chk_user_ptr(ptr);                                            \
        switch (sizeof(*(ptr))) {                                       \
        case 1: __put_user_asm_byte(__pu_val,__pu_addr,err);    break;  \
        case 2: __put_user_asm_half(__pu_val,__pu_addr,err);    break;  \
index c334079..29f2836 100644 (file)
@@ -110,6 +110,8 @@ static inline int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif
index bb58d74..f98f259 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { 0,             0             },       \
        { INR_OPEN,      INR_OPEN      },       \
-       { PAGE_SIZE,     PAGE_SIZE     },       \
+       { 32768,         32768         },       \
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { RLIM_INFINITY, RLIM_INFINITY },       \
        { MAX_SIGPENDING, MAX_SIGPENDING},      \
index bebb889..e290e34 100644 (file)
@@ -96,6 +96,8 @@ static inline int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _CRIS_PAGE_H */
index 223214e..bae364c 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       {     PAGE_SIZE,    PAGE_SIZE  },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index ee74be6..2957319 100644 (file)
@@ -122,4 +122,8 @@ static inline void ptep_mkdirty(pte_t *ptep)
 #define page_test_and_clear_young(page) (0)
 #endif
 
+#ifndef __HAVE_ARCH_PGD_OFFSET_GATE
+#define pgd_offset_gate(mm, addr)      pgd_offset(mm, addr)
+#endif
+
 #endif /* _ASM_GENERIC_PGTABLE_H */
index 132b0ea..7bc99ea 100644 (file)
@@ -96,6 +96,8 @@ extern unsigned long memory_end;
 
 #endif /* __ASSEMBLY__ */
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _H8300_PAGE_H */
index 9510a06..f580cf8 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index f55884b..c960aa0 100644 (file)
@@ -118,9 +118,14 @@ typedef struct user_fxsr_struct elf_fpxregset_t;
 #define AT_SYSINFO_EHDR                33
 
 #ifdef __KERNEL__
-/* child inherits the personality of the parent */
 #define SET_PERSONALITY(ex, ibcs2) do { } while (0)
 
+/*
+ * An executable for which elf_read_implies_exec() returns TRUE will
+ * have the READ_IMPLIES_EXEC personality flag set automatically.
+ */
+#define elf_read_implies_exec_binary(ex, have_pt_gnu_stack)    (!(have_pt_gnu_stack))
+
 extern int dump_task_regs (struct task_struct *, elf_gregset_t *);
 extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *);
 extern int dump_task_extended_fpu (struct task_struct *, struct user_fxsr_struct *);
index 511cde9..6fb3e35 100644 (file)
@@ -21,6 +21,7 @@
 #define O_DIRECTORY    0200000 /* must be a directory */
 #define O_NOFOLLOW     0400000 /* don't follow links */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP 02000000 /* do atomic file lookup */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
index 37b969f..a387a7f 100644 (file)
@@ -13,7 +13,7 @@
 
 #ifdef CONFIG_X86_IO_APIC
 
-#ifdef CONFIG_PCI_USE_VECTOR
+#ifdef CONFIG_PCI_MSI
 static inline int use_pci_vector(void) {return 1;}
 static inline void disable_edge_ioapic_vector(unsigned int vector) { }
 static inline void mask_and_ack_level_ioapic_vector(unsigned int vector) { }
index 25366b7..5716db1 100644 (file)
@@ -128,6 +128,8 @@ static __inline__ int get_order(unsigned long size)
        return order;
 }
 
+extern int devmem_is_allowed(unsigned long pagenr);
+
 #endif /* __ASSEMBLY__ */
 
 #define PAGE_OFFSET            ((unsigned long)__PAGE_OFFSET)
@@ -146,8 +148,12 @@ static __inline__ int get_order(unsigned long size)
 
 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 
-#define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | \
-                                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+#define VM_DATA_DEFAULT_FLAGS \
+       (VM_READ | VM_WRITE | \
+       ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
+                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
+
+
 
 #endif /* __KERNEL__ */
 
index 4b5ecab..3cf7bb0 100644 (file)
@@ -53,6 +53,4 @@ static inline void pte_free(struct page *pte)
 
 #define check_pgt_cache()      do { } while (0)
 
-#define HAVE_ARCH_UNMAPPED_AREA 1
-
 #endif /* _I386_PGALLOC_H */
index f42af69..cd8708b 100644 (file)
@@ -291,13 +291,10 @@ extern unsigned int mca_pentium_flag;
  */
 #define TASK_UNMAPPED_BASE     PAGE_ALIGN(TASK_SIZE/3)
 
-#define SHLIB_BASE             0x00111000
 #define __HAVE_ARCH_ALIGN_STACK
 extern unsigned long arch_align_stack(unsigned long sp);
 
-#define __HAVE_ARCH_MMAP_TOP
-extern unsigned long mmap_top(void);
+#define HAVE_ARCH_PICK_MMAP_LAYOUT
 
 /*
  * Size of io_bitmap, covering ports 0 to 0x3ff.
index 5ef4e76..f81444a 100644 (file)
@@ -40,7 +40,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index 96195ce..55c3220 100644 (file)
@@ -27,6 +27,7 @@
  */
 #if !defined(IN_STRING_C)
 
+#define __HAVE_ARCH_STRCPY
 static inline char * strcpy(char * dest,const char *src)
 {
 int d0, d1, d2;
@@ -40,6 +41,7 @@ __asm__ __volatile__(
 return dest;
 }
 
+#define __HAVE_ARCH_STRNCPY
 static inline char * strncpy(char * dest,const char *src,size_t count)
 {
 int d0, d1, d2, d3;
@@ -81,6 +83,7 @@ static inline size_t strncpy_count(char * dest,const char *src,size_t count)
        return count;
 }
 
+#define __HAVE_ARCH_STRCAT
 static inline char * strcat(char * dest,const char * src)
 {
 int d0, d1, d2, d3;
@@ -97,6 +100,7 @@ __asm__ __volatile__(
 return dest;
 }
 
+#define __HAVE_ARCH_STRNCAT
 static inline char * strncat(char * dest,const char * src,size_t count)
 {
 int d0, d1, d2, d3;
@@ -119,6 +123,7 @@ __asm__ __volatile__(
 return dest;
 }
 
+#define __HAVE_ARCH_STRCMP
 static inline int strcmp(const char * cs,const char * ct)
 {
 int d0, d1;
@@ -139,6 +144,7 @@ __asm__ __volatile__(
 return __res;
 }
 
+#define __HAVE_ARCH_STRNCMP
 static inline int strncmp(const char * cs,const char * ct,size_t count)
 {
 register int __res;
@@ -161,6 +167,7 @@ __asm__ __volatile__(
 return __res;
 }
 
+#define __HAVE_ARCH_STRCHR
 static inline char * strchr(const char * s, int c)
 {
 int d0;
@@ -179,6 +186,7 @@ __asm__ __volatile__(
 return __res;
 }
 
+#define __HAVE_ARCH_STRRCHR
 static inline char * strrchr(const char * s, int c)
 {
 int d0, d1;
index 49d7bbb..47351a3 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/thread_info.h>
 #include <linux/prefetch.h>
 #include <linux/string.h>
-#include <linux/compiler.h>
 #include <asm/page.h>
 
 #define VERIFY_READ 0
@@ -301,7 +300,7 @@ extern void __put_user_bad(void);
 #define __put_user_check(x,ptr,size)                                   \
 ({                                                                     \
        long __pu_err = -EFAULT;                                        \
-       __typeof__(*(ptr)) *__pu_addr = (ptr);                          \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);                   \
        might_sleep();                                          \
        if (access_ok(VERIFY_WRITE,__pu_addr,size))                     \
                __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \
@@ -415,8 +414,8 @@ do {                                                                        \
                : "m"(__m(addr)), "i"(errret), "0"(err))
 
 
-unsigned long __must_check __copy_to_user_ll(void __user *to, const void *from, unsigned long n);
-unsigned long __must_check __copy_from_user_ll(void *to, const void __user *from, unsigned long n);
+unsigned long __copy_to_user_ll(void __user *to, const void *from, unsigned long n);
+unsigned long __copy_from_user_ll(void *to, const void __user *from, unsigned long n);
 
 /*
  * Here we special-case 1, 2 and 4-byte copy_*_user invocations.  On a fault
@@ -439,7 +438,7 @@ unsigned long __must_check __copy_from_user_ll(void *to, const void __user *from
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
-static inline unsigned long __must_check
+static inline unsigned long
 __direct_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
        if (__builtin_constant_p(n)) {
@@ -477,7 +476,7 @@ __direct_copy_to_user(void __user *to, const void *from, unsigned long n)
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
  */
-static inline unsigned long __must_check
+static inline unsigned long
 __direct_copy_from_user(void *to, const void __user *from, unsigned long n)
 {
        if (__builtin_constant_p(n)) {
@@ -511,7 +510,7 @@ __direct_copy_from_user(void *to, const void __user *from, unsigned long n)
  * Returns number of bytes that could not be copied.
  * On success, this will be zero.
  */
-static inline unsigned long __must_check
+static inline unsigned long
 direct_copy_to_user(void __user *to, const void *from, unsigned long n)
 {
        might_sleep();
@@ -536,7 +535,7 @@ direct_copy_to_user(void __user *to, const void *from, unsigned long n)
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
  */
-static inline unsigned long __must_check
+static inline unsigned long
 direct_copy_from_user(void *to, const void __user *from, unsigned long n)
 {
        might_sleep();
index 0df3f9b..72b388b 100644 (file)
 
 #define NR_syscalls 284
 
+#ifndef __KERNEL_SYSCALLS_NO_ERRNO__
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 
 #define __syscall_return(type, res) \
@@ -303,6 +304,10 @@ do { \
        return (type) (res); \
 } while (0)
 
+#else
+# define __syscall_return(type, res) return (type) (res)
+#endif
+
 /* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
 #define _syscall0(type,name) \
 type name(void) \
@@ -425,15 +430,7 @@ __syscall_return(type,__res); \
  * won't be any messing with the stack from main(), but we define
  * some others too.
  */
-static inline _syscall0(pid_t,setsid)
-static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
-static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
-static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
-static inline _syscall1(int,dup,int,fd)
 static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
-static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
-static inline _syscall1(int,close,int,fd)
-static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
 
 asmlinkage int sys_modify_ldt(int func, void __user *ptr, unsigned long bytecount);
 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
index d193981..7499eaa 100644 (file)
@@ -29,6 +29,7 @@
 #define O_DIRECTORY    0200000 /* must be a directory */
 #define O_NOFOLLOW     0400000 /* don't follow links */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP  02000000 /* do atomic file lookup */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
index 2564e95..ff881e2 100644 (file)
@@ -29,8 +29,8 @@ typedef void ia64_mv_timer_interrupt_t (int, void *, struct pt_regs *);
 typedef void ia64_mv_global_tlb_purge_t (unsigned long, unsigned long, unsigned long);
 typedef void ia64_mv_tlb_migrate_finish_t (struct mm_struct *);
 typedef struct irq_desc *ia64_mv_irq_desc (unsigned int);
-typedef u8 ia64_mv_irq_to_vector (u8);
-typedef unsigned int ia64_mv_local_vector_to_irq (u8 vector);
+typedef u8 ia64_mv_irq_to_vector (unsigned int);
+typedef unsigned int ia64_mv_local_vector_to_irq (u8);
 
 /* DMA-mapping interface: */
 typedef void ia64_mv_dma_init (void);
index 315a863..7b1e650 100644 (file)
@@ -187,4 +187,6 @@ get_order (unsigned long size)
                                         (((current->personality & READ_IMPLIES_EXEC) != 0)     \
                                          ? VM_EXEC : 0))
 
+#define devmem_is_allowed(x) 1
+
 #endif /* _ASM_IA64_PAGE_H */
index 69a9e8d..4e9da65 100644 (file)
 static inline pgd_t*
 pgd_alloc_one_fast (struct mm_struct *mm)
 {
-       unsigned long *ret = pgd_quicklist;
+       unsigned long *ret = NULL;
 
+       preempt_disable();
+
+       ret = pgd_quicklist;
        if (likely(ret != NULL)) {
                pgd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                --pgtable_cache_size;
        } else
                ret = NULL;
+
+       preempt_enable();
+
        return (pgd_t *) ret;
 }
 
@@ -69,9 +75,11 @@ pgd_alloc (struct mm_struct *mm)
 static inline void
 pgd_free (pgd_t *pgd)
 {
+       preempt_disable();
        *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
        pgd_quicklist = (unsigned long *) pgd;
        ++pgtable_cache_size;
+       preempt_enable();
 }
 
 static inline void
@@ -84,13 +92,19 @@ pgd_populate (struct mm_struct *mm, pgd_t *pgd_entry, pmd_t *pmd)
 static inline pmd_t*
 pmd_alloc_one_fast (struct mm_struct *mm, unsigned long addr)
 {
-       unsigned long *ret = (unsigned long *)pmd_quicklist;
+       unsigned long *ret = NULL;
 
+       preempt_disable();
+
+       ret = (unsigned long *)pmd_quicklist;
        if (likely(ret != NULL)) {
                pmd_quicklist = (unsigned long *)(*ret);
                ret[0] = 0;
                --pgtable_cache_size;
        }
+
+       preempt_enable();
+
        return (pmd_t *)ret;
 }
 
@@ -107,9 +121,11 @@ pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
 static inline void
 pmd_free (pmd_t *pmd)
 {
+       preempt_disable();
        *(unsigned long *)pmd = (unsigned long) pmd_quicklist;
        pmd_quicklist = (unsigned long *) pmd;
        ++pgtable_cache_size;
+       preempt_enable();
 }
 
 #define __pmd_free_tlb(tlb, pmd)       pmd_free(pmd)
index c30329a..8433966 100644 (file)
@@ -321,6 +321,11 @@ pgd_offset (struct mm_struct *mm, unsigned long address)
 #define pgd_offset_k(addr) \
        (init_mm.pgd + (((addr) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)))
 
+/* Look up a pgd entry in the gate area.  On IA-64, the gate-area
+   resides in the kernel-mapped segment, hence we use pgd_offset_k()
+   here.  */
+#define pgd_offset_gate(mm, addr)      pgd_offset_k(addr)
+
 /* Find an entry in the second-level page table.. */
 #define pmd_offset(dir,addr) \
        ((pmd_t *) pgd_page(*(dir)) + (((addr) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)))
@@ -552,6 +557,7 @@ do {                                                                                        \
 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
 #define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
+#define __HAVE_ARCH_PGD_OFFSET_GATE
 #include <asm-generic/pgtable.h>
 
 #endif /* _ASM_IA64_PGTABLE_H */
index dec7d3f..f62f93c 100644 (file)
@@ -2,7 +2,7 @@
 #define _ASM_IA64_PROCESSOR_H
 
 /*
- * Copyright (C) 1998-2003 Hewlett-Packard Co
+ * Copyright (C) 1998-2004 Hewlett-Packard Co
  *     David Mosberger-Tang <davidm@hpl.hp.com>
  *     Stephane Eranian <eranian@hpl.hp.com>
  * Copyright (C) 1999 Asit Mallick <asit.k.mallick@intel.com>
@@ -61,7 +61,6 @@
                                                        /* bit 5 is currently unused */
 #define IA64_THREAD_FPEMU_NOPRINT (__IA64_UL(1) << 6)  /* don't log any fpswa faults */
 #define IA64_THREAD_FPEMU_SIGFPE  (__IA64_UL(1) << 7)  /* send a SIGFPE for fpswa faults */
-#define IA64_THREAD_XSTACK     (__IA64_UL(1) << 8)     /* stack executable by default? */
 
 #define IA64_THREAD_UAC_SHIFT  3
 #define IA64_THREAD_UAC_MASK   (IA64_THREAD_UAC_NOPRINT | IA64_THREAD_UAC_SIGBUS)
index 226d379..d4f90c2 100644 (file)
@@ -46,7 +46,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index cc06342..5bd9b33 100644 (file)
@@ -141,8 +141,8 @@ sn_sal_rev_minor(void)
  * Specify the minimum PROM revsion required for this kernel.
  * Note that they're stored in hex format...
  */
-#define SN_SAL_MIN_MAJOR       0x1  /* SN2 kernels need at least PROM 1.0 */
-#define SN_SAL_MIN_MINOR       0x0
+#define SN_SAL_MIN_MAJOR       0x3  /* SN2 kernels need at least PROM 3.40 */
+#define SN_SAL_MIN_MINOR       0x40
 
 u64 ia64_sn_probe_io_slot(long paddr, long size, void *data_ptr);
 
index d46f47f..1f0a16b 100644 (file)
 #define __NR_syslog                    1117
 #define __NR_setitimer                 1118
 #define __NR_getitimer                 1119
-/* 1120 was __NR_old_stat */
+#define __NR_tux                       1120 /* was __NR_old_stat */
 /* 1121 was __NR_old_lstat */
 /* 1122 was __NR_old_fstat */
 #define __NR_vhangup                   1123
index 05ccc86..b1bcf7c 100644 (file)
@@ -52,14 +52,14 @@ static inline int __generic_test_and_set_bit(int nr, unsigned long *vaddr)
 
 #define __set_bit(nr,vaddr) set_bit(nr,vaddr)
 
-static inline void __constant_set_bit(int nr, unsigned long *vaddr)
+static inline void __constant_set_bit(int nr, volatile unsigned long *vaddr)
 {
        char *p = (char *)vaddr + (nr ^ 31) / 8;
        __asm__ __volatile__ ("bset %1,%0"
                        : "+m" (*p) : "di" (nr & 7));
 }
 
-static inline void __generic_set_bit(int nr, unsigned long *vaddr)
+static inline void __generic_set_bit(int nr, volatile unsigned long *vaddr)
 {
        __asm__ __volatile__ ("bfset %1{%0:#1}"
                        : : "d" (nr^31), "o" (*vaddr) : "memory");
@@ -106,14 +106,14 @@ static inline int __generic_test_and_clear_bit(int nr, unsigned long *vaddr)
    __generic_clear_bit(nr, vaddr))
 #define __clear_bit(nr,vaddr) clear_bit(nr,vaddr)
 
-static inline void __constant_clear_bit(int nr, unsigned long *vaddr)
+static inline void __constant_clear_bit(int nr, volatile unsigned long *vaddr)
 {
        char *p = (char *)vaddr + (nr ^ 31) / 8;
        __asm__ __volatile__ ("bclr %1,%0"
                        : "+m" (*p) : "di" (nr & 7));
 }
 
-static inline void __generic_clear_bit(int nr, unsigned long *vaddr)
+static inline void __generic_clear_bit(int nr, volatile unsigned long *vaddr)
 {
        __asm__ __volatile__ ("bfclr %1{%0:#1}"
                        : : "d" (nr^31), "o" (*vaddr) : "memory");
index 99a5167..3fa5600 100644 (file)
@@ -190,6 +190,8 @@ static inline void *__va(unsigned long x)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _M68K_PAGE_H */
index a9014f2..e1f406b 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index d00e10f..fd82411 100644 (file)
@@ -31,10 +31,7 @@ static inline void pte_free(struct page *page)
         __free_page(page);
 }
 
-static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *page)
-{
-       tlb_remove_page(tlb, page);
-}
+#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte))
 
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
                                          unsigned long address)
index 0d063a9..14e8d8f 100644 (file)
@@ -96,6 +96,8 @@ extern unsigned long memory_end;
 
 #endif /* __ASSEMBLY__ */
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _M68KNOMMU_PAGE_H */
index 47ca67f..47fcb86 100644 (file)
@@ -137,4 +137,6 @@ static __inline__ int get_order(unsigned long size)
 #define WANT_PAGE_VIRTUAL
 #endif
 
+#define devmem_is_allowed(x) 1
+
 #endif /* _ASM_PAGE_H */
index caa3173..914f70c 100644 (file)
@@ -30,7 +30,7 @@
 #define smp_mb__before_clear_bit()      smp_mb()
 #define smp_mb__after_clear_bit()       smp_mb()
 
-static __inline__ void set_bit(int nr, void * address)
+static __inline__ void set_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -43,7 +43,7 @@ static __inline__ void set_bit(int nr, void * address)
        atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
-static __inline__ void __set_bit(int nr, void * address)
+static __inline__ void __set_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -53,7 +53,7 @@ static __inline__ void __set_bit(int nr, void * address)
        *addr |= mask;
 }
 
-static __inline__ void clear_bit(int nr, void * address)
+static __inline__ void clear_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -66,7 +66,7 @@ static __inline__ void clear_bit(int nr, void * address)
        atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
-static __inline__ void __clear_bit(unsigned long nr, volatile void * address)
+static __inline__ void __clear_bit(unsigned long nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -76,7 +76,7 @@ static __inline__ void __clear_bit(unsigned long nr, volatile void * address)
        *addr &= ~mask;
 }
 
-static __inline__ void change_bit(int nr, void * address)
+static __inline__ void change_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -89,7 +89,7 @@ static __inline__ void change_bit(int nr, void * address)
        atomic_spin_unlock_irqrestore(ATOMIC_HASH(addr), flags);
 }
 
-static __inline__ void __change_bit(int nr, void * address)
+static __inline__ void __change_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -99,7 +99,7 @@ static __inline__ void __change_bit(int nr, void * address)
        *addr ^= mask;
 }
 
-static __inline__ int test_and_set_bit(int nr, void * address)
+static __inline__ int test_and_set_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -116,7 +116,7 @@ static __inline__ int test_and_set_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int __test_and_set_bit(int nr, void * address)
+static __inline__ int __test_and_set_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -130,7 +130,7 @@ static __inline__ int __test_and_set_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int test_and_clear_bit(int nr, void * address)
+static __inline__ int test_and_clear_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -147,7 +147,7 @@ static __inline__ int test_and_clear_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int __test_and_clear_bit(int nr, void * address)
+static __inline__ int __test_and_clear_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -161,7 +161,7 @@ static __inline__ int __test_and_clear_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int test_and_change_bit(int nr, void * address)
+static __inline__ int test_and_change_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -178,7 +178,7 @@ static __inline__ int test_and_change_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int __test_and_change_bit(int nr, void * address)
+static __inline__ int __test_and_change_bit(int nr, volatile unsigned long * address)
 {
        unsigned long mask;
        unsigned long *addr = (unsigned long *) address;
@@ -192,10 +192,10 @@ static __inline__ int __test_and_change_bit(int nr, void * address)
        return oldbit;
 }
 
-static __inline__ int test_bit(int nr, const void *address)
+static __inline__ int test_bit(int nr, const volatile unsigned long *address)
 {
        unsigned long mask;
-       unsigned long *addr = (unsigned long *) address;
+       const unsigned long *addr = (const unsigned long *)address;
        
        addr += (nr >> SHIFT_PER_LONG);
        mask = 1L << CHOP_SHIFTCOUNT(nr);
@@ -322,7 +322,7 @@ static __inline__ int fls(int x)
  * 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)
+static inline int sched_find_first_bit(const unsigned long *b)
 {
 #ifndef __LP64__
        if (unlikely(b[0]))
@@ -354,9 +354,9 @@ static inline int sched_find_first_bit(unsigned long *b)
 #define find_first_zero_bit(addr, size) \
        find_next_zero_bit((addr), (size), 0)
 
-static __inline__ unsigned long find_next_zero_bit(void * addr, unsigned long size, unsigned long offset)
+static __inline__ unsigned long find_next_zero_bit(const void * addr, unsigned long size, unsigned long offset)
 {
-       unsigned long * p = ((unsigned long *) addr) + (offset >> SHIFT_PER_LONG);
+       const unsigned long * p = ((unsigned long *) addr) + (offset >> SHIFT_PER_LONG);
        unsigned long result = offset & ~(BITS_PER_LONG-1);
        unsigned long tmp;
 
@@ -389,9 +389,9 @@ found_middle:
        return result + ffz(tmp);
 }
 
-static __inline__ unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+static __inline__ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset)
 {
-       unsigned long *p = addr + (offset >> 6);
+       const unsigned long *p = addr + (offset >> 6);
        unsigned long result = offset & ~(BITS_PER_LONG-1);
        unsigned long tmp;
 
@@ -446,15 +446,15 @@ found_middle:
  * disabling interrupts.
  */
 #ifdef __LP64__
-#define ext2_set_bit(nr, addr)         test_and_set_bit((nr) ^ 0x38, addr)
-#define ext2_set_bit_atomic(l,nr,addr)  test_and_set_bit((nr) ^ 0x38, addr)
-#define ext2_clear_bit(nr, addr)       test_and_clear_bit((nr) ^ 0x38, addr)
-#define ext2_clear_bit_atomic(l,nr,addr) test_and_clear_bit((nr) ^ 0x38, addr)
+#define ext2_set_bit(nr, addr)         test_and_set_bit((nr) ^ 0x38, (unsigned long *)addr)
+#define ext2_set_bit_atomic(l,nr,addr)  test_and_set_bit((nr) ^ 0x38, (unsigned long *)addr)
+#define ext2_clear_bit(nr, addr)       test_and_clear_bit((nr) ^ 0x38, (unsigned long *)addr)
+#define ext2_clear_bit_atomic(l,nr,addr) test_and_clear_bit((nr) ^ 0x38, (unsigned long *)addr)
 #else
-#define ext2_set_bit(nr, addr)         test_and_set_bit((nr) ^ 0x18, addr)
-#define ext2_set_bit_atomic(l,nr,addr)  test_and_set_bit((nr) ^ 0x18, addr)
-#define ext2_clear_bit(nr, addr)       test_and_clear_bit((nr) ^ 0x18, addr)
-#define ext2_clear_bit_atomic(l,nr,addr) test_and_clear_bit((nr) ^ 0x18, addr)
+#define ext2_set_bit(nr, addr)         test_and_set_bit((nr) ^ 0x18, (unsigned long *)addr)
+#define ext2_set_bit_atomic(l,nr,addr)  test_and_set_bit((nr) ^ 0x18, (unsigned long *)addr)
+#define ext2_clear_bit(nr, addr)       test_and_clear_bit((nr) ^ 0x18, (unsigned long *)addr)
+#define ext2_clear_bit_atomic(l,nr,addr) test_and_clear_bit((nr) ^ 0x18, (unsigned long *)addr)
 #endif
 
 #endif /* __KERNEL__ */
index a5700c2..3086cda 100644 (file)
@@ -65,18 +65,7 @@ flush_user_icache_range(unsigned long start, unsigned long end)
 #endif
 }
 
-extern void __flush_dcache_page(struct page *page);
-
-static inline void flush_dcache_page(struct page *page)
-{
-       struct address_space *mapping = page_mapping(page);
-
-       if (mapping && !mapping_mapped(mapping)) {
-               set_bit(PG_dcache_dirty, &page->flags);
-       } else {
-               __flush_dcache_page(page);
-       }
-}
+extern void flush_dcache_page(struct page *page);
 
 #define flush_dcache_mmap_lock(mapping) \
        spin_lock_irq(&(mapping)->tree_lock)
@@ -115,28 +104,29 @@ static inline void flush_cache_range(struct vm_area_struct *vma,
 
 /* Simple function to work out if we have an existing address translation
  * for a user space vma. */
-static inline int translation_exists(struct vm_area_struct *vma,
-                                    unsigned long addr)
+static inline pte_t *__translation_exists(struct mm_struct *mm,
+                                         unsigned long addr)
 {
-       pgd_t *pgd = pgd_offset(vma->vm_mm, addr);
+       pgd_t *pgd = pgd_offset(mm, addr);
        pmd_t *pmd;
        pte_t *pte;
 
        if(pgd_none(*pgd))
-               return 0;
+               return NULL;
 
        pmd = pmd_offset(pgd, addr);
        if(pmd_none(*pmd) || pmd_bad(*pmd))
-               return 0;
+               return NULL;
 
        pte = pte_offset_map(pmd, addr);
 
        /* The PA flush mappings show up as pte_none, but they're
         * valid none the less */
        if(pte_none(*pte) && ((pte_val(*pte) & _PAGE_FLUSH) == 0))
-               return 0;
-       return 1;
+               return NULL;
+       return pte;
 }
+#define        translation_exists(vma, addr)   __translation_exists((vma)->vm_mm, addr)
 
 
 /* Private function to flush a page from the cache of a non-current
index 89808f7..be44581 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/mm.h>
 #include <linux/config.h>
 #include <asm/cacheflush.h>
+#include <asm/scatterlist.h>
 
 /* See Documentation/DMA-mapping.txt */
 struct hppa_dma_ops {
index 3fc29c6..b383b3c 100644 (file)
@@ -97,6 +97,7 @@ struct bc_module {
 #define HPHW_IOA       12
 #define HPHW_BRIDGE    13
 #define HPHW_FABRIC    14
+#define HPHW_MC               15
 #define HPHW_FAULTY    31
 
 
index 54cc342..cb77536 100644 (file)
@@ -60,10 +60,15 @@ typedef struct { unsigned long pgprot; } pgprot_t;
 #else
 #define pte_flags(x)   ((x).flags)
 #endif
-#define pmd_val(x)     ((x).pmd)
-#define pgd_val(x)     ((x).pgd)
+
+/* These do not work lvalues, so make sure we don't use them as such. */
+#define pmd_val(x)     ((x).pmd + 0)
+#define pgd_val(x)     ((x).pgd + 0)
 #define pgprot_val(x)  ((x).pgprot)
 
+#define __pmd_val_set(x,n) (x).pmd = (n)
+#define __pgd_val_set(x,n) (x).pgd = (n)
+
 #define __pte(x)       ((pte_t) { (x) } )
 #define __pmd(x)       ((pmd_t) { (x) } )
 #define __pgd(x)       ((pgd_t) { (x) } )
@@ -83,12 +88,6 @@ extern __inline__ int get_order(unsigned long size)
        return order;
 }
 
-#ifdef __LP64__
-#define MAX_PHYSMEM_RANGES 8 /* Fix the size for now (current known max is 3) */
-#else
-#define MAX_PHYSMEM_RANGES 1 /* First range is only range that fits in 32 bits */
-#endif
-
 typedef struct __physmem_range {
        unsigned long start_pfn;
        unsigned long pages;       /* PAGE_SIZE pages */
@@ -144,19 +143,22 @@ extern int npmem_ranges;
 #define __pa(x)                        ((unsigned long)(x)-PAGE_OFFSET)
 #define __va(x)                        ((void *)((unsigned long)(x)+PAGE_OFFSET))
 
+#ifndef CONFIG_DISCONTIGMEM
 #define pfn_to_page(pfn)       (mem_map + (pfn))
 #define page_to_pfn(page)      ((unsigned long)((page) - mem_map))
 #define pfn_valid(pfn)         ((pfn) < max_mapnr)
+#endif /* CONFIG_DISCONTIGMEM */
+
 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 
-#ifndef CONFIG_DISCONTIGMEM
-#define virt_to_page(kaddr)     (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
-#define VALID_PAGE(page)       ((page - mem_map) < max_mapnr)
-#endif  /* !CONFIG_DISCONTIGMEM */
+#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
+#define virt_to_page(kaddr)     pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _PARISC_PAGE_H */
index 990ddd3..ce9a9e1 100644 (file)
@@ -297,175 +297,6 @@ typedef struct {
 #define OSTAT_RUN              6
 #define OSTAT_ON               7
 
-#ifdef __LP64__
-/* PDC PAT CELL */
-#define PDC_PAT_CELL   64L             /* Interface for gaining and 
-                                        * manipulating cell state within PD */
-#define PDC_PAT_CELL_GET_NUMBER           0L   /* Return Cell number           */
-#define PDC_PAT_CELL_GET_INFO      1L  /* Returns info about Cell      */
-#define PDC_PAT_CELL_MODULE        2L  /* Returns info about Module    */
-#define PDC_PAT_CELL_SET_ATTENTION 9L  /* Set Cell Attention indicator */
-#define PDC_PAT_CELL_NUMBER_TO_LOC 10L /* Cell Number -> Location      */
-#define PDC_PAT_CELL_WALK_FABRIC   11L /* Walk the Fabric              */
-#define PDC_PAT_CELL_GET_RDT_SIZE  12L /* Return Route Distance Table Sizes */
-#define PDC_PAT_CELL_GET_RDT       13L /* Return Route Distance Tables */
-#define PDC_PAT_CELL_GET_LOCAL_PDH_SZ  14L /* Read Local PDH Buffer Size*/
-#define PDC_PAT_CELL_SET_LOCAL_PDH     15L /* Write Local PDH Buffer   */
-#define PDC_PAT_CELL_GET_REMOTE_PDH_SZ 16L /* Return Remote PDH Buffer Size */
-#define PDC_PAT_CELL_GET_REMOTE_PDH    17L /* Read Remote PDH Buffer   */
-#define PDC_PAT_CELL_GET_DBG_INFO  128L        /* Return DBG Buffer Info       */
-#define PDC_PAT_CELL_CHANGE_ALIAS  129L        /* Change Non-Equivalent Alias Checking */
-
-/*
-** Arg to PDC_PAT_CELL_MODULE memaddr[4]
-**
-** Addresses on the Merced Bus != all Runway Bus addresses.
-** This is intended for programming SBA/LBA chips range registers.
-*/
-#define IO_VIEW                        0UL
-#define PA_VIEW                        1UL
-
-/* PDC_PAT_CELL_MODULE entity type values */
-#define PAT_ENTITY_CA          0       /* central agent        */
-#define PAT_ENTITY_PROC                1       /* processor            */
-#define PAT_ENTITY_MEM         2       /* memory controller    */
-#define PAT_ENTITY_SBA         3       /* system bus adapter   */
-#define PAT_ENTITY_LBA         4       /* local bus adapter    */
-#define PAT_ENTITY_PBC         5       /* processor bus converter */
-#define PAT_ENTITY_XBC         6       /* crossbar fabric connect */
-#define PAT_ENTITY_RC          7       /* fabric interconnect  */
-
-/* PDC_PAT_CELL_MODULE address range type values */
-#define PAT_PBNUM              0       /* PCI Bus Number       */
-#define PAT_LMMIO              1       /* < 4G MMIO Space      */
-#define PAT_GMMIO              2       /* > 4G MMIO Space      */
-#define PAT_NPIOP              3       /* Non Postable I/O Port Space */
-#define PAT_PIOP               4       /* Postable I/O Port Space */
-#define PAT_AHPA               5       /* Additional HPA Space */
-#define PAT_UFO                        6       /* HPA Space (UFO for Mariposa) */
-#define PAT_GNIP               7       /* GNI Reserved Space   */
-
-
-/* PDC PAT CHASSIS LOG */
-#define PDC_PAT_CHASSIS_LOG    65L     /* Platform logging & forward
-                                        ** progress functions  */
-#define PDC_PAT_CHASSIS_WRITE_LOG      0L /* Write Log Entry   */
-#define PDC_PAT_CHASSIS_READ_LOG       1L /* Read  Log Entry   */
-
-
-/* PDC PAT CPU  */
-#define PDC_PAT_CPU            67L     /* Interface to CPU configuration
-                                        * within the protection domain */
-#define PDC_PAT_CPU_INFO               0L /* Return CPU config info    */
-#define PDC_PAT_CPU_DELETE             1L /* Delete CPU                */
-#define PDC_PAT_CPU_ADD                        2L /* Add    CPU                */
-#define PDC_PAT_CPU_GET_NUMBER         3L /* Return CPU Number         */
-#define PDC_PAT_CPU_GET_HPA            4L /* Return CPU HPA            */
-#define PDC_PAT_CPU_STOP               5L /* Stop   CPU                */
-#define PDC_PAT_CPU_RENDEZVOUS         6L /* Rendezvous CPU            */
-#define PDC_PAT_CPU_GET_CLOCK_INFO     7L /* Return CPU Clock info     */
-#define PDC_PAT_CPU_GET_RENDEZVOUS_STATE 8L /* Return Rendezvous State */
-#define PDC_PAT_CPU_PLUNGE_FABRIC      128L /* Plunge Fabric           */
-#define PDC_PAT_CPU_UPDATE_CACHE_CLEANSING 129L /* Manipulate Cache 
-                                                 * Cleansing Mode      */
-
-/*  PDC PAT EVENT */
-#define PDC_PAT_EVENT          68L     /* Interface to Platform Events */
-#define PDC_PAT_EVENT_GET_CAPS         0L /* Get Capabilities          */
-#define PDC_PAT_EVENT_SET_MODE         1L /* Set Notification Mode     */
-#define PDC_PAT_EVENT_SCAN             2L /* Scan Event                */
-#define PDC_PAT_EVENT_HANDLE           3L /* Handle Event              */
-#define PDC_PAT_EVENT_GET_NB_CALL      4L /* Get Non-Blocking call Args*/
-
-/*  PDC PAT HPMC */
-#define PDC_PAT_HPMC           70L     /* Cause processor to go into spin
-                                        ** loop, and wait for wake up from
-                                        ** Monarch Processor           */
-#define PDC_PAT_HPMC_RENDEZ_CPU                0L /* go into spin loop         */
-#define PDC_PAT_HPMC_SET_PARAMS                1L /* Allows OS to specify intr which PDC 
-                                        * will use to interrupt OS during machine
-                                        * check rendezvous             */
-
-/* parameters for PDC_PAT_HPMC_SET_PARAMS */
-#define HPMC_SET_PARAMS_INTR           1L /* Rendezvous Interrupt      */
-#define HPMC_SET_PARAMS_WAKE           2L /* Wake up processor         */
-
-/*  PDC PAT IO */
-#define PDC_PAT_IO             71L     /* On-line services for I/O modules */
-#define PDC_PAT_IO_GET_SLOT_STATUS      5L /* Get Slot Status Info     */
-#define PDC_PAT_IO_GET_LOC_FROM_HARDWARE 6L /* Get Physical Location from */
-                                            /* Hardware Path           */
-#define PDC_PAT_IO_GET_HARDWARE_FROM_LOC 7L /* Get Hardware Path from 
-                                             * Physical Location       */
-#define PDC_PAT_IO_GET_PCI_CONFIG_FROM_HW 11L /* Get PCI Configuration
-                                               * Address from Hardware Path */
-#define PDC_PAT_IO_GET_HW_FROM_PCI_CONFIG 12L /* Get Hardware Path 
-                                               * from PCI Configuration Address */
-#define PDC_PAT_IO_READ_HOST_BRIDGE_INFO  13L /* Read Host Bridge State Info */
-#define PDC_PAT_IO_CLEAR_HOST_BRIDGE_INFO 14L /* Clear Host Bridge State Info*/
-#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE_SIZE 15L /* Get PCI INT Routing Table 
-                                                   * Size              */
-#define PDC_PAT_IO_GET_PCI_ROUTING_TABLE  16L /* Get PCI INT Routing Table */
-#define PDC_PAT_IO_GET_HINT_TABLE_SIZE    17L /* Get Hint Table Size   */
-#define PDC_PAT_IO_GET_HINT_TABLE      18L /* Get Hint Table           */
-#define PDC_PAT_IO_PCI_CONFIG_READ     19L /* PCI Config Read          */
-#define PDC_PAT_IO_PCI_CONFIG_WRITE    20L /* PCI Config Write         */
-#define PDC_PAT_IO_GET_NUM_IO_SLOTS    21L /* Get Number of I/O Bay Slots in 
-                                                         * Cabinet             */
-#define PDC_PAT_IO_GET_LOC_IO_SLOTS    22L /* Get Physical Location of I/O */
-                                           /* Bay Slots in Cabinet     */
-#define PDC_PAT_IO_BAY_STATUS_INFO     28L /* Get I/O Bay Slot Status Info */
-#define PDC_PAT_IO_GET_PROC_VIEW       29L /* Get Processor view of IO address */
-#define PDC_PAT_IO_PROG_SBA_DIR_RANGE  30L /* Program directed range   */
-
-/* PDC PAT MEM */
-#define PDC_PAT_MEM            72L  /* Manage memory page deallocation */
-#define PDC_PAT_MEM_PD_INFO            0L /* Return PDT info for PD    */
-#define PDC_PAT_MEM_PD_CLEAR           1L /* Clear PDT for PD          */
-#define PDC_PAT_MEM_PD_READ            2L /* Read PDT entries for PD   */
-#define PDC_PAT_MEM_PD_RESET           3L /* Reset clear bit for PD    */
-#define PDC_PAT_MEM_CELL_INFO          5L /* Return PDT info For Cell  */
-#define PDC_PAT_MEM_CELL_CLEAR         6L /* Clear PDT For Cell        */
-#define PDC_PAT_MEM_CELL_READ          7L /* Read PDT entries For Cell */
-#define PDC_PAT_MEM_CELL_RESET         8L /* Reset clear bit For Cell  */
-#define PDC_PAT_MEM_SETGM              9L /* Set Golden Memory value   */
-#define PDC_PAT_MEM_ADD_PAGE           10L /* ADDs a page to the cell  */
-#define PDC_PAT_MEM_ADDRESS            11L /* Get Physical Location From*/
-                                           /* Memory Address           */
-#define PDC_PAT_MEM_GET_TXT_SIZE       12L /* Get Formatted Text Size  */
-#define PDC_PAT_MEM_GET_PD_TXT         13L /* Get PD Formatted Text    */
-#define PDC_PAT_MEM_GET_CELL_TXT       14L /* Get Cell Formatted Text  */
-#define PDC_PAT_MEM_RD_STATE_INFO      15L /* Read Mem Module State Info*/
-#define PDC_PAT_MEM_CLR_STATE_INFO     16L /*Clear Mem Module State Info*/
-#define PDC_PAT_MEM_CLEAN_RANGE        128L /*Clean Mem in specific range*/
-#define PDC_PAT_MEM_GET_TBL_SIZE       131L /* Get Memory Table Size   */
-#define PDC_PAT_MEM_GET_TBL            132L /* Get Memory Table        */
-
-/* PDC PAT NVOLATILE */
-#define PDC_PAT_NVOLATILE      73L        /* Access Non-Volatile Memory*/
-#define PDC_PAT_NVOLATILE_READ         0L /* Read Non-Volatile Memory  */
-#define PDC_PAT_NVOLATILE_WRITE                1L /* Write Non-Volatile Memory */
-#define PDC_PAT_NVOLATILE_GET_SIZE     2L /* Return size of NVM        */
-#define PDC_PAT_NVOLATILE_VERIFY       3L /* Verify contents of NVM    */
-#define PDC_PAT_NVOLATILE_INIT         4L /* Initialize NVM            */
-
-/* PDC PAT PD */
-#define PDC_PAT_PD             74L         /* Protection Domain Info   */
-#define PDC_PAT_PD_GET_ADDR_MAP                0L  /* Get Address Map          */
-
-/* PDC_PAT_PD_GET_ADDR_MAP entry types */
-#define PAT_MEMORY_DESCRIPTOR          1
-
-/* PDC_PAT_PD_GET_ADDR_MAP memory types */
-#define PAT_MEMTYPE_MEMORY             0
-#define PAT_MEMTYPE_FIRMWARE           4
-
-/* PDC_PAT_PD_GET_ADDR_MAP memory usage */
-#define PAT_MEMUSE_GENERAL             0
-#define PAT_MEMUSE_GI                  128
-#define PAT_MEMUSE_GNI                 129
-#endif /* __LP64__ */
-
 #ifndef __ASSEMBLY__
 
 #include <linux/types.h>
@@ -478,12 +309,6 @@ extern int pdc_type;
 #define PDC_TYPE_SYSTEM_MAP     1 /* 32-bit, but supports PDC_SYSTEM_MAP */
 #define PDC_TYPE_SNAKE          2 /* Doesn't support SYSTEM_MAP */
 
-#ifdef CONFIG_PARISC64
-#define is_pdc_pat()    (PDC_TYPE_PAT == pdc_type)
-#else
-#define is_pdc_pat()    (0)
-#endif
-
 struct pdc_chassis_info {       /* for PDC_CHASSIS_INFO */
        unsigned long actcnt;   /* actual number of bytes returned */
        unsigned long maxcnt;   /* maximum number of bytes that could be returned */
@@ -521,10 +346,10 @@ struct pdc_cache_cf {             /* for PDC_CACHE  (I/D-caches) */
 #ifdef __LP64__
                cc_padW:32,
 #endif
-               cc_alias:4,     /* alias boundaries for virtual addresses   */
+               cc_alias: 4,    /* alias boundaries for virtual addresses   */
                cc_block: 4,    /* to determine most efficient stride */
                cc_line : 3,    /* maximum amount written back as a result of store (multiple of 16 bytes) */
-               cc_pad0 : 2,    /* reserved */
+               cc_shift: 2,    /* how much to shift cc_block left */
                cc_wt   : 1,    /* 0 = WT-Dcache, 1 = WB-Dcache */
                cc_sh   : 2,    /* 0 = separate I/D-cache, else shared I/D-cache */
                cc_cst  : 3,    /* 0 = incoherent D-cache, 1=coherent D-cache */
@@ -674,40 +499,6 @@ struct pdc_tod {
        unsigned long tod_usec;
 };
 
-#ifdef __LP64__
-struct pdc_pat_cell_num {
-       unsigned long cell_num;
-       unsigned long cell_loc;
-};
-
-struct pdc_pat_cpu_num {
-       unsigned long cpu_num;
-       unsigned long cpu_loc;
-};
-
-struct pdc_pat_pd_addr_map_entry {
-       unsigned char entry_type;       /* 1 = Memory Descriptor Entry Type */
-       unsigned char reserve1[5];
-       unsigned char memory_type;
-       unsigned char memory_usage;
-       unsigned long paddr;
-       unsigned int  pages;            /* Length in 4K pages */
-       unsigned int  reserve2;
-       unsigned long cell_map;
-};
-
-/* FIXME: mod[508] should really be a union of the various mod components */
-struct pdc_pat_cell_mod_maddr_block {  /* PDC_PAT_CELL_MODULE */
-       unsigned long cba;              /* function 0 configuration space address */
-       unsigned long mod_info;         /* module information */
-       unsigned long mod_location;     /* physical location of the module */
-       struct hardware_path mod_path;  /* hardware path */
-       unsigned long mod[508];         /* PAT cell module components */
-};
-
-typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
-#endif /* __LP64__ */
-
 /* architected results from PDC_PIM/transfer hpmc on a PA1.1 machine */
 
 struct pdc_hpmc_pim_11 { /* PDC_PIM */
@@ -969,52 +760,6 @@ int pdc_sti_call(unsigned long func, unsigned long flags,
                  unsigned long inptr, unsigned long outputr,
                  unsigned long glob_cfg);
 
-#ifdef __LP64__
-int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
-int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
-int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long mod,
-                       unsigned long view_type, void *mem_addr);
-int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, void *hpa);
-int pdc_pat_get_irt_size(unsigned long *num_entries, unsigned long cell_num);
-int pdc_pat_get_irt(void *r_addr, unsigned long cell_num);
-int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, 
-                           unsigned long count, unsigned long offset);
-
-/********************************************************************
-* PDC_PAT_CELL[Return Cell Module] memaddr[0] conf_base_addr
-* ----------------------------------------------------------
-* Bit  0 to 51 - conf_base_addr
-* Bit 52 to 62 - reserved
-* Bit       63 - endianess bit
-********************************************************************/
-#define PAT_GET_CBA(value) ((value) & 0xfffffffffffff000UL)
-
-/********************************************************************
-* PDC_PAT_CELL[Return Cell Module] memaddr[1] mod_info
-* ----------------------------------------------------
-* Bit  0 to  7 - entity type
-*    0 = central agent,            1 = processor,
-*    2 = memory controller,        3 = system bus adapter,
-*    4 = local bus adapter,        5 = processor bus converter,
-*    6 = crossbar fabric connect,  7 = fabric interconnect,
-*    8 to 254 reserved,            255 = unknown.
-* Bit  8 to 15 - DVI
-* Bit 16 to 23 - IOC functions
-* Bit 24 to 39 - reserved
-* Bit 40 to 63 - mod_pages
-*    number of 4K pages a module occupies starting at conf_base_addr
-********************************************************************/
-#define PAT_GET_ENTITY(value)  (((value) >> 56) & 0xffUL)
-#define PAT_GET_DVI(value)     (((value) >> 48) & 0xffUL)
-#define PAT_GET_IOC(value)     (((value) >> 40) & 0xffUL)
-#define PAT_GET_MOD_PAGES(value)(((value) & 0xffffffUL)
-
-#else /* !__LP64__ */
-/* No PAT support for 32-bit kernels...sorry */
-#define pdc_pat_get_irt_size(num_entries, cell_numn)   PDC_BAD_PROC
-#define pdc_pat_get_irt(r_addr, cell_num)      PDC_BAD_PROC
-#endif /* !__LP64__ */
-
 extern void pdc_init(void);
 
 #endif /* __ASSEMBLY__ */
index 7b2a36c..53a6fec 100644 (file)
@@ -21,7 +21,7 @@
  * kernel for machines with under 4GB of memory) */
 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 {
-       pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL|GFP_DMA,
+       pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL,
                                               PGD_ALLOC_ORDER);
        pgd_t *actual_pgd = pgd;
 
@@ -30,13 +30,15 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
 #ifdef __LP64__
                actual_pgd += PTRS_PER_PGD;
                /* Populate first pmd with allocated memory.  We mark it
-                * with _PAGE_GATEWAY as a signal to the system that this
+                * with PxD_FLAG_ATTACHED as a signal to the system that this
                 * pmd entry may not be cleared. */
-               pgd_val(*actual_pgd) = (_PAGE_TABLE | _PAGE_GATEWAY) + 
-                       (__u32)__pa((unsigned long)pgd);
+               __pgd_val_set(*actual_pgd, (PxD_FLAG_PRESENT | 
+                                       PxD_FLAG_VALID | 
+                                       PxD_FLAG_ATTACHED) 
+                       + (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));
                /* The first pmd entry also is marked with _PAGE_GATEWAY as
                 * a signal that this pmd may not be freed */
-               pgd_val(*pgd) = _PAGE_GATEWAY;
+               __pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
 #endif
        }
        return actual_pgd;
@@ -56,14 +58,13 @@ static inline void pgd_free(pgd_t *pgd)
 
 static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
 {
-       pgd_val(*pgd) = _PAGE_TABLE + (__u32)__pa((unsigned long)pmd);
+       __pgd_val_set(*pgd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID) +
+                       (__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT));
 }
 
-/* NOTE: pmd must be in ZONE_DMA (<4GB) so the pgd pointer can be
- * housed in 32 bits */
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-       pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT|GFP_DMA,
+       pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL|__GFP_REPEAT,
                                               PMD_ORDER);
        if (pmd)
                memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
@@ -73,7 +74,7 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
 static inline void pmd_free(pmd_t *pmd)
 {
 #ifdef __LP64__
-       if(pmd_val(*pmd) & _PAGE_GATEWAY)
+       if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
                /* This is the permanent pmd attached to the pgd;
                 * cannot free it */
                return;
@@ -102,23 +103,24 @@ pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
 #ifdef __LP64__
        /* preserve the gateway marker if this is the beginning of
         * the permanent pmd */
-       if(pmd_val(*pmd) & _PAGE_GATEWAY)
-               pmd_val(*pmd) = (_PAGE_TABLE | _PAGE_GATEWAY)
-                       + (__u32)__pa((unsigned long)pte);
+       if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
+               __pmd_val_set(*pmd, (PxD_FLAG_PRESENT |
+                                PxD_FLAG_VALID |
+                                PxD_FLAG_ATTACHED) 
+                       + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
        else
 #endif
-               pmd_val(*pmd) = _PAGE_TABLE + (__u32)__pa((unsigned long)pte);
+               __pmd_val_set(*pmd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID) 
+                       + (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
 }
 
 #define pmd_populate(mm, pmd, pte_page) \
        pmd_populate_kernel(mm, pmd, page_address(pte_page))
 
-/* NOTE: pte must be in ZONE_DMA (<4GB) so that the pmd pointer
- * can be housed in 32 bits */
 static inline struct page *
 pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-       struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT|GFP_DMA);
+       struct page *page = alloc_page(GFP_KERNEL|__GFP_REPEAT);
        if (likely(page != NULL))
                clear_page(page_address(page));
        return page;
@@ -127,7 +129,7 @@ pte_alloc_one(struct mm_struct *mm, unsigned long address)
 static inline pte_t *
 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
 {
-       pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|GFP_DMA);
+       pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
        if (likely(pte != NULL))
                clear_page(pte);
        return pte;
index 37da218..1593a8a 100644 (file)
 
 /* This is the size of the initially mapped kernel memory (i.e. currently
  * 0 to 1<<23 == 8MB */
+#ifdef CONFIG_64BIT
+#define KERNEL_INITIAL_ORDER   24
+#else
 #define KERNEL_INITIAL_ORDER   23
+#endif
 #define KERNEL_INITIAL_SIZE    (1 << KERNEL_INITIAL_ORDER)
 
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 #define PT_NLEVELS     3
 #define PGD_ORDER      1 /* Number of pages per pgd */
 #define PMD_ORDER      1 /* Number of pages per pmd */
@@ -177,6 +181,21 @@ extern  void *vmalloc_start;
 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
 #define _PAGE_KERNEL   (_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_WRITE | _PAGE_DIRTY | _PAGE_ACCESSED)
 
+/* The pgd/pmd contains a ptr (in phys addr space); since all pgds/pmds
+ * are page-aligned, we don't care about the PAGE_OFFSET bits, except
+ * for a few meta-information bits, so we shift the address to be
+ * able to effectively address 40-bits of physical address space. */
+#define _PxD_PRESENT_BIT   31
+#define _PxD_ATTACHED_BIT  30
+#define _PxD_VALID_BIT     29
+
+#define PxD_FLAG_PRESENT  (1 << xlate_pabit(_PxD_PRESENT_BIT))
+#define PxD_FLAG_ATTACHED (1 << xlate_pabit(_PxD_ATTACHED_BIT))
+#define PxD_FLAG_VALID    (1 << xlate_pabit(_PxD_VALID_BIT))
+#define PxD_FLAG_MASK     (0xf)
+#define PxD_FLAG_SHIFT    (4)
+#define PxD_VALUE_SHIFT   (8)
+
 #ifndef __ASSEMBLY__
 
 #define PAGE_NONE      __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
@@ -244,49 +263,49 @@ extern unsigned long *empty_zero_page;
 #define pte_present(x) (pte_val(x) & _PAGE_PRESENT)
 #define pte_clear(xp)  do { pte_val(*(xp)) = 0; } while (0)
 
-#ifdef __LP64__
+#define pmd_flag(x)    (pmd_val(x) & PxD_FLAG_MASK)
+#define pmd_address(x) ((unsigned long)(pmd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
+#define pgd_flag(x)    (pgd_val(x) & PxD_FLAG_MASK)
+#define pgd_address(x) ((unsigned long)(pgd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
+
+#ifdef CONFIG_64BIT
 /* The first entry of the permanent pmd is not there if it contains
  * the gateway marker */
-#define pmd_none(x)    (!pmd_val(x) || pmd_val(x) == _PAGE_GATEWAY)
-#define pmd_bad(x)     ((pmd_val(x) & ~PAGE_MASK) != _PAGE_TABLE && (pmd_val(x) & ~PAGE_MASK) != (_PAGE_TABLE | _PAGE_GATEWAY))
+#define pmd_none(x)    (!pmd_val(x) || pmd_flag(x) == PxD_FLAG_ATTACHED)
 #else
 #define pmd_none(x)    (!pmd_val(x))
-#define pmd_bad(x)     ((pmd_val(x) & ~PAGE_MASK) != _PAGE_TABLE)
 #endif
-#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
+#define pmd_bad(x)     (!(pmd_flag(x) & PxD_FLAG_VALID))
+#define pmd_present(x) (pmd_flag(x) & PxD_FLAG_PRESENT)
 static inline void pmd_clear(pmd_t *pmd) {
-#ifdef __LP64__
-       if(pmd_val(*pmd) & _PAGE_GATEWAY)
+#ifdef CONFIG_64BIT
+       if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
                /* This is the entry pointing to the permanent pmd
                 * attached to the pgd; cannot clear it */
-               pmd_val(*pmd) = _PAGE_GATEWAY;
+               __pmd_val_set(*pmd, PxD_FLAG_ATTACHED);
        else
 #endif
-               pmd_val(*pmd) = 0;
+               __pmd_val_set(*pmd,  0);
 }
 
 
 
 #if PT_NLEVELS == 3
-#define pgd_page(pgd) ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
+#define pgd_page(pgd) ((unsigned long) __va(pgd_address(pgd)))
 
 /* For 64 bit we have three level tables */
 
 #define pgd_none(x)     (!pgd_val(x))
-#ifdef __LP64__
-#define pgd_bad(x)      ((pgd_val(x) & ~PAGE_MASK) != _PAGE_TABLE && (pgd_val(x) & ~PAGE_MASK) != (_PAGE_TABLE | _PAGE_GATEWAY))
-#else
-#define pgd_bad(x)      ((pgd_val(x) & ~PAGE_MASK) != _PAGE_TABLE)
-#endif
-#define pgd_present(x)  (pgd_val(x) & _PAGE_PRESENT)
+#define pgd_bad(x)      (!(pgd_flag(x) & PxD_FLAG_VALID))
+#define pgd_present(x)  (pgd_flag(x) & PxD_FLAG_PRESENT)
 static inline void pgd_clear(pgd_t *pgd) {
-#ifdef __LP64__
-       if(pgd_val(*pgd) & _PAGE_GATEWAY)
+#ifdef CONFIG_64BIT
+       if(pgd_flag(*pgd) & PxD_FLAG_ATTACHED)
                /* This is the permanent pmd attached to the pgd; cannot
                 * free it */
                return;
 #endif
-       pgd_val(*pgd) = 0;
+       __pgd_val_set(*pgd, 0);
 }
 #else
 /*
@@ -353,15 +372,11 @@ extern inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 
 #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT)
 
-#ifdef CONFIG_DISCONTIGMEM
-#define pte_page(x) (phys_to_page(pte_val(x)))
-#else
-#define pte_page(x) (mem_map+(pte_val(x) >> PAGE_SHIFT))
-#endif
+#define pte_page(pte)          (pfn_to_page(pte_pfn(pte)))
 
-#define pmd_page_kernel(pmd)   ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
+#define pmd_page_kernel(pmd)   ((unsigned long) __va(pmd_address(pmd)))
 
-#define __pmd_page(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK))
+#define __pmd_page(pmd) ((unsigned long) __va(pmd_address(pmd)))
 #define pmd_page(pmd)  virt_to_page((void *)__pmd_page(pmd))
 
 #define pgd_index(address) ((address) >> PGDIR_SHIFT)
@@ -419,7 +434,7 @@ static inline int ptep_test_and_clear_young(pte_t *ptep)
 #ifdef CONFIG_SMP
        if (!pte_young(*ptep))
                return 0;
-       return test_and_clear_bit(xlate_pabit(_PAGE_ACCESSED_BIT), ptep);
+       return test_and_clear_bit(xlate_pabit(_PAGE_ACCESSED_BIT), &pte_val(*ptep));
 #else
        pte_t pte = *ptep;
        if (!pte_young(pte))
@@ -434,7 +449,7 @@ static inline int ptep_test_and_clear_dirty(pte_t *ptep)
 #ifdef CONFIG_SMP
        if (!pte_dirty(*ptep))
                return 0;
-       return test_and_clear_bit(xlate_pabit(_PAGE_DIRTY_BIT), ptep);
+       return test_and_clear_bit(xlate_pabit(_PAGE_DIRTY_BIT), &pte_val(*ptep));
 #else
        pte_t pte = *ptep;
        if (!pte_dirty(pte))
@@ -444,11 +459,7 @@ static inline int ptep_test_and_clear_dirty(pte_t *ptep)
 #endif
 }
 
-#ifdef CONFIG_SMP
 extern spinlock_t pa_dbit_lock;
-#else
-static int pa_dbit_lock; /* dummy to keep the compilers happy */
-#endif
 
 static inline pte_t ptep_get_and_clear(pte_t *ptep)
 {
@@ -483,7 +494,7 @@ static inline void ptep_set_wrprotect(pte_t *ptep)
 static inline void ptep_mkdirty(pte_t *ptep)
 {
 #ifdef CONFIG_SMP
-       set_bit(xlate_pabit(_PAGE_DIRTY_BIT), ptep);
+       set_bit(xlate_pabit(_PAGE_DIRTY_BIT), &pte_val(*ptep));
 #else
        pte_t old_pte = *ptep;
        set_pte(ptep, pte_mkdirty(old_pte));
index 57233a1..a60e62e 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index 1efee58..fde77ac 100644 (file)
@@ -52,11 +52,18 @@ extern void smp_send_reschedule(int cpu);
 extern unsigned long cpu_present_mask;
 
 #define smp_processor_id()     (current_thread_info()->cpu)
-#define cpu_online(cpu)                cpu_isset(cpu, cpu_online_map)
 
 #endif /* CONFIG_SMP */
 
 #define NO_PROC_ID             0xFF            /* No processor magic marker */
 #define ANY_PROC_ID            0xFF            /* Any processor magic marker */
+static inline int __cpu_disable (void) {
+  return 0;
+}
+static inline void __cpu_die (unsigned int cpu) {
+  while(1)
+    ;
+}
+extern int __cpu_up (unsigned int cpu);
 
 #endif /*  __ASM_SMP_H */
index 1ad3aaa..7a2c25d 100644 (file)
@@ -8,8 +8,11 @@
  * the semaphore address has to be 16-byte aligned.
  */
 
+#ifndef CONFIG_DEBUG_SPINLOCK
+
+#define __SPIN_LOCK_UNLOCKED   { { 1, 1, 1, 1 } }
 #undef SPIN_LOCK_UNLOCKED
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { { 1, 1, 1, 1 } }
+#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED
 
 #define spin_lock_init(x)      do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
 
@@ -41,6 +44,83 @@ static inline int _raw_spin_trylock(spinlock_t *x)
        return __ldcw(a) != 0;
 }
        
+#define spin_lock_own(LOCK, LOCATION)  ((void)0)
+
+#else /* !(CONFIG_DEBUG_SPINLOCK) */
+
+#define SPINLOCK_MAGIC 0x1D244B3C
+
+#define __SPIN_LOCK_UNLOCKED   { { 1, 1, 1, 1 }, SPINLOCK_MAGIC, 10, __FILE__ , NULL, 0, -1, NULL, NULL }
+#undef SPIN_LOCK_UNLOCKED
+#define SPIN_LOCK_UNLOCKED (spinlock_t) __SPIN_LOCK_UNLOCKED
+
+#define spin_lock_init(x)      do { *(x) = SPIN_LOCK_UNLOCKED; } while(0)
+
+#define CHECK_LOCK(x)                                                  \
+       do {                                                            \
+               if (unlikely((x)->magic != SPINLOCK_MAGIC)) {                   \
+                       printk(KERN_ERR "%s:%d: spin_is_locked"         \
+                       " on uninitialized spinlock %p.\n",             \
+                               __FILE__, __LINE__, (x));               \
+               }                                                       \
+       } while(0)
+
+#define spin_is_locked(x)                                              \
+       ({                                                              \
+               CHECK_LOCK(x);                                          \
+               volatile unsigned int *a = __ldcw_align(x);             \
+               if (unlikely((*a == 0) && (x)->babble)) {                               \
+                       (x)->babble--;                                  \
+                       printk("KERN_WARNING                            \
+                               %s:%d: spin_is_locked(%s/%p) already"   \
+                               " locked by %s:%d in %s at %p(%d)\n",   \
+                               __FILE__,__LINE__, (x)->module, (x),    \
+                               (x)->bfile, (x)->bline, (x)->task->comm,\
+                               (x)->previous, (x)->oncpu);             \
+               }                                                       \
+               *a == 0;                                                \
+       })
+
+#define spin_unlock_wait(x)                                            \
+       do {                                                            \
+               CHECK_LOCK(x);                                          \
+               volatile unsigned int *a = __ldcw_align(x);             \
+               if (unlikely((*a == 0) && (x)->babble)) {                               \
+                       (x)->babble--;                                  \
+                       printk("KERN_WARNING                            \
+                               %s:%d: spin_unlock_wait(%s/%p)"         \
+                               " owned by %s:%d in %s at %p(%d)\n",    \
+                               __FILE__,__LINE__, (x)->module, (x),    \
+                               (x)->bfile, (x)->bline, (x)->task->comm,\
+                               (x)->previous, (x)->oncpu);             \
+               }                                                       \
+               barrier();                                              \
+       } while (*((volatile unsigned char *)(__ldcw_align(x))) == 0)
+
+extern void _dbg_spin_lock(spinlock_t *lock, const char *base_file, int line_no);
+extern void _dbg_spin_unlock(spinlock_t *lock, const char *, int);
+extern int _dbg_spin_trylock(spinlock_t * lock, const char *, int);
+
+#define _raw_spin_lock_flags(lock, flags) _raw_spin_lock(lock)
+
+#define _raw_spin_unlock(lock) _dbg_spin_unlock(lock, __FILE__, __LINE__)
+#define _raw_spin_lock(lock) _dbg_spin_lock(lock, __FILE__, __LINE__)
+#define _raw_spin_trylock(lock) _dbg_spin_trylock(lock, __FILE__, __LINE__)
+
+/* just in case we need it */
+#define spin_lock_own(LOCK, LOCATION)                                  \
+do {                                                                   \
+       volatile unsigned int *a = __ldcw_align(LOCK);                  \
+       if (!((*a == 0) && ((LOCK)->oncpu == smp_processor_id())))      \
+               printk("KERN_WARNING                                    \
+                       %s: called on %d from %p but lock %s on %d\n",  \
+                       LOCATION, smp_processor_id(),                   \
+                       __builtin_return_address(0),                    \
+                       (*a == 0) ? "taken" : "freed", (LOCK)->on_cpu); \
+} while (0)
+
+#endif /* !(CONFIG_DEBUG_SPINLOCK) */
+
 /*
  * Read-write spinlocks, allowing multiple readers
  * but only one writer.
@@ -50,7 +130,7 @@ typedef struct {
        volatile int counter;
 } rwlock_t;
 
-#define RW_LOCK_UNLOCKED (rwlock_t) { { { 1, 1, 1, 1 } }, 0 }
+#define RW_LOCK_UNLOCKED (rwlock_t) { __SPIN_LOCK_UNLOCKED, 0 }
 
 #define rwlock_init(lp)        do { *(lp) = RW_LOCK_UNLOCKED; } while (0)
 
@@ -59,6 +139,10 @@ typedef struct {
 /* read_lock, read_unlock are pretty straightforward.  Of course it somehow
  * sucks we end up saving/restoring flags twice for read_lock_irqsave aso. */
 
+#ifdef CONFIG_DEBUG_RWLOCK
+extern void _dbg_read_lock(rwlock_t * rw, const char *bfile, int bline);
+#define _raw_read_lock(rw) _dbg_read_lock(rw, __FILE__, __LINE__)
+#else
 static  __inline__ void _raw_read_lock(rwlock_t *rw)
 {
        unsigned long flags;
@@ -70,6 +154,7 @@ static  __inline__ void _raw_read_lock(rwlock_t *rw)
        _raw_spin_unlock(&rw->lock);
        local_irq_restore(flags);
 }
+#endif /* CONFIG_DEBUG_RWLOCK */
 
 static  __inline__ void _raw_read_unlock(rwlock_t *rw)
 {
@@ -92,6 +177,10 @@ static  __inline__ void _raw_read_unlock(rwlock_t *rw)
  * writers) in interrupt handlers someone fucked up and we'd dead-lock
  * sooner or later anyway.   prumpf */
 
+#ifdef CONFIG_DEBUG_RWLOCK
+extern void _dbg_write_lock(rwlock_t * rw, const char *bfile, int bline);
+#define _raw_write_lock(rw) _dbg_write_lock(rw, __FILE__, __LINE__)
+#else
 static  __inline__ void _raw_write_lock(rwlock_t *rw)
 {
 retry:
@@ -109,6 +198,7 @@ retry:
        /* got it.  now leave without unlocking */
        rw->counter = -1; /* remember we are locked */
 }
+#endif /* CONFIG_DEBUG_RWLOCK */
 
 /* write_unlock is absolutely trivial - we don't have to wait for anything */
 
index d73c20d..e2b8428 100644 (file)
@@ -166,6 +166,16 @@ static inline void set_eiem(unsigned long val)
 
 typedef struct {
        volatile unsigned int lock[4];
+#ifdef CONFIG_DEBUG_SPINLOCK
+       unsigned long magic;
+       volatile unsigned int babble;
+       const char *module;
+       char *bfile;
+       int bline;
+       int oncpu;
+       void *previous;
+       struct task_struct * task;
+#endif
 } spinlock_t;
 
 #define __lock_aligned __attribute__((__section__(".data.lock_aligned")))
index 1c827ff..2a3434d 100644 (file)
@@ -960,9 +960,9 @@ static inline int close(int fd)
        return sys_close(fd);
 }
 
-static inline int _exit(int exitcode)
+static inline void _exit(int exitcode)
 {
-       return sys_exit(exitcode);
+       sys_exit(exitcode);
 }
 
 static inline pid_t waitpid(pid_t pid, int *wait_stat, int options)
index 58c1b49..5a58b9e 100644 (file)
 #define CPM_DATAONLY_SIZE      ((uint)0x0700)
 #define CPM_DP_NOSPACE         ((uint)0x7fffffff)
 
+static inline long IS_DPERR(const uint offset)
+{
+       return (uint)offset > (uint)-1000L;
+}
+
 /* Export the base address of the communication processor registers
  * and dual port ram.
  */
 extern cpm8xx_t        *cpmp;          /* Pointer to comm processor */
-extern void *m8xx_cpm_dpalloc(int size);
-extern int m8xx_cpm_dpfree(void *addr);
-extern void *m8xx_cpm_dpalloc_fixed(void *addr, int size);
-extern void m8xx_cpm_dpdump(void);
-extern int m8xx_cpm_dpram_offset(void *addr);
-extern void *m8xx_cpm_dpram_addr(int offset);
+extern uint cpm_dpalloc(uint size, uint align);
+extern int cpm_dpfree(uint offset);
+extern uint cpm_dpalloc_fixed(uint offset, uint size, uint align);
+extern void cpm_dpdump(void);
+extern void *cpm_dpram_addr(uint offset);
+extern void cpm_setbrg(uint brg, uint rate);
+
 uint           m8xx_cpm_hostalloc(uint size);
-void           m8xx_cpm_setbrg(uint brg, uint rate);
 
 /* Buffer descriptors used by many of the CPM protocols.
 */
index 5e28e41..093022f 100644 (file)
@@ -21,6 +21,7 @@
 #define O_LARGEFILE     0200000
 #define O_DIRECT       0400000 /* direct disk access hint */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP 01000000 /* tux hack */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
diff --git a/include/asm-ppc/gt64260.h b/include/asm-ppc/gt64260.h
new file mode 100644 (file)
index 0000000..cd0ef64
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * include/asm-ppc/gt64260.h
+ *
+ * Prototypes, etc. for the Marvell/Galileo GT64260 host bridge routines.
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#ifndef __ASMPPC_GT64260_H
+#define __ASMPPC_GT64260_H
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+
+#include <asm/byteorder.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/uaccess.h>
+#include <asm/machdep.h>
+#include <asm/pci-bridge.h>
+#include <asm/gt64260_defs.h>
+
+
+extern u32     gt64260_base;
+extern u32     gt64260_irq_base;     /* We handle the next 96 IRQs from here */
+extern u32     gt64260_revision;
+extern u8      gt64260_pci_exclude_bridge;
+
+#ifndef        TRUE
+#define        TRUE    1
+#endif
+
+#ifndef        FALSE
+#define        FALSE   0
+#endif
+
+/* IRQs defined by the 64260 */
+#define        GT64260_IRQ_MPSC0               40
+#define        GT64260_IRQ_MPSC1               42
+#define        GT64260_IRQ_SDMA                36
+
+/*
+ * Define a default physical memory map to be set up on the bridge.
+ * Also define a struct to pass that info from board-specific routines to
+ * GT64260 generic set up routines.  By passing this info in, the board
+ * support developer can modify it at will.
+ */
+
+/*
+ * This is the default memory map:
+ *                     CPU                     PCI
+ *                     ---                     ---
+ * PCI 0 I/O:  0xfa000000-0xfaffffff   0x00000000-0x00ffffff
+ * PCI 1 I/O:  0xfb000000-0xfbffffff   0x01000000-0x01ffffff
+ * PCI 0 MEM:  0x80000000-0x8fffffff   0x80000000-0x8fffffff
+ * PCI 1 MEM:  0x90000000-0x9fffffff   0x90000000-0x9fffffff
+ */
+
+/* Default physical memory map for the GT64260 bridge */
+
+/*
+ * PCI Bus 0 Definitions
+ */
+#define GT64260_PCI_0_IO_SIZE          0x01000000U
+#define        GT64260_PCI_0_MEM_SIZE          0x10000000U
+
+/* Processor Physical addresses */
+#define        GT64260_PCI_0_IO_START_PROC     0xfa000000U
+#define        GT64260_PCI_0_IO_END_PROC       (GT64260_PCI_0_IO_START_PROC + \
+                                        GT64260_PCI_0_IO_SIZE - 1)
+
+/* PCI 0 addresses */
+#define        GT64260_PCI_0_IO_START          0x00000000U
+#define        GT64260_PCI_0_IO_END            (GT64260_PCI_0_IO_START + \
+                                        GT64260_PCI_0_IO_SIZE - 1)
+
+/* Processor Physical addresses */
+#define        GT64260_PCI_0_MEM_START_PROC    0x80000000U
+#define        GT64260_PCI_0_MEM_END_PROC      (GT64260_PCI_0_MEM_START_PROC + \
+                                        GT64260_PCI_0_MEM_SIZE - 1)
+
+/* PCI 0 addresses */
+#define        GT64260_PCI_0_MEM_START         0x80000000U
+#define        GT64260_PCI_0_MEM_END           (GT64260_PCI_0_MEM_START + \
+                                        GT64260_PCI_0_MEM_SIZE - 1)
+
+/*
+ * PCI Bus 1 Definitions
+ */
+#define GT64260_PCI_1_IO_SIZE          0x01000000U
+#define        GT64260_PCI_1_MEM_SIZE          0x10000000U
+
+/* PCI 1 addresses */
+#define        GT64260_PCI_1_IO_START          0x01000000U
+#define        GT64260_PCI_1_IO_END            (GT64260_PCI_1_IO_START + \
+                                        GT64260_PCI_1_IO_SIZE - 1)
+
+/* Processor Physical addresses */
+#define        GT64260_PCI_1_IO_START_PROC     0xfb000000U
+#define        GT64260_PCI_1_IO_END_PROC       (GT64260_PCI_1_IO_START_PROC + \
+                                        GT64260_PCI_1_IO_SIZE - 1)
+
+/* PCI 1 addresses */
+#define        GT64260_PCI_1_MEM_START         0x90000000U
+#define        GT64260_PCI_1_MEM_END           (GT64260_PCI_1_MEM_START + \
+                                        GT64260_PCI_1_MEM_SIZE - 1)
+
+/* Processor Physical addresses */
+#define        GT64260_PCI_1_MEM_START_PROC    0x90000000U
+#define        GT64260_PCI_1_MEM_END_PROC      (GT64260_PCI_1_MEM_START_PROC + \
+                                        GT64260_PCI_1_MEM_SIZE - 1)
+
+/* Define struct to pass mem-map info into gt64260_common.c code */
+typedef struct {
+       struct pci_controller   *hose_a;
+       struct pci_controller   *hose_b;
+
+       u32     mem_size;
+
+       u32     pci_0_io_start_proc;
+       u32     pci_0_io_start_pci;
+       u32     pci_0_io_size;
+       u32     pci_0_io_swap;
+
+       u32     pci_0_mem_start_proc;
+       u32     pci_0_mem_start_pci_hi;
+       u32     pci_0_mem_start_pci_lo;
+       u32     pci_0_mem_size;
+       u32     pci_0_mem_swap;
+
+       u32     pci_1_io_start_proc;
+       u32     pci_1_io_start_pci;
+       u32     pci_1_io_size;
+       u32     pci_1_io_swap;
+
+       u32     pci_1_mem_start_proc;
+       u32     pci_1_mem_start_pci_hi;
+       u32     pci_1_mem_start_pci_lo;
+       u32     pci_1_mem_size;
+       u32     pci_1_mem_swap;
+} gt64260_bridge_info_t;
+
+#define        GT64260_BRIDGE_INFO_DEFAULT(ip, ms) {                           \
+       (ip)->mem_size = (ms);                                          \
+                                                                       \
+       (ip)->pci_0_io_start_proc = GT64260_PCI_0_IO_START_PROC;        \
+       (ip)->pci_0_io_start_pci  = GT64260_PCI_0_IO_START;             \
+       (ip)->pci_0_io_size       = GT64260_PCI_0_IO_SIZE;              \
+       (ip)->pci_0_io_swap       = GT64260_CPU_PCI_SWAP_NONE;          \
+                                                                       \
+       (ip)->pci_0_mem_start_proc   = GT64260_PCI_0_MEM_START_PROC;    \
+       (ip)->pci_0_mem_start_pci_hi = 0x00000000;                      \
+       (ip)->pci_0_mem_start_pci_lo = GT64260_PCI_0_MEM_START;         \
+       (ip)->pci_0_mem_size         = GT64260_PCI_0_MEM_SIZE;          \
+       (ip)->pci_0_mem_swap         = GT64260_CPU_PCI_SWAP_NONE;       \
+                                                                       \
+       (ip)->pci_1_io_start_proc = GT64260_PCI_1_IO_START_PROC;        \
+       (ip)->pci_1_io_start_pci  = GT64260_PCI_1_IO_START;             \
+       (ip)->pci_1_io_size       = GT64260_PCI_1_IO_SIZE;              \
+       (ip)->pci_1_io_swap       = GT64260_CPU_PCI_SWAP_NONE;          \
+                                                                       \
+       (ip)->pci_1_mem_start_proc   = GT64260_PCI_1_MEM_START_PROC;    \
+       (ip)->pci_1_mem_start_pci_hi = 0x00000000;                      \
+       (ip)->pci_1_mem_start_pci_lo = GT64260_PCI_1_MEM_START;         \
+       (ip)->pci_1_mem_size         = GT64260_PCI_1_MEM_SIZE;          \
+       (ip)->pci_1_mem_swap         = GT64260_CPU_PCI_SWAP_NONE;       \
+}
+
+/*
+ *****************************************************************************
+ *
+ *     I/O macros to access the 64260's registers
+ *
+ *****************************************************************************
+ */
+
+extern inline uint32_t gt_read(uint32_t offs){
+       return (in_le32((volatile uint *)(gt64260_base + offs)));
+}
+extern inline void gt_write(uint32_t offs, uint32_t d){
+       out_le32((volatile uint *)(gt64260_base + offs), d);
+}
+
+#if 0 /* paranoid SMP version */
+extern inline void gt_modify(u32 offs, u32 data, u32 mask) \
+{
+       uint32_t reg;
+       spin_lock(&gt64260_lock);
+       reg = gt_read(offs) & (~mask); /* zero any bits we care about*/
+       reg |= data & mask; /* set bits from the data */
+       gt_write(offs, reg);
+       spin_unlock(&gt64260_lock);
+}
+#else
+extern inline void gt_modify(uint32_t offs, uint32_t data, uint32_t mask)
+{
+       uint32_t reg;
+       reg = gt_read(offs) & (~(mask)); /* zero any bits we care about*/
+       reg |= (data) & (mask); /* set bits from the data */
+       gt_write(offs, reg);
+}
+#endif
+#define        gt_set_bits(offs, bits) gt_modify(offs, ~0, bits)
+
+#define        gt_clr_bits(offs, bits) gt_modify(offs, 0, bits)
+
+
+/*
+ *****************************************************************************
+ *
+ *     Function Prototypes
+ *
+ *****************************************************************************
+ */
+
+int gt64260_find_bridges(u32 phys_base_addr, gt64260_bridge_info_t *info,
+       int ((*map_irq)(struct pci_dev *, unsigned char, unsigned char)));
+int gt64260_bridge_init(gt64260_bridge_info_t *info);
+int gt64260_cpu_scs_set_window(u32 window,
+                              u32 base_addr,
+                              u32 size);
+int gt64260_cpu_cs_set_window(u32 window,
+                             u32 base_addr,
+                             u32 size);
+int gt64260_cpu_boot_set_window(u32 base_addr,
+                               u32 size);
+int gt64260_cpu_set_pci_io_window(u32 pci_bus,
+                                 u32 cpu_base_addr,
+                                 u32 pci_base_addr,
+                                 u32 size,
+                                 u32 swap);
+int gt64260_cpu_set_pci_mem_window(u32 pci_bus,
+                                  u32 window,
+                                  u32 cpu_base_addr,
+                                  u32 pci_base_addr_hi,
+                                  u32 pci_base_addr_lo,
+                                  u32 size,
+                                  u32 swap_64bit);
+int gt64260_cpu_prot_set_window(u32 window,
+                               u32 base_addr,
+                               u32 size,
+                               u32 access_bits);
+int gt64260_cpu_snoop_set_window(u32 window,
+                                u32 base_addr,
+                                u32 size,
+                                u32  snoop_type);
+void gt64260_cpu_disable_all_windows(void);
+int gt64260_pci_bar_enable(u32 pci_bus, u32 enable_bits);
+int gt64260_pci_slave_scs_set_window(struct pci_controller *hose,
+                                    u32 window,
+                                    u32 pci_base_addr,
+                                    u32 cpu_base_addr,
+                                    u32 size);
+int gt64260_pci_slave_cs_set_window(struct pci_controller *hose,
+                                   u32 window,
+                                   u32 pci_base_addr,
+                                   u32 cpu_base_addr,
+                                   u32 size);
+int gt64260_pci_slave_boot_set_window(struct pci_controller *hose,
+                                     u32 pci_base_addr,
+                                     u32 cpu_base_addr,
+                                     u32 size);
+int gt64260_pci_slave_p2p_mem_set_window(struct pci_controller *hose,
+                                        u32 window,
+                                        u32 pci_base_addr,
+                                        u32 other_bus_base_addr,
+                                        u32 size);
+int gt64260_pci_slave_p2p_io_set_window(struct pci_controller *hose,
+                                       u32 pci_base_addr,
+                                       u32 other_bus_base_addr,
+                                       u32 size);
+int gt64260_pci_slave_dac_scs_set_window(struct pci_controller *hose,
+                                        u32 window,
+                                        u32 pci_base_addr_hi,
+                                        u32 pci_base_addr_lo,
+                                        u32 cpu_base_addr,
+                                        u32 size);
+int gt64260_pci_slave_dac_cs_set_window(struct pci_controller *hose,
+                                       u32 window,
+                                       u32 pci_base_addr_hi,
+                                       u32 pci_base_addr_lo,
+                                       u32 cpu_base_addr,
+                                       u32 size);
+int gt64260_pci_slave_dac_boot_set_window(struct pci_controller *hose,
+                                         u32 pci_base_addr_hi,
+                                         u32 pci_base_addr_lo,
+                                         u32 cpu_base_addr,
+                                         u32 size);
+int gt64260_pci_slave_dac_p2p_mem_set_window(struct pci_controller *hose,
+                                            u32 window,
+                                            u32 pci_base_addr_hi,
+                                            u32 pci_base_addr_lo,
+                                            u32 other_bus_base_addr,
+                                            u32 size);
+int gt64260_pci_acc_cntl_set_window(u32 pci_bus,
+                                   u32 window,
+                                   u32 base_addr_hi,
+                                   u32 base_addr_lo,
+                                   u32 size,
+                                   u32 features);
+int gt64260_pci_snoop_set_window(u32 pci_bus,
+                                u32 window,
+                                u32 base_addr_hi,
+                                u32 base_addr_lo,
+                                u32 size,
+                                u32 snoop_type);
+int gt64260_set_base(u32 new_base);
+int gt64260_get_base(u32 *base);
+int gt64260_pci_exclude_device(u8 bus, u8 devfn);
+
+void gt64260_init_irq(void);
+int gt64260_get_irq(struct pt_regs *regs);
+
+void gt64260_mpsc_progress(char *s, unsigned short hex);
+
+#endif /* __ASMPPC_GT64260_H */
diff --git a/include/asm-ppc/gt64260_defs.h b/include/asm-ppc/gt64260_defs.h
new file mode 100644 (file)
index 0000000..6ffd01a
--- /dev/null
@@ -0,0 +1,1010 @@
+/*
+ * include/asm-ppc/gt64260_defs.h
+ *
+ * Register definitions for the Marvell/Galileo GT64260 host bridge.
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2001 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#ifndef __ASMPPC_GT64260_DEFS_H
+#define __ASMPPC_GT64260_DEFS_H
+
+/*
+ * Define a macro to represent the supported version of the 64260.
+ */
+#define        GT64260                 0x01
+#define        GT64260A                0x10
+
+/*
+ *****************************************************************************
+ *
+ *     CPU Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* CPU physical address of 64260's registers */
+#define GT64260_INTERNAL_SPACE_DECODE                  0x0068
+#define GT64260_INTERNAL_SPACE_SIZE                    0x10000
+#define GT64260_INTERNAL_SPACE_DEFAULT_ADDR            0x14000000
+
+/* CPU Memory Controller Window Registers (4 windows) */
+#define        GT64260_CPU_SCS_DECODE_WINDOWS                  4
+
+#define        GT64260_CPU_SCS_DECODE_0_BOT                    0x0008
+#define        GT64260_CPU_SCS_DECODE_0_TOP                    0x0010
+#define        GT64260_CPU_SCS_DECODE_1_BOT                    0x0208
+#define        GT64260_CPU_SCS_DECODE_1_TOP                    0x0210
+#define        GT64260_CPU_SCS_DECODE_2_BOT                    0x0018
+#define        GT64260_CPU_SCS_DECODE_2_TOP                    0x0020
+#define        GT64260_CPU_SCS_DECODE_3_BOT                    0x0218
+#define        GT64260_CPU_SCS_DECODE_3_TOP                    0x0220
+
+/* CPU Device Controller Window Registers (4 windows) */
+#define        GT64260_CPU_CS_DECODE_WINDOWS                   4
+
+#define        GT64260_CPU_CS_DECODE_0_BOT                     0x0028
+#define        GT64260_CPU_CS_DECODE_0_TOP                     0x0030
+#define        GT64260_CPU_CS_DECODE_1_BOT                     0x0228
+#define        GT64260_CPU_CS_DECODE_1_TOP                     0x0230
+#define        GT64260_CPU_CS_DECODE_2_BOT                     0x0248
+#define        GT64260_CPU_CS_DECODE_2_TOP                     0x0250
+#define        GT64260_CPU_CS_DECODE_3_BOT                     0x0038
+#define        GT64260_CPU_CS_DECODE_3_TOP                     0x0040
+
+#define        GT64260_CPU_BOOT_CS_DECODE_0_BOT                0x0238
+#define        GT64260_CPU_BOOT_CS_DECODE_0_TOP                0x0240
+
+/* CPU Windows to PCI space (2 PCI buses each w/ 1 I/O & 4 MEM windows) */
+#define        GT64260_PCI_BUSES                               2
+#define        GT64260_PCI_IO_WINDOWS_PER_BUS                  1
+#define        GT64260_PCI_MEM_WINDOWS_PER_BUS                 4
+
+#define        GT64260_CPU_PCI_SWAP_BYTE                       0x00000000
+#define        GT64260_CPU_PCI_SWAP_NONE                       0x01000000
+#define        GT64260_CPU_PCI_SWAP_BYTE_WORD                  0x02000000
+#define        GT64260_CPU_PCI_SWAP_WORD                       0x03000000
+#define        GT64260_CPU_PCI_SWAP_MASK                       0x07000000
+
+#define        GT64260_CPU_PCI_MEM_REQ64                       (1<<27)
+
+#define        GT64260_CPU_PCI_0_IO_DECODE_BOT                 0x0048
+#define        GT64260_CPU_PCI_0_IO_DECODE_TOP                 0x0050
+#define        GT64260_CPU_PCI_0_MEM_0_DECODE_BOT              0x0058
+#define        GT64260_CPU_PCI_0_MEM_0_DECODE_TOP              0x0060
+#define        GT64260_CPU_PCI_0_MEM_1_DECODE_BOT              0x0080
+#define        GT64260_CPU_PCI_0_MEM_1_DECODE_TOP              0x0088
+#define        GT64260_CPU_PCI_0_MEM_2_DECODE_BOT              0x0258
+#define        GT64260_CPU_PCI_0_MEM_2_DECODE_TOP              0x0260
+#define        GT64260_CPU_PCI_0_MEM_3_DECODE_BOT              0x0280
+#define        GT64260_CPU_PCI_0_MEM_3_DECODE_TOP              0x0288
+
+#define        GT64260_CPU_PCI_0_IO_REMAP                      0x00f0
+#define        GT64260_CPU_PCI_0_MEM_0_REMAP_LO                0x00f8
+#define        GT64260_CPU_PCI_0_MEM_0_REMAP_HI                0x0320
+#define        GT64260_CPU_PCI_0_MEM_1_REMAP_LO                0x0100
+#define        GT64260_CPU_PCI_0_MEM_1_REMAP_HI                0x0328
+#define        GT64260_CPU_PCI_0_MEM_2_REMAP_LO                0x02f8
+#define        GT64260_CPU_PCI_0_MEM_2_REMAP_HI                0x0330
+#define        GT64260_CPU_PCI_0_MEM_3_REMAP_LO                0x0300
+#define        GT64260_CPU_PCI_0_MEM_3_REMAP_HI                0x0338
+
+#define        GT64260_CPU_PCI_1_IO_DECODE_BOT                 0x0090
+#define        GT64260_CPU_PCI_1_IO_DECODE_TOP                 0x0098
+#define        GT64260_CPU_PCI_1_MEM_0_DECODE_BOT              0x00a0
+#define        GT64260_CPU_PCI_1_MEM_0_DECODE_TOP              0x00a8
+#define        GT64260_CPU_PCI_1_MEM_1_DECODE_BOT              0x00b0
+#define        GT64260_CPU_PCI_1_MEM_1_DECODE_TOP              0x00b8
+#define        GT64260_CPU_PCI_1_MEM_2_DECODE_BOT              0x02a0
+#define        GT64260_CPU_PCI_1_MEM_2_DECODE_TOP              0x02a8
+#define        GT64260_CPU_PCI_1_MEM_3_DECODE_BOT              0x02b0
+#define        GT64260_CPU_PCI_1_MEM_3_DECODE_TOP              0x02b8
+
+#define        GT64260_CPU_PCI_1_IO_REMAP                      0x0108
+#define        GT64260_CPU_PCI_1_MEM_0_REMAP_LO                0x0110
+#define        GT64260_CPU_PCI_1_MEM_0_REMAP_HI                0x0340
+#define        GT64260_CPU_PCI_1_MEM_1_REMAP_LO                0x0118
+#define        GT64260_CPU_PCI_1_MEM_1_REMAP_HI                0x0348
+#define        GT64260_CPU_PCI_1_MEM_2_REMAP_LO                0x0310
+#define        GT64260_CPU_PCI_1_MEM_2_REMAP_HI                0x0350
+#define        GT64260_CPU_PCI_1_MEM_3_REMAP_LO                0x0318
+#define        GT64260_CPU_PCI_1_MEM_3_REMAP_HI                0x0358
+
+/* CPU Control Registers */
+#define GT64260_CPU_CONFIG                             0x0000
+#define GT64260_CPU_MODE                               0x0120
+#define GT64260_CPU_MASTER_CNTL                                0x0160
+#define GT64260_CPU_XBAR_CNTL_LO                       0x0150
+#define GT64260_CPU_XBAR_CNTL_HI                       0x0158
+#define GT64260_CPU_XBAR_TO                            0x0168
+#define GT64260_CPU_RR_XBAR_CNTL_LO                    0x0170
+#define GT64260_CPU_RR_XBAR_CNTL_HI                    0x0178
+
+/* CPU Sync Barrier Registers */
+#define GT64260_CPU_SYNC_BARRIER_PCI_0                 0x00c0
+#define GT64260_CPU_SYNC_BARRIER_PCI_1                 0x00c8
+
+/* CPU Access Protection Registers */
+#define        GT64260_CPU_PROT_WINDOWS                        8
+
+#define        GT64260_CPU_PROT_ACCPROTECT                     (1<<16)
+#define        GT64260_CPU_PROT_WRPROTECT                      (1<<17)
+#define        GT64260_CPU_PROT_CACHEPROTECT                   (1<<18)
+
+#define GT64260_CPU_PROT_BASE_0                                0x0180
+#define GT64260_CPU_PROT_TOP_0                         0x0188
+#define GT64260_CPU_PROT_BASE_1                                0x0190
+#define GT64260_CPU_PROT_TOP_1                         0x0198
+#define GT64260_CPU_PROT_BASE_2                                0x01a0
+#define GT64260_CPU_PROT_TOP_2                         0x01a8
+#define GT64260_CPU_PROT_BASE_3                                0x01b0
+#define GT64260_CPU_PROT_TOP_3                         0x01b8
+#define GT64260_CPU_PROT_BASE_4                                0x01c0
+#define GT64260_CPU_PROT_TOP_4                         0x01c8
+#define GT64260_CPU_PROT_BASE_5                                0x01d0
+#define GT64260_CPU_PROT_TOP_5                         0x01d8
+#define GT64260_CPU_PROT_BASE_6                                0x01e0
+#define GT64260_CPU_PROT_TOP_6                         0x01e8
+#define GT64260_CPU_PROT_BASE_7                                0x01f0
+#define GT64260_CPU_PROT_TOP_7                         0x01f8
+
+/* CPU Snoop Control Registers */
+#define        GT64260_CPU_SNOOP_WINDOWS                       4
+
+#define        GT64260_CPU_SNOOP_NONE                          0x00000000
+#define        GT64260_CPU_SNOOP_WT                            0x00010000
+#define        GT64260_CPU_SNOOP_WB                            0x00020000
+#define        GT64260_CPU_SNOOP_MASK                          0x00030000
+#define        GT64260_CPU_SNOOP_ALL_BITS                      GT64260_CPU_SNOOP_MASK
+
+#define GT64260_CPU_SNOOP_BASE_0                       0x0380
+#define GT64260_CPU_SNOOP_TOP_0                                0x0388
+#define GT64260_CPU_SNOOP_BASE_1                       0x0390
+#define GT64260_CPU_SNOOP_TOP_1                                0x0398
+#define GT64260_CPU_SNOOP_BASE_2                       0x03a0
+#define GT64260_CPU_SNOOP_TOP_2                                0x03a8
+#define GT64260_CPU_SNOOP_BASE_3                       0x03b0
+#define GT64260_CPU_SNOOP_TOP_3                                0x03b8
+
+/* CPU Error Report Registers */
+#define GT64260_CPU_ERR_ADDR_LO                                0x0070
+#define GT64260_CPU_ERR_ADDR_HI                                0x0078
+#define GT64260_CPU_ERR_DATA_LO                                0x0128
+#define GT64260_CPU_ERR_DATA_HI                                0x0130
+#define GT64260_CPU_ERR_PARITY                         0x0138
+#define GT64260_CPU_ERR_CAUSE                          0x0140
+#define GT64260_CPU_ERR_MASK                           0x0148
+
+
+/*
+ *****************************************************************************
+ *
+ *     SDRAM Cotnroller Registers
+ *
+ *****************************************************************************
+ */
+
+/* SDRAM Config Registers */
+#define        GT64260_SDRAM_CONFIG                            0x0448
+#define        GT64260_SDRAM_OPERATION_MODE                    0x0474
+#define        GT64260_SDRAM_ADDR_CNTL                         0x047c
+#define        GT64260_SDRAM_TIMING_PARAMS                     0x04b4
+#define        GT64260_SDRAM_UMA_CNTL                          0x04a4
+#define        GT64260_SDRAM_XBAR_CNTL_LO                      0x04a8
+#define        GT64260_SDRAM_XBAR_CNTL_HI                      0x04ac
+#define        GT64260_SDRAM_XBAR_CNTL_TO                      0x04b0
+
+/* SDRAM Banks Parameters Registers */
+#define        GT64260_SDRAM_BANK_PARAMS_0                     0x044c
+#define        GT64260_SDRAM_BANK_PARAMS_1                     0x0450
+#define        GT64260_SDRAM_BANK_PARAMS_2                     0x0454
+#define        GT64260_SDRAM_BANK_PARAMS_3                     0x0458
+
+/* SDRAM Error Report Registers */
+#define        GT64260_SDRAM_ERR_DATA_LO                       0x0484
+#define        GT64260_SDRAM_ERR_DATA_HI                       0x0480
+#define        GT64260_SDRAM_ERR_ADDR                          0x0490
+#define        GT64260_SDRAM_ERR_ECC_RCVD                      0x0488
+#define        GT64260_SDRAM_ERR_ECC_CALC                      0x048c
+#define        GT64260_SDRAM_ERR_ECC_CNTL                      0x0494
+#define        GT64260_SDRAM_ERR_ECC_ERR_CNT                   0x0498
+
+
+/*
+ *****************************************************************************
+ *
+ *     Device/BOOT Cotnroller Registers
+ *
+ *****************************************************************************
+ */
+
+/* Device Control Registers */
+#define        GT64260_DEV_BANK_PARAMS_0                       0x045c
+#define        GT64260_DEV_BANK_PARAMS_1                       0x0460
+#define        GT64260_DEV_BANK_PARAMS_2                       0x0464
+#define        GT64260_DEV_BANK_PARAMS_3                       0x0468
+#define        GT64260_DEV_BOOT_PARAMS                         0x046c
+#define        GT64260_DEV_IF_CNTL                             0x04c0
+#define        GT64260_DEV_IF_XBAR_CNTL_LO                     0x04c8
+#define        GT64260_DEV_IF_XBAR_CNTL_HI                     0x04cc
+#define        GT64260_DEV_IF_XBAR_CNTL_TO                     0x04c4
+
+/* Device Interrupt Registers */
+#define        GT64260_DEV_INTR_CAUSE                          0x04d0
+#define        GT64260_DEV_INTR_MASK                           0x04d4
+#define        GT64260_DEV_INTR_ERR_ADDR                       0x04d8
+
+
+/*
+ *****************************************************************************
+ *
+ *     PCI Bridge Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* PCI Configuration Access Registers */
+#define        GT64260_PCI_0_CONFIG_ADDR                       0x0cf8
+#define        GT64260_PCI_0_CONFIG_DATA                       0x0cfc
+#define        GT64260_PCI_0_IACK                              0x0c34
+
+#define        GT64260_PCI_1_CONFIG_ADDR                       0x0c78
+#define        GT64260_PCI_1_CONFIG_DATA                       0x0c7c
+#define        GT64260_PCI_1_IACK                              0x0cb4
+
+/* PCI Control Registers */
+#define        GT64260_PCI_0_CMD                               0x0c00
+#define        GT64260_PCI_0_MODE                              0x0d00
+#define        GT64260_PCI_0_TO_RETRY                          0x0c04
+#define        GT64260_PCI_0_RD_BUF_DISCARD_TIMER              0x0d04
+#define        GT64260_PCI_0_MSI_TRIGGER_TIMER                 0x0c38
+#define        GT64260_PCI_0_ARBITER_CNTL                      0x1d00
+#define        GT64260_PCI_0_XBAR_CNTL_LO                      0x1d08
+#define        GT64260_PCI_0_XBAR_CNTL_HI                      0x1d0c
+#define        GT64260_PCI_0_XBAR_CNTL_TO                      0x1d04
+#define        GT64260_PCI_0_RD_RESP_XBAR_CNTL_LO              0x1d18
+#define        GT64260_PCI_0_RD_RESP_XBAR_CNTL_HI              0x1d1c
+#define        GT64260_PCI_0_SYNC_BARRIER                      0x1d10
+#define        GT64260_PCI_0_P2P_CONFIG                        0x1d14
+#define        GT64260_PCI_0_P2P_SWAP_CNTL                     0x1d54
+
+#define        GT64260_PCI_1_CMD                               0x0c80
+#define        GT64260_PCI_1_MODE                              0x0d80
+#define        GT64260_PCI_1_TO_RETRY                          0x0c84
+#define        GT64260_PCI_1_RD_BUF_DISCARD_TIMER              0x0d84
+#define        GT64260_PCI_1_MSI_TRIGGER_TIMER                 0x0cb8
+#define        GT64260_PCI_1_ARBITER_CNTL                      0x1d80
+#define        GT64260_PCI_1_XBAR_CNTL_LO                      0x1d88
+#define        GT64260_PCI_1_XBAR_CNTL_HI                      0x1d8c
+#define        GT64260_PCI_1_XBAR_CNTL_TO                      0x1d84
+#define        GT64260_PCI_1_RD_RESP_XBAR_CNTL_LO              0x1d98
+#define        GT64260_PCI_1_RD_RESP_XBAR_CNTL_HI              0x1d9c
+#define        GT64260_PCI_1_SYNC_BARRIER                      0x1d90
+#define        GT64260_PCI_1_P2P_CONFIG                        0x1d94
+#define        GT64260_PCI_1_P2P_SWAP_CNTL                     0x1dd4
+
+/* PCI Access Control Regions Registers */
+#define        GT64260_PCI_ACC_CNTL_WINDOWS                    8
+
+#define        GT64260_PCI_ACC_CNTL_PREFETCHEN                 (1<<12)
+#define        GT64260_PCI_ACC_CNTL_DREADEN                    (1<<13)
+#define        GT64260_PCI_ACC_CNTL_RDPREFETCH                 (1<<16)
+#define        GT64260_PCI_ACC_CNTL_RDLINEPREFETCH             (1<<17)
+#define        GT64260_PCI_ACC_CNTL_RDMULPREFETCH              (1<<18)
+#define        GT64260_PCI_ACC_CNTL_MBURST_4_WORDS             0x00000000
+#define        GT64260_PCI_ACC_CNTL_MBURST_8_WORDS             0x00100000
+#define        GT64260_PCI_ACC_CNTL_MBURST_16_WORDS            0x00200000
+#define        GT64260_PCI_ACC_CNTL_MBURST_MASK                0x00300000
+#define        GT64260_PCI_ACC_CNTL_SWAP_BYTE                  0x00000000
+#define        GT64260_PCI_ACC_CNTL_SWAP_NONE                  0x01000000
+#define        GT64260_PCI_ACC_CNTL_SWAP_BYTE_WORD             0x02000000
+#define        GT64260_PCI_ACC_CNTL_SWAP_WORD                  0x03000000
+#define        GT64260_PCI_ACC_CNTL_SWAP_MASK                  0x03000000
+#define        GT64260_PCI_ACC_CNTL_ACCPROT                    (1<<28)
+#define        GT64260_PCI_ACC_CNTL_WRPROT                     (1<<29)
+
+#define        GT64260_PCI_ACC_CNTL_ALL_BITS   (GT64260_PCI_ACC_CNTL_PREFETCHEN |    \
+                                        GT64260_PCI_ACC_CNTL_DREADEN |       \
+                                        GT64260_PCI_ACC_CNTL_RDPREFETCH |    \
+                                        GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |\
+                                        GT64260_PCI_ACC_CNTL_RDMULPREFETCH | \
+                                        GT64260_PCI_ACC_CNTL_MBURST_MASK |   \
+                                        GT64260_PCI_ACC_CNTL_SWAP_MASK |     \
+                                        GT64260_PCI_ACC_CNTL_ACCPROT|        \
+                                        GT64260_PCI_ACC_CNTL_WRPROT)
+
+#define        GT64260_PCI_0_ACC_CNTL_0_BASE_LO                0x1e00
+#define        GT64260_PCI_0_ACC_CNTL_0_BASE_HI                0x1e04
+#define        GT64260_PCI_0_ACC_CNTL_0_TOP                    0x1e08
+#define        GT64260_PCI_0_ACC_CNTL_1_BASE_LO                0x1e10
+#define        GT64260_PCI_0_ACC_CNTL_1_BASE_HI                0x1e14
+#define        GT64260_PCI_0_ACC_CNTL_1_TOP                    0x1e18
+#define        GT64260_PCI_0_ACC_CNTL_2_BASE_LO                0x1e20
+#define        GT64260_PCI_0_ACC_CNTL_2_BASE_HI                0x1e24
+#define        GT64260_PCI_0_ACC_CNTL_2_TOP                    0x1e28
+#define        GT64260_PCI_0_ACC_CNTL_3_BASE_LO                0x1e30
+#define        GT64260_PCI_0_ACC_CNTL_3_BASE_HI                0x1e34
+#define        GT64260_PCI_0_ACC_CNTL_3_TOP                    0x1e38
+#define        GT64260_PCI_0_ACC_CNTL_4_BASE_LO                0x1e40
+#define        GT64260_PCI_0_ACC_CNTL_4_BASE_HI                0x1e44
+#define        GT64260_PCI_0_ACC_CNTL_4_TOP                    0x1e48
+#define        GT64260_PCI_0_ACC_CNTL_5_BASE_LO                0x1e50
+#define        GT64260_PCI_0_ACC_CNTL_5_BASE_HI                0x1e54
+#define        GT64260_PCI_0_ACC_CNTL_5_TOP                    0x1e58
+#define        GT64260_PCI_0_ACC_CNTL_6_BASE_LO                0x1e60
+#define        GT64260_PCI_0_ACC_CNTL_6_BASE_HI                0x1e64
+#define        GT64260_PCI_0_ACC_CNTL_6_TOP                    0x1e68
+#define        GT64260_PCI_0_ACC_CNTL_7_BASE_LO                0x1e70
+#define        GT64260_PCI_0_ACC_CNTL_7_BASE_HI                0x1e74
+#define        GT64260_PCI_0_ACC_CNTL_7_TOP                    0x1e78
+
+#define        GT64260_PCI_1_ACC_CNTL_0_BASE_LO                0x1e80
+#define        GT64260_PCI_1_ACC_CNTL_0_BASE_HI                0x1e84
+#define        GT64260_PCI_1_ACC_CNTL_0_TOP                    0x1e88
+#define        GT64260_PCI_1_ACC_CNTL_1_BASE_LO                0x1e90
+#define        GT64260_PCI_1_ACC_CNTL_1_BASE_HI                0x1e94
+#define        GT64260_PCI_1_ACC_CNTL_1_TOP                    0x1e98
+#define        GT64260_PCI_1_ACC_CNTL_2_BASE_LO                0x1ea0
+#define        GT64260_PCI_1_ACC_CNTL_2_BASE_HI                0x1ea4
+#define        GT64260_PCI_1_ACC_CNTL_2_TOP                    0x1ea8
+#define        GT64260_PCI_1_ACC_CNTL_3_BASE_LO                0x1eb0
+#define        GT64260_PCI_1_ACC_CNTL_3_BASE_HI                0x1eb4
+#define        GT64260_PCI_1_ACC_CNTL_3_TOP                    0x1eb8
+#define        GT64260_PCI_1_ACC_CNTL_4_BASE_LO                0x1ec0
+#define        GT64260_PCI_1_ACC_CNTL_4_BASE_HI                0x1ec4
+#define        GT64260_PCI_1_ACC_CNTL_4_TOP                    0x1ec8
+#define        GT64260_PCI_1_ACC_CNTL_5_BASE_LO                0x1ed0
+#define        GT64260_PCI_1_ACC_CNTL_5_BASE_HI                0x1ed4
+#define        GT64260_PCI_1_ACC_CNTL_5_TOP                    0x1ed8
+#define        GT64260_PCI_1_ACC_CNTL_6_BASE_LO                0x1ee0
+#define        GT64260_PCI_1_ACC_CNTL_6_BASE_HI                0x1ee4
+#define        GT64260_PCI_1_ACC_CNTL_6_TOP                    0x1ee8
+#define        GT64260_PCI_1_ACC_CNTL_7_BASE_LO                0x1ef0
+#define        GT64260_PCI_1_ACC_CNTL_7_BASE_HI                0x1ef4
+#define        GT64260_PCI_1_ACC_CNTL_7_TOP                    0x1ef8
+
+/* PCI Snoop Control Registers */
+#define        GT64260_PCI_SNOOP_WINDOWS                       4
+
+#define        GT64260_PCI_SNOOP_NONE                          0x00000000
+#define        GT64260_PCI_SNOOP_WT                            0x00001000
+#define        GT64260_PCI_SNOOP_WB                            0x00002000
+
+#define        GT64260_PCI_0_SNOOP_0_BASE_LO                   0x1f00
+#define        GT64260_PCI_0_SNOOP_0_BASE_HI                   0x1f04
+#define        GT64260_PCI_0_SNOOP_0_TOP                       0x1f08
+#define        GT64260_PCI_0_SNOOP_1_BASE_LO                   0x1f10
+#define        GT64260_PCI_0_SNOOP_1_BASE_HI                   0x1f14
+#define        GT64260_PCI_0_SNOOP_1_TOP                       0x1f18
+#define        GT64260_PCI_0_SNOOP_2_BASE_LO                   0x1f20
+#define        GT64260_PCI_0_SNOOP_2_BASE_HI                   0x1f24
+#define        GT64260_PCI_0_SNOOP_2_TOP                       0x1f28
+#define        GT64260_PCI_0_SNOOP_3_BASE_LO                   0x1f30
+#define        GT64260_PCI_0_SNOOP_3_BASE_HI                   0x1f34
+#define        GT64260_PCI_0_SNOOP_3_TOP                       0x1f38
+
+#define        GT64260_PCI_1_SNOOP_0_BASE_LO                   0x1f80
+#define        GT64260_PCI_1_SNOOP_0_BASE_HI                   0x1f84
+#define        GT64260_PCI_1_SNOOP_0_TOP                       0x1f88
+#define        GT64260_PCI_1_SNOOP_1_BASE_LO                   0x1f90
+#define        GT64260_PCI_1_SNOOP_1_BASE_HI                   0x1f94
+#define        GT64260_PCI_1_SNOOP_1_TOP                       0x1f98
+#define        GT64260_PCI_1_SNOOP_2_BASE_LO                   0x1fa0
+#define        GT64260_PCI_1_SNOOP_2_BASE_HI                   0x1fa4
+#define        GT64260_PCI_1_SNOOP_2_TOP                       0x1fa8
+#define        GT64260_PCI_1_SNOOP_3_BASE_LO                   0x1fb0
+#define        GT64260_PCI_1_SNOOP_3_BASE_HI                   0x1fb4
+#define        GT64260_PCI_1_SNOOP_3_TOP                       0x1fb8
+
+/* PCI Error Report Registers */
+#define GT64260_PCI_0_ERR_SERR_MASK                    0x0c28
+#define GT64260_PCI_0_ERR_ADDR_LO                      0x1d40
+#define GT64260_PCI_0_ERR_ADDR_HI                      0x1d44
+#define GT64260_PCI_0_ERR_DATA_LO                      0x1d48
+#define GT64260_PCI_0_ERR_DATA_HI                      0x1d4c
+#define GT64260_PCI_0_ERR_CMD                          0x1d50
+#define GT64260_PCI_0_ERR_CAUSE                                0x1d58
+#define GT64260_PCI_0_ERR_MASK                         0x1d5c
+
+#define GT64260_PCI_1_ERR_SERR_MASK                    0x0ca8
+#define GT64260_PCI_1_ERR_ADDR_LO                      0x1dc0
+#define GT64260_PCI_1_ERR_ADDR_HI                      0x1dc4
+#define GT64260_PCI_1_ERR_DATA_LO                      0x1dc8
+#define GT64260_PCI_1_ERR_DATA_HI                      0x1dcc
+#define GT64260_PCI_1_ERR_CMD                          0x1dd0
+#define GT64260_PCI_1_ERR_CAUSE                                0x1dd8
+#define GT64260_PCI_1_ERR_MASK                         0x1ddc
+
+/* PCI Slave Address Decoding Registers */
+#define        GT64260_PCI_SCS_WINDOWS                         4
+#define        GT64260_PCI_CS_WINDOWS                          4
+#define        GT64260_PCI_BOOT_WINDOWS                        1
+#define        GT64260_PCI_P2P_MEM_WINDOWS                     2
+#define        GT64260_PCI_P2P_IO_WINDOWS                      1
+#define        GT64260_PCI_DAC_SCS_WINDOWS                     4
+#define        GT64260_PCI_DAC_CS_WINDOWS                      4
+#define        GT64260_PCI_DAC_BOOT_WINDOWS                    1
+#define        GT64260_PCI_DAC_P2P_MEM_WINDOWS                 2
+
+#define        GT64260_PCI_0_SLAVE_SCS_0_SIZE                  0x0c08
+#define        GT64260_PCI_0_SLAVE_SCS_1_SIZE                  0x0d08
+#define        GT64260_PCI_0_SLAVE_SCS_2_SIZE                  0x0c0c
+#define        GT64260_PCI_0_SLAVE_SCS_3_SIZE                  0x0d0c
+#define        GT64260_PCI_0_SLAVE_CS_0_SIZE                   0x0c10
+#define        GT64260_PCI_0_SLAVE_CS_1_SIZE                   0x0d10
+#define        GT64260_PCI_0_SLAVE_CS_2_SIZE                   0x0d18
+#define        GT64260_PCI_0_SLAVE_CS_3_SIZE                   0x0c14
+#define        GT64260_PCI_0_SLAVE_BOOT_SIZE                   0x0d14
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_0_SIZE              0x0d1c
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_1_SIZE              0x0d20
+#define        GT64260_PCI_0_SLAVE_P2P_IO_SIZE                 0x0d24
+#define        GT64260_PCI_0_SLAVE_CPU_SIZE                    0x0d28
+
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_0_SIZE              0x0e00
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_1_SIZE              0x0e04
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_2_SIZE              0x0e08
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_3_SIZE              0x0e0c
+#define        GT64260_PCI_0_SLAVE_DAC_CS_0_SIZE               0x0e10
+#define        GT64260_PCI_0_SLAVE_DAC_CS_1_SIZE               0x0e14
+#define        GT64260_PCI_0_SLAVE_DAC_CS_2_SIZE               0x0e18
+#define        GT64260_PCI_0_SLAVE_DAC_CS_3_SIZE               0x0e1c
+#define        GT64260_PCI_0_SLAVE_DAC_BOOT_SIZE               0x0e20
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_0_SIZE          0x0e24
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_1_SIZE          0x0e28
+#define        GT64260_PCI_0_SLAVE_DAC_CPU_SIZE                0x0e2c
+
+#define        GT64260_PCI_0_SLAVE_EXP_ROM_SIZE                0x0d2c
+
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_SCS_0         (1<<0)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_SCS_1         (1<<1)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_SCS_2         (1<<2)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_SCS_3         (1<<3)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_CS_0          (1<<4)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_CS_1          (1<<5)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_CS_2          (1<<6)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_CS_3          (1<<7)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_BOOT          (1<<8)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_REG_MEM       (1<<9)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_REG_IO        (1<<10)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_P2P_MEM_0     (1<<11)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_P2P_MEM_1     (1<<12)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_P2P_IO        (1<<13)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_CPU           (1<<14)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_SCS_0     (1<<15)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_SCS_1     (1<<16)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_SCS_2     (1<<17)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_SCS_3     (1<<18)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_CS_0      (1<<19)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_CS_1      (1<<20)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_CS_2      (1<<21)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_CS_3      (1<<22)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_BOOT      (1<<23)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_P2P_MEM_0 (1<<24)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_P2P_MEM_1 (1<<25)
+#define        GT64260_PCI_SLAVE_BAR_REG_ENABLES_DAC_CPU       (1<<26)
+
+#define        GT64260_PCI_0_SLAVE_BAR_REG_ENABLES             0x0c3c
+#define        GT64260_PCI_0_SLAVE_SCS_0_REMAP                 0x0c48
+#define        GT64260_PCI_0_SLAVE_SCS_1_REMAP                 0x0d48
+#define        GT64260_PCI_0_SLAVE_SCS_2_REMAP                 0x0c4c
+#define        GT64260_PCI_0_SLAVE_SCS_3_REMAP                 0x0d4c
+#define        GT64260_PCI_0_SLAVE_CS_0_REMAP                  0x0c50
+#define        GT64260_PCI_0_SLAVE_CS_1_REMAP                  0x0d50
+#define        GT64260_PCI_0_SLAVE_CS_2_REMAP                  0x0d58
+#define        GT64260_PCI_0_SLAVE_CS_3_REMAP                  0x0c54
+#define        GT64260_PCI_0_SLAVE_BOOT_REMAP                  0x0d54
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_0_REMAP_LO          0x0d5c
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_0_REMAP_HI          0x0d60
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_1_REMAP_LO          0x0d64
+#define        GT64260_PCI_0_SLAVE_P2P_MEM_1_REMAP_HI          0x0d68
+#define        GT64260_PCI_0_SLAVE_P2P_IO_REMAP                0x0d6c
+#define        GT64260_PCI_0_SLAVE_CPU_REMAP                   0x0d70
+
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_0_REMAP             0x0f00
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_1_REMAP             0x0f04
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_2_REMAP             0x0f08
+#define        GT64260_PCI_0_SLAVE_DAC_SCS_3_REMAP             0x0f0c
+#define        GT64260_PCI_0_SLAVE_DAC_CS_0_REMAP              0x0f10
+#define        GT64260_PCI_0_SLAVE_DAC_CS_1_REMAP              0x0f14
+#define        GT64260_PCI_0_SLAVE_DAC_CS_2_REMAP              0x0f18
+#define        GT64260_PCI_0_SLAVE_DAC_CS_3_REMAP              0x0f1c
+#define        GT64260_PCI_0_SLAVE_DAC_BOOT_REMAP              0x0f20
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_0_REMAP_LO      0x0f24
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_0_REMAP_HI      0x0f28
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_1_REMAP_LO      0x0f2c
+#define        GT64260_PCI_0_SLAVE_DAC_P2P_MEM_1_REMAP_HI      0x0f30
+#define        GT64260_PCI_0_SLAVE_DAC_CPU_REMAP               0x0f34
+
+#define        GT64260_PCI_0_SLAVE_EXP_ROM_REMAP               0x0f38
+#define        GT64260_PCI_0_SLAVE_PCI_DECODE_CNTL             0x0d3c
+
+#define        GT64260_PCI_1_SLAVE_SCS_0_SIZE                  0x0c88
+#define        GT64260_PCI_1_SLAVE_SCS_1_SIZE                  0x0d88
+#define        GT64260_PCI_1_SLAVE_SCS_2_SIZE                  0x0c8c
+#define        GT64260_PCI_1_SLAVE_SCS_3_SIZE                  0x0d8c
+#define        GT64260_PCI_1_SLAVE_CS_0_SIZE                   0x0c90
+#define        GT64260_PCI_1_SLAVE_CS_1_SIZE                   0x0d90
+#define        GT64260_PCI_1_SLAVE_CS_2_SIZE                   0x0d98
+#define        GT64260_PCI_1_SLAVE_CS_3_SIZE                   0x0c94
+#define        GT64260_PCI_1_SLAVE_BOOT_SIZE                   0x0d94
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_0_SIZE              0x0d9c
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_1_SIZE              0x0da0
+#define        GT64260_PCI_1_SLAVE_P2P_IO_SIZE                 0x0da4
+#define        GT64260_PCI_1_SLAVE_CPU_SIZE                    0x0da8
+
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_0_SIZE              0x0e80
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_1_SIZE              0x0e84
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_2_SIZE              0x0e88
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_3_SIZE              0x0e8c
+#define        GT64260_PCI_1_SLAVE_DAC_CS_0_SIZE               0x0e90
+#define        GT64260_PCI_1_SLAVE_DAC_CS_1_SIZE               0x0e94
+#define        GT64260_PCI_1_SLAVE_DAC_CS_2_SIZE               0x0e98
+#define        GT64260_PCI_1_SLAVE_DAC_CS_3_SIZE               0x0e9c
+#define        GT64260_PCI_1_SLAVE_DAC_BOOT_SIZE               0x0ea0
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_0_SIZE          0x0ea4
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_1_SIZE          0x0ea8
+#define        GT64260_PCI_1_SLAVE_DAC_CPU_SIZE                0x0eac
+
+#define        GT64260_PCI_1_SLAVE_EXP_ROM_SIZE                0x0dac
+
+#define        GT64260_PCI_1_SLAVE_BAR_REG_ENABLES             0x0cbc
+#define        GT64260_PCI_1_SLAVE_SCS_0_REMAP                 0x0cc8
+#define        GT64260_PCI_1_SLAVE_SCS_1_REMAP                 0x0dc8
+#define        GT64260_PCI_1_SLAVE_SCS_2_REMAP                 0x0ccc
+#define        GT64260_PCI_1_SLAVE_SCS_3_REMAP                 0x0dcc
+#define        GT64260_PCI_1_SLAVE_CS_0_REMAP                  0x0cd0
+#define        GT64260_PCI_1_SLAVE_CS_1_REMAP                  0x0dd0
+#define        GT64260_PCI_1_SLAVE_CS_2_REMAP                  0x0dd8
+#define        GT64260_PCI_1_SLAVE_CS_3_REMAP                  0x0cd4
+#define        GT64260_PCI_1_SLAVE_BOOT_REMAP                  0x0dd4
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_0_REMAP_LO          0x0ddc
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_0_REMAP_HI          0x0de0
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_1_REMAP_LO          0x0de4
+#define        GT64260_PCI_1_SLAVE_P2P_MEM_1_REMAP_HI          0x0de8
+#define        GT64260_PCI_1_SLAVE_P2P_IO_REMAP                0x0dec
+#define        GT64260_PCI_1_SLAVE_CPU_REMAP                   0x0df0
+
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_0_REMAP             0x0f80
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_1_REMAP             0x0f84
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_2_REMAP             0x0f88
+#define        GT64260_PCI_1_SLAVE_DAC_SCS_3_REMAP             0x0f8c
+#define        GT64260_PCI_1_SLAVE_DAC_CS_0_REMAP              0x0f90
+#define        GT64260_PCI_1_SLAVE_DAC_CS_1_REMAP              0x0f94
+#define        GT64260_PCI_1_SLAVE_DAC_CS_2_REMAP              0x0f98
+#define        GT64260_PCI_1_SLAVE_DAC_CS_3_REMAP              0x0f9c
+#define        GT64260_PCI_1_SLAVE_DAC_BOOT_REMAP              0x0fa0
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_0_REMAP_LO      0x0fa4
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_0_REMAP_HI      0x0fa8
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_1_REMAP_LO      0x0fac
+#define        GT64260_PCI_1_SLAVE_DAC_P2P_MEM_1_REMAP_HI      0x0fb0
+#define        GT64260_PCI_1_SLAVE_DAC_CPU_REMAP               0x0fb4
+
+#define        GT64260_PCI_1_SLAVE_EXP_ROM_REMAP               0x0fb8
+#define        GT64260_PCI_1_SLAVE_PCI_DECODE_CNTL             0x0dbc
+
+
+/*
+ *****************************************************************************
+ *
+ *     I2O Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* FIXME: fill in */
+
+
+
+/*
+ *****************************************************************************
+ *
+ *     DMA Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* FIXME: fill in */
+
+
+/*
+ *****************************************************************************
+ *
+ *     Timer/Counter Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* FIXME: fill in */
+
+
+/*
+ *****************************************************************************
+ *
+ *     Communications Controller (Enet, Serial, etc.) Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_ENET_0_CNTL_LO                          0xf200
+#define        GT64260_ENET_0_CNTL_HI                          0xf204
+#define        GT64260_ENET_0_RX_BUF_PCI_ADDR_HI               0xf208
+#define        GT64260_ENET_0_TX_BUF_PCI_ADDR_HI               0xf20c
+#define        GT64260_ENET_0_RX_DESC_ADDR_HI                  0xf210
+#define        GT64260_ENET_0_TX_DESC_ADDR_HI                  0xf214
+#define        GT64260_ENET_0_HASH_TAB_PCI_ADDR_HI             0xf218
+#define        GT64260_ENET_1_CNTL_LO                          0xf220
+#define        GT64260_ENET_1_CNTL_HI                          0xf224
+#define        GT64260_ENET_1_RX_BUF_PCI_ADDR_HI               0xf228
+#define        GT64260_ENET_1_TX_BUF_PCI_ADDR_HI               0xf22c
+#define        GT64260_ENET_1_RX_DESC_ADDR_HI                  0xf230
+#define        GT64260_ENET_1_TX_DESC_ADDR_HI                  0xf234
+#define        GT64260_ENET_1_HASH_TAB_PCI_ADDR_HI             0xf238
+#define        GT64260_ENET_2_CNTL_LO                          0xf240
+#define        GT64260_ENET_2_CNTL_HI                          0xf244
+#define        GT64260_ENET_2_RX_BUF_PCI_ADDR_HI               0xf248
+#define        GT64260_ENET_2_TX_BUF_PCI_ADDR_HI               0xf24c
+#define        GT64260_ENET_2_RX_DESC_ADDR_HI                  0xf250
+#define        GT64260_ENET_2_TX_DESC_ADDR_HI                  0xf254
+#define        GT64260_ENET_2_HASH_TAB_PCI_ADDR_HI             0xf258
+
+#define        GT64260_MPSC_0_CNTL_LO                          0xf280
+#define        GT64260_MPSC_0_CNTL_HI                          0xf284
+#define        GT64260_MPSC_0_RX_BUF_PCI_ADDR_HI               0xf288
+#define        GT64260_MPSC_0_TX_BUF_PCI_ADDR_HI               0xf28c
+#define        GT64260_MPSC_0_RX_DESC_ADDR_HI                  0xf290
+#define        GT64260_MPSC_0_TX_DESC_ADDR_HI                  0xf294
+#define        GT64260_MPSC_1_CNTL_LO                          0xf2c0
+#define        GT64260_MPSC_1_CNTL_HI                          0xf2c4
+#define        GT64260_MPSC_1_RX_BUF_PCI_ADDR_HI               0xf2c8
+#define        GT64260_MPSC_1_TX_BUF_PCI_ADDR_HI               0xf2cc
+#define        GT64260_MPSC_1_RX_DESC_ADDR_HI                  0xf2d0
+#define        GT64260_MPSC_1_TX_DESC_ADDR_HI                  0xf2d4
+
+#define        GT64260_SER_INIT_PCI_ADDR_HI                    0xf320
+#define        GT64260_SER_INIT_LAST_DATA                      0xf324
+#define        GT64260_SER_INIT_CONTROL                        0xf328
+#define        GT64260_SER_INIT_STATUS                         0xf32c
+
+#define        GT64260_COMM_ARBITER_CNTL                       0xf300
+#define        GT64260_COMM_CONFIG                             0xb40c
+#define        GT64260_COMM_XBAR_TO                            0xf304
+#define        GT64260_COMM_INTR_CAUSE                         0xf310
+#define        GT64260_COMM_INTR_MASK                          0xf314
+#define        GT64260_COMM_ERR_ADDR                           0xf318
+
+
+/*
+ *****************************************************************************
+ *
+ *     Fast Ethernet Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_ENET_PHY_ADDR                           0x2000
+#define        GT64260_ENET_ESMIR                              0x2010
+
+#define        GT64260_ENET_E0PCR                              0x2400
+#define        GT64260_ENET_E0PCXR                             0x2408
+#define        GT64260_ENET_E0PCMR                             0x2410
+#define        GT64260_ENET_E0PSR                              0x2418
+#define        GT64260_ENET_E0SPR                              0x2420
+#define        GT64260_ENET_E0HTPR                             0x2428
+#define        GT64260_ENET_E0FCSAL                            0x2430
+#define        GT64260_ENET_E0FCSAH                            0x2438
+#define        GT64260_ENET_E0SDCR                             0x2440
+#define        GT64260_ENET_E0SDCMR                            0x2448
+#define        GT64260_ENET_E0ICR                              0x2450
+#define        GT64260_ENET_E0IMR                              0x2458
+#define        GT64260_ENET_E0FRDP0                            0x2480
+#define        GT64260_ENET_E0FRDP1                            0x2484
+#define        GT64260_ENET_E0FRDP2                            0x2488
+#define        GT64260_ENET_E0FRDP3                            0x248c
+#define        GT64260_ENET_E0CRDP0                            0x24a0
+#define        GT64260_ENET_E0CRDP1                            0x24a4
+#define        GT64260_ENET_E0CRDP2                            0x24a8
+#define        GT64260_ENET_E0CRDP3                            0x24ac
+#define        GT64260_ENET_E0CTDP0                            0x24e0
+#define        GT64260_ENET_E0CTDP1                            0x24e4
+#define        GT64260_ENET_0_DSCP2P0L                         0x2460
+#define        GT64260_ENET_0_DSCP2P0H                         0x2464
+#define        GT64260_ENET_0_DSCP2P1L                         0x2468
+#define        GT64260_ENET_0_DSCP2P1H                         0x246c
+#define        GT64260_ENET_0_VPT2P                            0x2470
+#define        GT64260_ENET_0_MIB_CTRS                         0x2500
+
+#define        GT64260_ENET_E1PCR                              0x2800
+#define        GT64260_ENET_E1PCXR                             0x2808
+#define        GT64260_ENET_E1PCMR                             0x2810
+#define        GT64260_ENET_E1PSR                              0x2818
+#define        GT64260_ENET_E1SPR                              0x2820
+#define        GT64260_ENET_E1HTPR                             0x2828
+#define        GT64260_ENET_E1FCSAL                            0x2830
+#define        GT64260_ENET_E1FCSAH                            0x2838
+#define        GT64260_ENET_E1SDCR                             0x2840
+#define        GT64260_ENET_E1SDCMR                            0x2848
+#define        GT64260_ENET_E1ICR                              0x2850
+#define        GT64260_ENET_E1IMR                              0x2858
+#define        GT64260_ENET_E1FRDP0                            0x2880
+#define        GT64260_ENET_E1FRDP1                            0x2884
+#define        GT64260_ENET_E1FRDP2                            0x2888
+#define        GT64260_ENET_E1FRDP3                            0x288c
+#define        GT64260_ENET_E1CRDP0                            0x28a0
+#define        GT64260_ENET_E1CRDP1                            0x28a4
+#define        GT64260_ENET_E1CRDP2                            0x28a8
+#define        GT64260_ENET_E1CRDP3                            0x28ac
+#define        GT64260_ENET_E1CTDP0                            0x28e0
+#define        GT64260_ENET_E1CTDP1                            0x28e4
+#define        GT64260_ENET_1_DSCP2P0L                         0x2860
+#define        GT64260_ENET_1_DSCP2P0H                         0x2864
+#define        GT64260_ENET_1_DSCP2P1L                         0x2868
+#define        GT64260_ENET_1_DSCP2P1H                         0x286c
+#define        GT64260_ENET_1_VPT2P                            0x2870
+#define        GT64260_ENET_1_MIB_CTRS                         0x2900
+
+#define        GT64260_ENET_E2PCR                              0x2c00
+#define        GT64260_ENET_E2PCXR                             0x2c08
+#define        GT64260_ENET_E2PCMR                             0x2c10
+#define        GT64260_ENET_E2PSR                              0x2c18
+#define        GT64260_ENET_E2SPR                              0x2c20
+#define        GT64260_ENET_E2HTPR                             0x2c28
+#define        GT64260_ENET_E2FCSAL                            0x2c30
+#define        GT64260_ENET_E2FCSAH                            0x2c38
+#define        GT64260_ENET_E2SDCR                             0x2c40
+#define        GT64260_ENET_E2SDCMR                            0x2c48
+#define        GT64260_ENET_E2ICR                              0x2c50
+#define        GT64260_ENET_E2IMR                              0x2c58
+#define        GT64260_ENET_E2FRDP0                            0x2c80
+#define        GT64260_ENET_E2FRDP1                            0x2c84
+#define        GT64260_ENET_E2FRDP2                            0x2c88
+#define        GT64260_ENET_E2FRDP3                            0x2c8c
+#define        GT64260_ENET_E2CRDP0                            0x2ca0
+#define        GT64260_ENET_E2CRDP1                            0x2ca4
+#define        GT64260_ENET_E2CRDP2                            0x2ca8
+#define        GT64260_ENET_E2CRDP3                            0x2cac
+#define        GT64260_ENET_E2CTDP0                            0x2ce0
+#define        GT64260_ENET_E2CTDP1                            0x2ce4
+#define        GT64260_ENET_2_DSCP2P0L                         0x2c60
+#define        GT64260_ENET_2_DSCP2P0H                         0x2c64
+#define        GT64260_ENET_2_DSCP2P1L                         0x2c68
+#define        GT64260_ENET_2_DSCP2P1H                         0x2c6c
+#define        GT64260_ENET_2_VPT2P                            0x2c70
+#define        GT64260_ENET_2_MIB_CTRS                         0x2d00
+
+
+/*
+ *****************************************************************************
+ *
+ *     Multi-Protocol Serial Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* Signal Routing */
+#define        GT64260_MPSC_MRR                                0xb400
+#define        GT64260_MPSC_RCRR                               0xb404
+#define        GT64260_MPSC_TCRR                               0xb408
+
+/* Main Configuratino Registers */
+#define        GT64260_MPSC_0_MMCRL                            0x8000
+#define        GT64260_MPSC_0_MMCRH                            0x8004
+#define        GT64260_MPSC_0_MPCR                             0x8008
+#define        GT64260_MPSC_0_CHR_1                            0x800c
+#define        GT64260_MPSC_0_CHR_2                            0x8010
+#define        GT64260_MPSC_0_CHR_3                            0x8014
+#define        GT64260_MPSC_0_CHR_4                            0x8018
+#define        GT64260_MPSC_0_CHR_5                            0x801c
+#define        GT64260_MPSC_0_CHR_6                            0x8020
+#define        GT64260_MPSC_0_CHR_7                            0x8024
+#define        GT64260_MPSC_0_CHR_8                            0x8028
+#define        GT64260_MPSC_0_CHR_9                            0x802c
+#define        GT64260_MPSC_0_CHR_10                           0x8030
+#define        GT64260_MPSC_0_CHR_11                           0x8034
+
+#define        GT64260_MPSC_1_MMCRL                            0x9000
+#define        GT64260_MPSC_1_MMCRH                            0x9004
+#define        GT64260_MPSC_1_MPCR                             0x9008
+#define        GT64260_MPSC_1_CHR_1                            0x900c
+#define        GT64260_MPSC_1_CHR_2                            0x9010
+#define        GT64260_MPSC_1_CHR_3                            0x9014
+#define        GT64260_MPSC_1_CHR_4                            0x9018
+#define        GT64260_MPSC_1_CHR_5                            0x901c
+#define        GT64260_MPSC_1_CHR_6                            0x9020
+#define        GT64260_MPSC_1_CHR_7                            0x9024
+#define        GT64260_MPSC_1_CHR_8                            0x9028
+#define        GT64260_MPSC_1_CHR_9                            0x902c
+#define        GT64260_MPSC_1_CHR_10                           0x9030
+#define        GT64260_MPSC_1_CHR_11                           0x9034
+
+#define        GT64260_MPSC_0_INTR_CAUSE                       0xb804
+#define        GT64260_MPSC_0_INTR_MASK                        0xb884
+#define        GT64260_MPSC_1_INTR_CAUSE                       0xb80c
+#define        GT64260_MPSC_1_INTR_MASK                        0xb88c
+
+#define        GT64260_MPSC_UART_CR_TEV                        (1<<1)
+#define        GT64260_MPSC_UART_CR_TA                         (1<<7)
+#define        GT64260_MPSC_UART_CR_TTCS                       (1<<9)
+#define        GT64260_MPSC_UART_CR_REV                        (1<<17)
+#define        GT64260_MPSC_UART_CR_RA                         (1<<23)
+#define        GT64260_MPSC_UART_CR_CRD                        (1<<25)
+#define        GT64260_MPSC_UART_CR_EH                         (1<<31)
+
+#define        GT64260_MPSC_UART_ESR_CTS                       (1<<0)
+#define        GT64260_MPSC_UART_ESR_CD                        (1<<1)
+#define        GT64260_MPSC_UART_ESR_TIDLE                     (1<<3)
+#define        GT64260_MPSC_UART_ESR_RHS                       (1<<5)
+#define        GT64260_MPSC_UART_ESR_RLS                       (1<<7)
+#define        GT64260_MPSC_UART_ESR_RLIDL                     (1<<11)
+
+
+/*
+ *****************************************************************************
+ *
+ *     Serial DMA Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_SDMA_0_SDC                              0x4000
+#define        GT64260_SDMA_0_SDCM                             0x4008
+#define        GT64260_SDMA_0_RX_DESC                          0x4800
+#define        GT64260_SDMA_0_RX_BUF_PTR                       0x4808
+#define        GT64260_SDMA_0_SCRDP                            0x4810
+#define        GT64260_SDMA_0_TX_DESC                          0x4c00
+#define        GT64260_SDMA_0_SCTDP                            0x4c10
+#define        GT64260_SDMA_0_SFTDP                            0x4c14
+
+#define        GT64260_SDMA_1_SDC                              0x6000
+#define        GT64260_SDMA_1_SDCM                             0x6008
+#define        GT64260_SDMA_1_RX_DESC                          0x6800
+#define GT64260_SDMA_1_RX_BUF_PTR                       0x6808
+#define        GT64260_SDMA_1_SCRDP                            0x6810
+#define        GT64260_SDMA_1_TX_DESC                          0x6c00
+#define        GT64260_SDMA_1_SCTDP                            0x6c10
+#define        GT64260_SDMA_1_SFTDP                            0x6c14
+
+#define        GT64260_SDMA_INTR_CAUSE                         0xb800
+#define        GT64260_SDMA_INTR_MASK                          0xb880
+
+#define        GT64260_SDMA_DESC_CMDSTAT_PE                    (1<<0)
+#define        GT64260_SDMA_DESC_CMDSTAT_CDL                   (1<<1)
+#define        GT64260_SDMA_DESC_CMDSTAT_FR                    (1<<3)
+#define        GT64260_SDMA_DESC_CMDSTAT_OR                    (1<<6)
+#define        GT64260_SDMA_DESC_CMDSTAT_BR                    (1<<9)
+#define        GT64260_SDMA_DESC_CMDSTAT_MI                    (1<<10)
+#define        GT64260_SDMA_DESC_CMDSTAT_A                     (1<<11)
+#define        GT64260_SDMA_DESC_CMDSTAT_AM                    (1<<12)
+#define        GT64260_SDMA_DESC_CMDSTAT_CT                    (1<<13)
+#define        GT64260_SDMA_DESC_CMDSTAT_C                     (1<<14)
+#define        GT64260_SDMA_DESC_CMDSTAT_ES                    (1<<15)
+#define        GT64260_SDMA_DESC_CMDSTAT_L                     (1<<16)
+#define        GT64260_SDMA_DESC_CMDSTAT_F                     (1<<17)
+#define        GT64260_SDMA_DESC_CMDSTAT_P                     (1<<18)
+#define        GT64260_SDMA_DESC_CMDSTAT_EI                    (1<<23)
+#define        GT64260_SDMA_DESC_CMDSTAT_O                     (1<<31)
+
+#define        GT64260_SDMA_SDC_RFT                            (1<<0)
+#define        GT64260_SDMA_SDC_SFM                            (1<<1)
+#define        GT64260_SDMA_SDC_BLMR                           (1<<6)
+#define        GT64260_SDMA_SDC_BLMT                           (1<<7)
+#define        GT64260_SDMA_SDC_POVR                           (1<<8)
+#define        GT64260_SDMA_SDC_RIFB                           (1<<9)
+
+#define        GT64260_SDMA_SDCM_ERD                           (1<<7)
+#define        GT64260_SDMA_SDCM_AR                            (1<<15)
+#define        GT64260_SDMA_SDCM_STD                           (1<<16)
+#define        GT64260_SDMA_SDCM_TXD                           (1<<23)
+#define        GT64260_SDMA_SDCM_AT                            (1<<31)
+
+#define        GT64260_SDMA_0_CAUSE_RXBUF                      (1<<0)
+#define        GT64260_SDMA_0_CAUSE_RXERR                      (1<<1)
+#define        GT64260_SDMA_0_CAUSE_TXBUF                      (1<<2)
+#define        GT64260_SDMA_0_CAUSE_TXEND                      (1<<3)
+#define        GT64260_SDMA_1_CAUSE_RXBUF                      (1<<8)
+#define        GT64260_SDMA_1_CAUSE_RXERR                      (1<<9)
+#define        GT64260_SDMA_1_CAUSE_TXBUF                      (1<<10)
+#define        GT64260_SDMA_1_CAUSE_TXEND                      (1<<11)
+
+
+/*
+ *****************************************************************************
+ *
+ *     Baud Rate Generator Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_BRG_0_BCR                               0xb200
+#define        GT64260_BRG_0_BTR                               0xb204
+#define        GT64260_BRG_1_BCR                               0xb208
+#define        GT64260_BRG_1_BTR                               0xb20c
+#define        GT64260_BRG_2_BCR                               0xb210
+#define        GT64260_BRG_2_BTR                               0xb214
+
+#define        GT64260_BRG_INTR_CAUSE                          0xb834
+#define        GT64260_BRG_INTR_MASK                           0xb8b4
+
+
+/*
+ *****************************************************************************
+ *
+ *     Watchdog Timer Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_WDT_WDC                                 0xb410
+#define        GT64260_WDT_WDV                                 0xb414
+
+
+/*
+ *****************************************************************************
+ *
+ *      General Purpose Pins Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_GPP_IO_CNTL                             0xf100
+#define        GT64260_GPP_LEVEL_CNTL                          0xf110
+#define        GT64260_GPP_VALUE                               0xf104
+#define        GT64260_GPP_INTR_CAUSE                          0xf108
+#define        GT64260_GPP_INTR_MASK                           0xf10c
+
+
+/*
+ *****************************************************************************
+ *
+ *     Multi-Purpose Pins Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_MPP_CNTL_0                              0xf000
+#define        GT64260_MPP_CNTL_1                              0xf004
+#define        GT64260_MPP_CNTL_2                              0xf008
+#define        GT64260_MPP_CNTL_3                              0xf00c
+#define        GT64260_MPP_SERIAL_PORTS_MULTIPLEX              0xf010
+
+
+/*
+ *****************************************************************************
+ *
+ *     I2C Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+/* FIXME: fill in */
+
+
+/*
+ *****************************************************************************
+ *
+ *     Interrupt Controller Interface Registers
+ *
+ *****************************************************************************
+ */
+
+#define        GT64260_IC_MAIN_CAUSE_LO                        0x0c18
+#define        GT64260_IC_MAIN_CAUSE_HI                        0x0c68
+#define        GT64260_IC_CPU_INTR_MASK_LO                     0x0c1c
+#define        GT64260_IC_CPU_INTR_MASK_HI                     0x0c6c
+#define        GT64260_IC_CPU_SELECT_CAUSE                     0x0c70
+#define        GT64260_IC_PCI_0_INTR_MASK_LO                   0x0c24
+#define        GT64260_IC_PCI_0_INTR_MASK_HI                   0x0c64
+#define        GT64260_IC_PCI_0_SELECT_CAUSE                   0x0c74
+#define        GT64260_IC_PCI_1_INTR_MASK_LO                   0x0ca4
+#define        GT64260_IC_PCI_1_INTR_MASK_HI                   0x0ce4
+#define        GT64260_IC_PCI_1_SELECT_CAUSE                   0x0cf4
+#define        GT64260_IC_CPU_INT_0_MASK                       0x0e60
+#define        GT64260_IC_CPU_INT_1_MASK                       0x0e64
+#define        GT64260_IC_CPU_INT_2_MASK                       0x0e68
+#define        GT64260_IC_CPU_INT_3_MASK                       0x0e6c
+
+
+#endif /* __ASMPPC_GT64260_DEFS_H */
index 2717a60..a893418 100644 (file)
@@ -237,7 +237,7 @@ extern inline void * bus_to_virt(unsigned long address)
 {
 #ifndef CONFIG_APUS
         if (address == 0)
-               return 0;
+               return NULL;
         return (void *)(address - PCI_DRAM_OFFSET + KERNELBASE);
 #else
        return (void*) mm_ptov (address);
index 1236202..54dddea 100644 (file)
@@ -153,6 +153,79 @@ static __inline__ int irq_canonicalize(int irq)
        return irq;
 }
 
+#elif defined(CONFIG_CPM2) && defined(CONFIG_85xx)
+/* Now include the board configuration specific associations.
+*/
+#include <asm/mpc85xx.h>
+
+/* The MPC8560 openpic has  32 internal interrupts and 12 external
+ * interrupts.
+ *
+ * We are "flattening" the interrupt vectors of the cascaded CPM
+ * so that we can uniquely identify any interrupt source with a
+ * single integer.
+ */
+#define NR_CPM_INTS    64
+#define NR_EPIC_INTS   44
+#ifndef NR_8259_INTS
+#define NR_8259_INTS 0
+#endif
+#define NUM_8259_INTERRUPTS NR_8259_INTS
+
+#ifndef CPM_IRQ_OFFSET
+#define CPM_IRQ_OFFSET 0
+#endif
+
+#define NR_IRQS        (NR_EPIC_INTS + NR_CPM_INTS + NR_8259_INTS)
+
+/* These values must be zero-based and map 1:1 with the EPIC configuration.
+ * They are used throughout the 8560 I/O subsystem to generate
+ * interrupt masks, flags, and other control patterns.  This is why the
+ * current kernel assumption of the 8259 as the base controller is such
+ * a pain in the butt.
+ */
+
+#define        SIU_INT_ERROR           ((uint)0x00+CPM_IRQ_OFFSET)
+#define        SIU_INT_I2C             ((uint)0x01+CPM_IRQ_OFFSET)
+#define        SIU_INT_SPI             ((uint)0x02+CPM_IRQ_OFFSET)
+#define        SIU_INT_RISC            ((uint)0x03+CPM_IRQ_OFFSET)
+#define        SIU_INT_SMC1            ((uint)0x04+CPM_IRQ_OFFSET)
+#define        SIU_INT_SMC2            ((uint)0x05+CPM_IRQ_OFFSET)
+#define        SIU_INT_TIMER1          ((uint)0x0c+CPM_IRQ_OFFSET)
+#define        SIU_INT_TIMER2          ((uint)0x0d+CPM_IRQ_OFFSET)
+#define        SIU_INT_TIMER3          ((uint)0x0e+CPM_IRQ_OFFSET)
+#define        SIU_INT_TIMER4          ((uint)0x0f+CPM_IRQ_OFFSET)
+#define        SIU_INT_FCC1            ((uint)0x20+CPM_IRQ_OFFSET)
+#define        SIU_INT_FCC2            ((uint)0x21+CPM_IRQ_OFFSET)
+#define        SIU_INT_FCC3            ((uint)0x22+CPM_IRQ_OFFSET)
+#define        SIU_INT_MCC1            ((uint)0x24+CPM_IRQ_OFFSET)
+#define        SIU_INT_MCC2            ((uint)0x25+CPM_IRQ_OFFSET)
+#define        SIU_INT_SCC1            ((uint)0x28+CPM_IRQ_OFFSET)
+#define        SIU_INT_SCC2            ((uint)0x29+CPM_IRQ_OFFSET)
+#define        SIU_INT_SCC3            ((uint)0x2a+CPM_IRQ_OFFSET)
+#define        SIU_INT_SCC4            ((uint)0x2b+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC15            ((uint)0x30+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC14            ((uint)0x31+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC13            ((uint)0x32+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC12            ((uint)0x33+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC11            ((uint)0x34+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC10            ((uint)0x35+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC9             ((uint)0x36+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC8             ((uint)0x37+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC7             ((uint)0x38+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC6             ((uint)0x39+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC5             ((uint)0x3a+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC4             ((uint)0x3b+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC3             ((uint)0x3c+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC2             ((uint)0x3d+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC1             ((uint)0x3e+CPM_IRQ_OFFSET)
+#define        SIU_INT_PC0             ((uint)0x3f+CPM_IRQ_OFFSET)
+
+static __inline__ int irq_canonicalize(int irq)
+{
+       return irq;
+}
+
 #else /* CONFIG_40x + CONFIG_8xx */
 /*
  * this is the # irq's for all ppc arch's (pmac/chrp/prep)
index 1ad441d..9222fa6 100644 (file)
@@ -63,7 +63,7 @@ static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
 #define LAST_CONTEXT           255
 #define FIRST_CONTEXT          1
 
-#elif CONFIG_E500
+#elif defined(CONFIG_E500)
 #define NO_CONTEXT             256
 #define LAST_CONTEXT           255
 #define FIRST_CONTEXT          1
index 9b3d4f7..61b6a19 100644 (file)
@@ -24,8 +24,8 @@
 #include <platforms/sbs8260.h>
 #endif
 
-#ifdef CONFIG_RPX6
-#include <platforms/rpxsuper.h>
+#ifdef CONFIG_RPX8260
+#include <platforms/rpx8260.h>
 #endif
 
 #ifdef CONFIG_WILLOW
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
deleted file mode 100644 (file)
index 0aa5482..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * include/asm-ppc/mv64x60.h
- * 
- * Prototypes, etc. for the Marvell/Galileo MV64x60 host bridge routines.
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2001-2002 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#ifndef __ASMPPC_MV64x60_H
-#define __ASMPPC_MV64x60_H
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/pci.h>
-#include <linux/slab.h>
-#include <linux/config.h>
-
-#include <asm/byteorder.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mv64x60_defs.h>
-
-extern u8      mv64x60_pci_exclude_bridge;
-
-extern spinlock_t mv64x60_lock;
-extern spinlock_t mv64x60_rmw_lock;
-
-#ifndef        TRUE
-#define        TRUE    1
-#endif
-
-#ifndef        FALSE
-#define        FALSE   0
-#endif
-
-/* 32-bit Window table entry defines */
-#define        MV64x60_CPU2MEM_0_WIN                   0
-#define        MV64x60_CPU2MEM_1_WIN                   1
-#define        MV64x60_CPU2MEM_2_WIN                   2
-#define        MV64x60_CPU2MEM_3_WIN                   3
-#define        MV64x60_CPU2DEV_0_WIN                   4
-#define        MV64x60_CPU2DEV_1_WIN                   5
-#define        MV64x60_CPU2DEV_2_WIN                   6
-#define        MV64x60_CPU2DEV_3_WIN                   7
-#define        MV64x60_CPU2BOOT_WIN                    8
-#define        MV64x60_CPU2PCI0_IO_WIN                 9
-#define        MV64x60_CPU2PCI0_MEM_0_WIN              10
-#define        MV64x60_CPU2PCI0_MEM_1_WIN              11
-#define        MV64x60_CPU2PCI0_MEM_2_WIN              12
-#define        MV64x60_CPU2PCI0_MEM_3_WIN              13
-#define        MV64x60_CPU2PCI1_IO_WIN                 14
-#define        MV64x60_CPU2PCI1_MEM_0_WIN              15
-#define        MV64x60_CPU2PCI1_MEM_1_WIN              16
-#define        MV64x60_CPU2PCI1_MEM_2_WIN              17
-#define        MV64x60_CPU2PCI1_MEM_3_WIN              18
-#define        MV64x60_CPU2SRAM_WIN                    19
-#define        MV64x60_CPU2PCI0_IO_REMAP_WIN           20
-#define        MV64x60_CPU2PCI1_IO_REMAP_WIN           21
-#define        MV64x60_CPU_PROT_0_WIN                  22
-#define        MV64x60_CPU_PROT_1_WIN                  23
-#define        MV64x60_CPU_PROT_2_WIN                  24
-#define        MV64x60_CPU_PROT_3_WIN                  25
-#define        MV64x60_CPU_SNOOP_0_WIN                 26
-#define        MV64x60_CPU_SNOOP_1_WIN                 27
-#define        MV64x60_CPU_SNOOP_2_WIN                 28
-#define        MV64x60_CPU_SNOOP_3_WIN                 29
-#define        MV64x60_PCI02MEM_REMAP_0_WIN            30
-#define        MV64x60_PCI02MEM_REMAP_1_WIN            31
-#define        MV64x60_PCI02MEM_REMAP_2_WIN            32
-#define        MV64x60_PCI02MEM_REMAP_3_WIN            33
-#define        MV64x60_PCI12MEM_REMAP_0_WIN            34
-#define        MV64x60_PCI12MEM_REMAP_1_WIN            35
-#define        MV64x60_PCI12MEM_REMAP_2_WIN            36
-#define        MV64x60_PCI12MEM_REMAP_3_WIN            37
-
-#define        MV64x60_32BIT_WIN_COUNT                 38
-
-/* 64-bit Window table entry defines */
-#define        MV64x60_CPU2PCI0_MEM_0_REMAP_WIN        0
-#define        MV64x60_CPU2PCI0_MEM_1_REMAP_WIN        1
-#define        MV64x60_CPU2PCI0_MEM_2_REMAP_WIN        2
-#define        MV64x60_CPU2PCI0_MEM_3_REMAP_WIN        3
-#define        MV64x60_CPU2PCI1_MEM_0_REMAP_WIN        4
-#define        MV64x60_CPU2PCI1_MEM_1_REMAP_WIN        5
-#define        MV64x60_CPU2PCI1_MEM_2_REMAP_WIN        6
-#define        MV64x60_CPU2PCI1_MEM_3_REMAP_WIN        7
-#define        MV64x60_PCI02MEM_ACC_CNTL_0_WIN         8
-#define        MV64x60_PCI02MEM_ACC_CNTL_1_WIN         9
-#define        MV64x60_PCI02MEM_ACC_CNTL_2_WIN         10
-#define        MV64x60_PCI02MEM_ACC_CNTL_3_WIN         11
-#define        MV64x60_PCI12MEM_ACC_CNTL_0_WIN         12
-#define        MV64x60_PCI12MEM_ACC_CNTL_1_WIN         13
-#define        MV64x60_PCI12MEM_ACC_CNTL_2_WIN         14
-#define        MV64x60_PCI12MEM_ACC_CNTL_3_WIN         15
-#define        MV64x60_PCI02MEM_SNOOP_0_WIN            16
-#define        MV64x60_PCI02MEM_SNOOP_1_WIN            17
-#define        MV64x60_PCI02MEM_SNOOP_2_WIN            18
-#define        MV64x60_PCI02MEM_SNOOP_3_WIN            19
-#define        MV64x60_PCI12MEM_SNOOP_0_WIN            20
-#define        MV64x60_PCI12MEM_SNOOP_1_WIN            21
-#define        MV64x60_PCI12MEM_SNOOP_2_WIN            22
-#define        MV64x60_PCI12MEM_SNOOP_3_WIN            23
-
-#define        MV64x60_64BIT_WIN_COUNT                 24
-
-
-/*
- * Define a structure that's used to pass in config information to the
- * core routines.
- */
-typedef struct {
-       u32     cpu_base;
-       u32     pci_base_hi;
-       u32     pci_base_lo;
-       u32     size;
-       u32     swap;
-} mv64x60_pci_window_t;
-
-typedef        struct {
-       u8      enable_bus;     /* allow access to this PCI bus? */
-       u8      enumerate_bus;  /* enumerate devices on this bus? */
-
-       mv64x60_pci_window_t    pci_io;
-       mv64x60_pci_window_t    pci_mem[3];
-
-       u32     acc_cntl_options[MV64x60_CPU2MEM_WINDOWS];
-       u32     snoop_options[MV64x60_CPU2MEM_WINDOWS];
-       u16     pci_cmd_bits;
-       u16     latency_timer;
-} mv64x60_pci_info_t;
-
-typedef struct {
-       u32     phys_reg_base;
-
-       u32     window_preserve_mask_32;
-       u32     window_preserve_mask_64;
-
-       u32     base_irq;       /* Starting irq # for this intr ctlr */
-       int     ((*map_irq)(struct pci_dev *, unsigned char, unsigned char));
-
-       u32     cpu_prot_options[MV64x60_CPU2MEM_WINDOWS];
-       u32     cpu_snoop_options[MV64x60_CPU2MEM_WINDOWS];
-
-       mv64x60_pci_info_t      pci_0;
-       mv64x60_pci_info_t      pci_1;
-} mv64x60_setup_info_t;
-
-/*
- * Define the 'handle' struct that will be passed between the 64x60 core
- * code and the platform-specific code that will use it.  The handle
- * will contain pointers to chip-specific routines & information.
- */
-typedef struct {
-       u32     base_reg;
-       u32     size_reg;
-       u8      base_bits;
-       u8      size_bits;
-       u32     (*get_from_field)(u32 val, u32 num_bits);
-       u32     (*map_to_field)(u32 val, u32 num_bits);
-       u32     extra;
-} mv64x60_32bit_window_t;
-
-typedef struct {
-       u32     base_hi_reg;
-       u32     base_lo_reg;
-       u32     size_reg;
-       u8      base_lo_bits;
-       u8      size_bits;
-       u32     (*get_from_field)(u32 val, u32 num_bits);
-       u32     (*map_to_field)(u32 val, u32 num_bits);
-       u32     extra;
-} mv64x60_64bit_window_t;
-
-typedef        struct mv64x60_handle   mv64x60_handle_t;
-
-typedef struct {
-       u32     (*translate_size)(u32 base, u32 size, u32 num_bits);
-       u32     (*untranslate_size)(u32 base, u32 size, u32 num_bits);
-       void    (*set_pci2mem_window)(struct pci_controller *hose, u32 window,
-                       u32 base);
-       u32     (*is_enabled_32bit)(mv64x60_handle_t *bh, u32 window);
-       void    (*enable_window_32bit)(mv64x60_handle_t *bh, u32 window);
-       void    (*disable_window_32bit)(mv64x60_handle_t *bh, u32 window);
-       void    (*enable_window_64bit)(mv64x60_handle_t *bh, u32 window);
-       void    (*disable_window_64bit)(mv64x60_handle_t *bh, u32 window);
-       void    (*disable_all_windows)(mv64x60_handle_t *bh,
-                                      mv64x60_setup_info_t *si);
-       void    (*chip_specific_init)(mv64x60_handle_t *bh,
-                                     mv64x60_setup_info_t *si);
-
-       mv64x60_32bit_window_t  *window_tab_32bit;
-       mv64x60_64bit_window_t  *window_tab_64bit;
-} mv64x60_chip_info_t;
-
-struct mv64x60_handle {
-       u32     type;           /* type of bridge */
-       u32     v_base;         /* virtual base addr of bridge regs */
-       u32     p_base;         /* physical base addr of bridge regs */
-       u32     base_irq;       /* Base irq # for intrs on this intr cltr */
-
-       u32     io_base_a;      /* vaddr of pci 0's I/O space */
-       u32     io_base_b;      /* vaddr of pci 1's I/O space */
-
-       struct pci_controller   *hose_a;
-       struct pci_controller   *hose_b;
-
-       mv64x60_chip_info_t     *ci;    /* chip/bridge-specific info */
-};
-
-
-/* Define I/O routines for accessing registers on the 64x60 bridge. */
-extern inline void
-mv64x60_write(mv64x60_handle_t *bh, u32 offset, u32 val) {
-       out_le32((volatile u32 *)(bh->v_base + offset), val);
-}
-
-extern inline u32
-mv64x60_read(mv64x60_handle_t *bh, u32 offset) {
-       return in_le32((volatile u32 *)(bh->v_base + offset));
-}
-
-extern inline void
-mv64x60_modify(mv64x60_handle_t *bh, u32 offs, u32 data, u32 mask)
-{
-       uint32_t reg;
-       unsigned long flags;
-
-       spin_lock_irqsave(&mv64x60_rmw_lock, flags);
-       reg = mv64x60_read(bh, offs) & (~mask); /* zero any bits we care about*/
-       reg |= data & mask; /* set bits from the data */
-       mv64x60_write(bh, offs, reg);
-       spin_unlock_irqrestore(&mv64x60_rmw_lock, flags);
-}
-
-#define        mv64x60_set_bits(bh, offs, bits) mv64x60_modify(bh, offs, ~0, bits) 
-#define        mv64x60_clr_bits(bh, offs, bits) mv64x60_modify(bh, offs, 0, bits)
-
-
-/* Externally visible function prototypes */
-int mv64x60_init(mv64x60_handle_t *bh, mv64x60_setup_info_t *si);
-u32 mv64x60_get_mem_size(u32 bridge_base, u32 chip_type);
-void mv64x60_get_32bit_window(mv64x60_handle_t *bh, u32 window,
-                                       u32 *base, u32 *size);
-void mv64x60_set_32bit_window(mv64x60_handle_t *bh, u32 window, u32 base,
-                                       u32 size, u32 other_bits);
-void mv64x60_get_64bit_window(mv64x60_handle_t *bh, u32 window, u32 *base_hi,
-                                       u32 *base_lo, u32 *size);
-void mv64x60_set_64bit_window(mv64x60_handle_t *bh, u32 window, u32 base_hi,
-                                       u32 base_lo, u32 size, u32 other_bits);
-
-
-void gt64260_init_irq(void);
-int gt64260_get_irq(struct pt_regs *regs);
-
-/*
- * OCP Related Definitions
- */
-typedef struct {
-       u8      mirror_regs;
-       u8      cache_mgmt;
-       u8      max_idle;
-       int     default_baud;
-       int     default_bits;
-       int     default_parity;
-       int     default_flow;
-       u32     chr_1_val;
-       u32     chr_2_val;
-       u32     chr_10_val;
-       u32     mpcr_val;
-       u32     mrr_val;
-       u32     rcrr_val;
-       u32     tcrr_val;
-       u32     intr_mask_val;
-       u32     bcr_val;
-       u32     sdma_irq;
-       u8      brg_can_tune;
-       u8      brg_clk_src;
-       u32     brg_clk_freq;
-} mv64x60_ocp_mpsc_data_t;
-
-#define MV64x60_OCP_SYSFS_MPSC_DATA()                                  \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, mirror_regs)    \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, cache_mgmt)     \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, max_idle)       \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, default_baud)   \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, default_bits)   \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%c\n", mpsc, default_parity) \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%c\n", mpsc, default_flow)   \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, chr_1_val)    \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, chr_2_val)    \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, chr_10_val)   \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, mpcr_val)     \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, mrr_val)      \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, rcrr_val)     \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, tcrr_val)     \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, intr_mask_val)        \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "0x%x\n", mpsc, bcr_val)      \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, sdma_irq)       \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, brg_can_tune)   \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, brg_clk_src)    \
-OCP_SYSFS_ADDTL(mv64x60_ocp_mpsc_data_t, "%d\n", mpsc, brg_clk_freq)   \
-                                                                       \
-void                                                                   \
-mv64x60_ocp_show_mpsc(struct device *dev)                              \
-{                                                                      \
-       device_create_file(dev, &dev_attr_mpsc_mirror_regs);            \
-       device_create_file(dev, &dev_attr_mpsc_cache_mgmt);             \
-       device_create_file(dev, &dev_attr_mpsc_max_idle);               \
-       device_create_file(dev, &dev_attr_mpsc_default_baud);           \
-       device_create_file(dev, &dev_attr_mpsc_default_bits);           \
-       device_create_file(dev, &dev_attr_mpsc_default_parity);         \
-       device_create_file(dev, &dev_attr_mpsc_default_flow);           \
-       device_create_file(dev, &dev_attr_mpsc_chr_1_val);              \
-       device_create_file(dev, &dev_attr_mpsc_chr_2_val);              \
-       device_create_file(dev, &dev_attr_mpsc_chr_10_val);             \
-       device_create_file(dev, &dev_attr_mpsc_mpcr_val);               \
-       device_create_file(dev, &dev_attr_mpsc_mrr_val);                \
-       device_create_file(dev, &dev_attr_mpsc_rcrr_val);               \
-       device_create_file(dev, &dev_attr_mpsc_tcrr_val);               \
-       device_create_file(dev, &dev_attr_mpsc_intr_mask_val);          \
-       device_create_file(dev, &dev_attr_mpsc_bcr_val);                \
-       device_create_file(dev, &dev_attr_mpsc_sdma_irq);               \
-       device_create_file(dev, &dev_attr_mpsc_brg_can_tune);           \
-       device_create_file(dev, &dev_attr_mpsc_brg_clk_src);            \
-       device_create_file(dev, &dev_attr_mpsc_brg_clk_freq);           \
-}
-
-#endif /* __ASMPPC_MV64x60_H */
diff --git a/include/asm-ppc/mv64x60_defs.h b/include/asm-ppc/mv64x60_defs.h
deleted file mode 100644 (file)
index 6f7899d..0000000
+++ /dev/null
@@ -1,996 +0,0 @@
-/*
- * include/asm-ppc/gt64260_defs.h
- * 
- * Register definitions for the Marvell/Galileo GT64260, MV64360, etc.
- * host bridges.
- *
- * Author: Mark A. Greer <mgreer@mvista.com>
- *
- * 2001-2002 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- */
-#ifndef __ASMPPC_MV64x60_DEFS_H
-#define __ASMPPC_MV64x60_DEFS_H
-
-/*
- * Define the Marvell bridges that are supported
- */
-#define        MV64x60_TYPE_INVALID            0
-#define        MV64x60_TYPE_GT64260A           1
-#define        MV64x60_TYPE_GT64260B           2
-#define        MV64x60_TYPE_MV64360            3
-#define        MV64x60_TYPE_MV64361            4
-#define        MV64x60_TYPE_MV64362            5
-#define        MV64x60_TYPE_MV64460            6
-
-
-/* Revisions of each supported chip */
-#define        GT64260_REV_A                   0x10
-#define        GT64260_REV_B                   0x20
-#define        MV64360                         0x01
-#define        MV64460                         0x01
-
-/* Minimum window size supported by 64260 is 1MB */
-#define GT64260_WINDOW_SIZE_MIN                0x00100000
-#define MV64360_WINDOW_SIZE_MIN                0x00010000
-
-/* IRQ's for embedded controllers */
-#define        MV64x60_IRQ_DEV                 1
-#define        MV64x60_IRQ_CPU_ERR             3
-#define        MV64x60_IRQ_TIMER_0_1           8
-#define        MV64x60_IRQ_TIMER_2_3           9
-#define        MV64x60_IRQ_TIMER_4_5           10
-#define        MV64x60_IRQ_TIMER_6_7           11
-#define        MV64x60_IRQ_ETH_0               32
-#define        MV64x60_IRQ_ETH_1               33
-#define        MV64x60_IRQ_ETH_2               34
-#define        MV64x60_IRQ_SDMA_0              36
-#define        MV64x60_IRQ_I2C                 37
-#define        MV64x60_IRQ_SDMA_1              38
-#define        MV64x60_IRQ_BRG                 39
-#define        MV64x60_IRQ_MPSC_0              40
-#define        MV64x60_IRQ_MPSC_1              42
-#define        MV64x60_IRQ_COMM                43
-
-#define        MV64360_IRQ_PCI0                12
-#define        MV64360_IRQ_SRAM_PAR_ERR        13
-#define        MV64360_IRQ_PCI1                16
-
-/* Offsets for register blocks */
-#define        MV64x60_MPSC_0_OFFSET           0x8000
-#define        MV64x60_MPSC_1_OFFSET           0x9000
-#define        MV64x60_MPSC_ROUTING_OFFSET     0xb400
-#define        MV64x60_SDMA_0_OFFSET           0x4000
-#define        MV64x60_SDMA_1_OFFSET           0x6000
-#define        MV64x60_SDMA_INTR_OFFSET        0xb800
-#define        MV64x60_BRG_0_OFFSET            0xb200
-#define        MV64x60_BRG_1_OFFSET            0xb208
-
-/*
- *****************************************************************************
- *
- *     CPU Interface Registers
- *
- *****************************************************************************
- */
-
-/* CPU physical address of 64260's registers */
-#define MV64x60_INTERNAL_SPACE_DECODE                  0x0068
-#define MV64x60_INTERNAL_SPACE_SIZE                    0x10000
-#define MV64x60_INTERNAL_SPACE_DEFAULT_ADDR            0x14000000
-
-#define        MV64360_CPU_BAR_ENABLE                          0x0278
-
-/* CPU Memory Controller Window Registers (4 windows) */
-#define        MV64x60_CPU2MEM_WINDOWS                         4
-
-#define        MV64x60_CPU2MEM_0_BASE                          0x0008
-#define        MV64x60_CPU2MEM_0_SIZE                          0x0010
-#define        MV64x60_CPU2MEM_1_BASE                          0x0208
-#define        MV64x60_CPU2MEM_1_SIZE                          0x0210
-#define        MV64x60_CPU2MEM_2_BASE                          0x0018
-#define        MV64x60_CPU2MEM_2_SIZE                          0x0020
-#define        MV64x60_CPU2MEM_3_BASE                          0x0218
-#define        MV64x60_CPU2MEM_3_SIZE                          0x0220
-
-/* CPU Device Controller Window Registers (4 windows) */
-#define        MV64x60_CPU2DEV_CS_WINDOWS                      4
-
-#define        MV64x60_CPU2DEV_0_BASE                          0x0028
-#define        MV64x60_CPU2DEV_0_SIZE                          0x0030
-#define        MV64x60_CPU2DEV_1_BASE                          0x0228
-#define        MV64x60_CPU2DEV_1_SIZE                          0x0230
-#define        MV64x60_CPU2DEV_2_BASE                          0x0248
-#define        MV64x60_CPU2DEV_2_SIZE                          0x0250
-#define        MV64x60_CPU2DEV_3_BASE                          0x0038
-#define        MV64x60_CPU2DEV_3_SIZE                          0x0040
-
-#define        MV64x60_CPU2BOOT_0_BASE                         0x0238
-#define        MV64x60_CPU2BOOT_0_SIZE                         0x0240
-
-/* CPU Windows to PCI space (2 PCI buses each w/ 1 I/O & 4 MEM windows) */
-#define        MV64x60_PCI_BUSES                               2
-#define        MV64x60_PCI_IO_WINDOWS_PER_BUS                  1
-#define        MV64x60_PCI_MEM_WINDOWS_PER_BUS                 4
-
-#define        MV64x60_CPU2PCI_SWAP_BYTE                       0x00000000
-#define        MV64x60_CPU2PCI_SWAP_NONE                       0x01000000
-#define        MV64x60_CPU2PCI_SWAP_BYTE_WORD                  0x02000000
-#define        MV64x60_CPU2PCI_SWAP_WORD                       0x03000000
-
-#define        MV64x60_CPU2PCI_MEM_REQ64                       (1<<27)
-
-#define        MV64x60_CPU2PCI0_IO_BASE                        0x0048
-#define        MV64x60_CPU2PCI0_IO_SIZE                        0x0050
-#define        MV64x60_CPU2PCI0_MEM_0_BASE                     0x0058
-#define        MV64x60_CPU2PCI0_MEM_0_SIZE                     0x0060
-#define        MV64x60_CPU2PCI0_MEM_1_BASE                     0x0080
-#define        MV64x60_CPU2PCI0_MEM_1_SIZE                     0x0088
-#define        MV64x60_CPU2PCI0_MEM_2_BASE                     0x0258
-#define        MV64x60_CPU2PCI0_MEM_2_SIZE                     0x0260
-#define        MV64x60_CPU2PCI0_MEM_3_BASE                     0x0280
-#define        MV64x60_CPU2PCI0_MEM_3_SIZE                     0x0288
-
-#define        MV64x60_CPU2PCI0_IO_REMAP                       0x00f0
-#define        MV64x60_CPU2PCI0_MEM_0_REMAP_LO                 0x00f8
-#define        MV64x60_CPU2PCI0_MEM_0_REMAP_HI                 0x0320
-#define        MV64x60_CPU2PCI0_MEM_1_REMAP_LO                 0x0100
-#define        MV64x60_CPU2PCI0_MEM_1_REMAP_HI                 0x0328
-#define        MV64x60_CPU2PCI0_MEM_2_REMAP_LO                 0x02f8
-#define        MV64x60_CPU2PCI0_MEM_2_REMAP_HI                 0x0330
-#define        MV64x60_CPU2PCI0_MEM_3_REMAP_LO                 0x0300
-#define        MV64x60_CPU2PCI0_MEM_3_REMAP_HI                 0x0338
-
-#define        MV64x60_CPU2PCI1_IO_BASE                        0x0090
-#define        MV64x60_CPU2PCI1_IO_SIZE                        0x0098
-#define        MV64x60_CPU2PCI1_MEM_0_BASE                     0x00a0
-#define        MV64x60_CPU2PCI1_MEM_0_SIZE                     0x00a8
-#define        MV64x60_CPU2PCI1_MEM_1_BASE                     0x00b0
-#define        MV64x60_CPU2PCI1_MEM_1_SIZE                     0x00b8
-#define        MV64x60_CPU2PCI1_MEM_2_BASE                     0x02a0
-#define        MV64x60_CPU2PCI1_MEM_2_SIZE                     0x02a8
-#define        MV64x60_CPU2PCI1_MEM_3_BASE                     0x02b0
-#define        MV64x60_CPU2PCI1_MEM_3_SIZE                     0x02b8
-
-#define        MV64360_CPU2SRAM_BASE                           0x0268
-
-#define        MV64x60_CPU2PCI1_IO_REMAP                       0x0108
-#define        MV64x60_CPU2PCI1_MEM_0_REMAP_LO                 0x0110
-#define        MV64x60_CPU2PCI1_MEM_0_REMAP_HI                 0x0340
-#define        MV64x60_CPU2PCI1_MEM_1_REMAP_LO                 0x0118
-#define        MV64x60_CPU2PCI1_MEM_1_REMAP_HI                 0x0348
-#define        MV64x60_CPU2PCI1_MEM_2_REMAP_LO                 0x0310
-#define        MV64x60_CPU2PCI1_MEM_2_REMAP_HI                 0x0350
-#define        MV64x60_CPU2PCI1_MEM_3_REMAP_LO                 0x0318
-#define        MV64x60_CPU2PCI1_MEM_3_REMAP_HI                 0x0358
-
-/* CPU Control Registers */
-#define MV64x60_CPU_CONFIG                             0x0000
-#define MV64x60_CPU_MODE                               0x0120
-#define MV64x60_CPU_MASTER_CNTL                                0x0160
-#define MV64x60_CPU_XBAR_CNTL_LO                       0x0150
-#define MV64x60_CPU_XBAR_CNTL_HI                       0x0158
-#define MV64x60_CPU_XBAR_TO                            0x0168
-
-#define GT64260_CPU_RR_XBAR_CNTL_LO                    0x0170
-#define GT64260_CPU_RR_XBAR_CNTL_HI                    0x0178
-
-#define MV64360_CPU_PADS_CALIBRATION                   0x03b4
-#define MV64360_CPU_RESET_SAMPLE_LO                    0x03c4
-#define MV64360_CPU_RESET_SAMPLE_HI                    0x03d4
-
-/* SMP Register Map */
-#define MV64360_WHO_AM_I                               0x0200
-#define MV64360_CPU0_DOORBELL                          0x0214
-#define MV64360_CPU0_DOORBELL_CLR                      0x021c
-#define MV64360_CPU0_DOORBELL_MASK                     0x0234
-#define MV64360_CPU1_DOORBELL                          0x0224
-#define MV64360_CPU1_DOORBELL_CLR                      0x022c
-#define MV64360_CPU1_DOORBELL_MASK                     0x023c
-#define MV64360_CPUx_DOORBELL(x)                       (0x0214 + ((x)*0x10))
-#define MV64360_CPUx_DOORBELL_CLR(x)                   (0x021c + ((x)*0x10))
-#define MV64360_CPUx_DOORBELL_MASK(x)                  (0x0234 + ((x)*0x08))
-#define MV64360_SEMAPHORE_0                            0x0244
-#define MV64360_SEMAPHORE_1                            0x024c
-#define MV64360_SEMAPHORE_2                            0x0254
-#define MV64360_SEMAPHORE_3                            0x025c
-#define MV64360_SEMAPHORE_4                            0x0264
-#define MV64360_SEMAPHORE_5                            0x026c
-#define MV64360_SEMAPHORE_6                            0x0274
-#define MV64360_SEMAPHORE_7                            0x027c
-
-/* CPU Sync Barrier Registers */
-#define GT64260_CPU_SYNC_BARRIER_PCI0                  0x00c0
-#define GT64260_CPU_SYNC_BARRIER_PCI1                  0x00c8
-
-#define MV64360_CPU0_SYNC_BARRIER_TRIG                 0x00c0
-#define MV64360_CPU0_SYNC_BARRIER_VIRT                 0x00c8
-#define MV64360_CPU1_SYNC_BARRIER_TRIG                 0x00d0
-#define MV64360_CPU1_SYNC_BARRIER_VIRT                 0x00d8
-
-/* CPU Deadlock and Ordering registers (Rev B part only) */
-#define GT64260_CPU_DEADLOCK_ORDERING                   0x02d0
-#define GT64260_CPU_WB_PRIORITY_BUFFER_DEPTH            0x02d8
-#define GT64260_CPU_COUNTERS_SYNC_BARRIER_ATTRIBUTE     0x02e0
-
-/* CPU Access Protection Registers (gt64260 realy has 8 but don't need) */
-#define        MV64x260_CPU_PROT_WINDOWS                       4
-
-#define        GT64260_CPU_PROT_ACCPROTECT                     (1<<16)
-#define        GT64260_CPU_PROT_WRPROTECT                      (1<<17)
-#define        GT64260_CPU_PROT_CACHEPROTECT                   (1<<18)
-
-#define        MV64360_CPU_PROT_ACCPROTECT                     (1<<20)
-#define        MV64360_CPU_PROT_WRPROTECT                      (1<<21)
-#define        MV64360_CPU_PROT_CACHEPROTECT                   (1<<22)
-#define        MV64360_CPU_PROT_WIN_ENABLE                     (1<<31)
-
-#define MV64x60_CPU_PROT_BASE_0                                0x0180
-#define MV64x60_CPU_PROT_SIZE_0                                0x0188
-#define MV64x60_CPU_PROT_BASE_1                                0x0190
-#define MV64x60_CPU_PROT_SIZE_1                                0x0198
-#define MV64x60_CPU_PROT_BASE_2                                0x01a0
-#define MV64x60_CPU_PROT_SIZE_2                                0x01a8
-#define MV64x60_CPU_PROT_BASE_3                                0x01b0
-#define MV64x60_CPU_PROT_SIZE_3                                0x01b8
-
-#define GT64260_CPU_PROT_BASE_4                                0x01c0
-#define GT64260_CPU_PROT_SIZE_4                                0x01c8
-#define GT64260_CPU_PROT_BASE_5                                0x01d0
-#define GT64260_CPU_PROT_SIZE_5                                0x01d8
-#define GT64260_CPU_PROT_BASE_6                                0x01e0
-#define GT64260_CPU_PROT_SIZE_6                                0x01e8
-#define GT64260_CPU_PROT_BASE_7                                0x01f0
-#define GT64260_CPU_PROT_SIZE_7                                0x01f8
-
-/* CPU Snoop Control Registers (64260 only) */
-#define        GT64260_CPU_SNOOP_WINDOWS                       4
-
-#define        GT64260_CPU_SNOOP_NONE                          0x00000000
-#define        GT64260_CPU_SNOOP_WT                            0x00010000
-#define        GT64260_CPU_SNOOP_WB                            0x00020000
-#define        GT64260_CPU_SNOOP_MASK                          0x00030000
-#define        GT64260_CPU_SNOOP_ALL_BITS                      GT64260_CPU_SNOOP_MASK
-
-#define GT64260_CPU_SNOOP_BASE_0                       0x0380
-#define GT64260_CPU_SNOOP_SIZE_0                       0x0388
-#define GT64260_CPU_SNOOP_BASE_1                       0x0390
-#define GT64260_CPU_SNOOP_SIZE_1                       0x0398
-#define GT64260_CPU_SNOOP_BASE_2                       0x03a0
-#define GT64260_CPU_SNOOP_SIZE_2                       0x03a8
-#define GT64260_CPU_SNOOP_BASE_3                       0x03b0
-#define GT64260_CPU_SNOOP_SIZE_3                       0x03b8
-
-/* CPU Error Report Registers */
-#define MV64x60_CPU_ERR_ADDR_LO                                0x0070
-#define MV64x60_CPU_ERR_ADDR_HI                                0x0078
-#define MV64x60_CPU_ERR_DATA_LO                                0x0128
-#define MV64x60_CPU_ERR_DATA_HI                                0x0130
-#define MV64x60_CPU_ERR_PARITY                         0x0138
-#define MV64x60_CPU_ERR_CAUSE                          0x0140
-#define MV64x60_CPU_ERR_MASK                           0x0148
-
-/*
- *****************************************************************************
- *
- *     SRAM Cotnroller Registers
- *
- *****************************************************************************
- */
-
-#define        MV64360_SRAM_CONFIG                             0x0380
-#define        MV64360_SRAM_TEST_MODE                          0x03f4
-#define        MV64360_SRAM_ERR_CAUSE                          0x0388
-#define        MV64360_SRAM_ERR_ADDR_LO                        0x0390
-#define        MV64360_SRAM_ERR_ADDR_HI                        0x03f8
-#define        MV64360_SRAM_ERR_DATA_LO                        0x0398
-#define        MV64360_SRAM_ERR_DATA_HI                        0x03a0
-#define        MV64360_SRAM_ERR_PARITY                         0x03a8
-
-
-/*
- *****************************************************************************
- *
- *     SDRAM Cotnroller Registers
- *
- *****************************************************************************
- */
-
-/* SDRAM Config Registers (64260) */
-#define        GT64260_SDRAM_CONFIG                            0x0448
-
-/* SDRAM Error Report Registers (64260) */
-#define        GT64260_SDRAM_ERR_DATA_LO                       0x0484
-#define        GT64260_SDRAM_ERR_DATA_HI                       0x0480
-#define        GT64260_SDRAM_ERR_ADDR                          0x0490
-#define        GT64260_SDRAM_ERR_ECC_RCVD                      0x0488
-#define        GT64260_SDRAM_ERR_ECC_CALC                      0x048c
-#define        GT64260_SDRAM_ERR_ECC_CNTL                      0x0494
-#define        GT64260_SDRAM_ERR_ECC_ERR_CNT                   0x0498
-
-/* SDRAM Config Registers (64360) */
-#define        MV64360_SDRAM_CONFIG                            0x1400
-
-/* SDRAM Error Report Registers (64360) */
-#define        MV64360_SDRAM_ERR_DATA_LO                       0x1444
-#define        MV64360_SDRAM_ERR_DATA_HI                       0x1440
-#define        MV64360_SDRAM_ERR_ADDR                          0x1450
-#define        MV64360_SDRAM_ERR_ECC_RCVD                      0x1448
-#define        MV64360_SDRAM_ERR_ECC_CALC                      0x144c
-#define        MV64360_SDRAM_ERR_ECC_CNTL                      0x1454
-#define        MV64360_SDRAM_ERR_ECC_ERR_CNT                   0x1458
-
-
-/*
- *****************************************************************************
- *
- *     Device/BOOT Cotnroller Registers
- *
- *****************************************************************************
- */
-
-/* Device Control Registers */
-#define        MV64x60_DEV_BANK_PARAMS_0                       0x045c
-#define        MV64x60_DEV_BANK_PARAMS_1                       0x0460
-#define        MV64x60_DEV_BANK_PARAMS_2                       0x0464
-#define        MV64x60_DEV_BANK_PARAMS_3                       0x0468
-#define        MV64x60_DEV_BOOT_PARAMS                         0x046c
-#define        MV64x60_DEV_IF_CNTL                             0x04c0
-#define        MV64x60_DEV_IF_XBAR_CNTL_LO                     0x04c8
-#define        MV64x60_DEV_IF_XBAR_CNTL_HI                     0x04cc
-#define        MV64x60_DEV_IF_XBAR_CNTL_TO                     0x04c4
-
-/* Device Interrupt Registers */
-#define        MV64x60_DEV_INTR_CAUSE                          0x04d0
-#define        MV64x60_DEV_INTR_MASK                           0x04d4
-#define        MV64x60_DEV_INTR_ERR_ADDR                       0x04d8
-
-#define        MV64360_DEV_INTR_ERR_DATA                       0x04dc
-#define        MV64360_DEV_INTR_ERR_PAR                        0x04e0
-
-
-/*
- *****************************************************************************
- *
- *     PCI Bridge Interface Registers
- *
- *****************************************************************************
- */
-
-/* PCI Configuration Access Registers */
-#define        MV64x60_PCI0_CONFIG_ADDR                        0x0cf8
-#define        MV64x60_PCI0_CONFIG_DATA                        0x0cfc
-#define        MV64x60_PCI0_IACK                               0x0c34
-
-#define        MV64x60_PCI1_CONFIG_ADDR                        0x0c78
-#define        MV64x60_PCI1_CONFIG_DATA                        0x0c7c
-#define        MV64x60_PCI1_IACK                               0x0cb4
-
-/* PCI Control Registers */
-#define        MV64x60_PCI0_CMD                                0x0c00
-#define        MV64x60_PCI0_MODE                               0x0d00
-#define        MV64x60_PCI0_TO_RETRY                           0x0c04
-#define        MV64x60_PCI0_RD_BUF_DISCARD_TIMER               0x0d04
-#define        MV64x60_PCI0_MSI_TRIGGER_TIMER                  0x0c38
-#define        MV64x60_PCI0_ARBITER_CNTL                       0x1d00
-#define        MV64x60_PCI0_XBAR_CNTL_LO                       0x1d08
-#define        MV64x60_PCI0_XBAR_CNTL_HI                       0x1d0c
-#define        MV64x60_PCI0_XBAR_CNTL_TO                       0x1d04
-#define        MV64x60_PCI0_RD_RESP_XBAR_CNTL_LO               0x1d18
-#define        MV64x60_PCI0_RD_RESP_XBAR_CNTL_HI               0x1d1c
-#define        MV64x60_PCI0_SYNC_BARRIER                       0x1d10
-#define        MV64x60_PCI0_P2P_CONFIG                         0x1d14
-#define        MV64x60_PCI0_INTR_MASK
-
-#define        GT64260_PCI0_P2P_SWAP_CNTL                      0x1d54
-
-#define        MV64x60_PCI1_CMD                                0x0c80
-#define        MV64x60_PCI1_MODE                               0x0d80
-#define        MV64x60_PCI1_TO_RETRY                           0x0c84
-#define        MV64x60_PCI1_RD_BUF_DISCARD_TIMER               0x0d84
-#define        MV64x60_PCI1_MSI_TRIGGER_TIMER                  0x0cb8
-#define        MV64x60_PCI1_ARBITER_CNTL                       0x1d80
-#define        MV64x60_PCI1_XBAR_CNTL_LO                       0x1d88
-#define        MV64x60_PCI1_XBAR_CNTL_HI                       0x1d8c
-#define        MV64x60_PCI1_XBAR_CNTL_TO                       0x1d84
-#define        MV64x60_PCI1_RD_RESP_XBAR_CNTL_LO               0x1d98
-#define        MV64x60_PCI1_RD_RESP_XBAR_CNTL_HI               0x1d9c
-#define        MV64x60_PCI1_SYNC_BARRIER                       0x1d90
-#define        MV64x60_PCI1_P2P_CONFIG                         0x1d94
-
-#define        GT64260_PCI1_P2P_SWAP_CNTL                      0x1dd4
-
-/* PCI Access Control Regions Registers */
-#define        GT64260_PCI_ACC_CNTL_PREFETCHEN                 (1<<12)
-#define        GT64260_PCI_ACC_CNTL_DREADEN                    (1<<13)
-#define        GT64260_PCI_ACC_CNTL_RDPREFETCH                 (1<<16)
-#define        GT64260_PCI_ACC_CNTL_RDLINEPREFETCH             (1<<17)
-#define        GT64260_PCI_ACC_CNTL_RDMULPREFETCH              (1<<18)
-#define        GT64260_PCI_ACC_CNTL_MBURST_32_BTYES            0x00000000
-#define        GT64260_PCI_ACC_CNTL_MBURST_64_BYTES            0x00100000
-#define        GT64260_PCI_ACC_CNTL_MBURST_128_BYTES           0x00200000
-#define        GT64260_PCI_ACC_CNTL_MBURST_MASK                0x00300000
-#define        GT64260_PCI_ACC_CNTL_SWAP_BYTE                  0x00000000
-#define        GT64260_PCI_ACC_CNTL_SWAP_NONE                  0x01000000
-#define        GT64260_PCI_ACC_CNTL_SWAP_BYTE_WORD             0x02000000
-#define        GT64260_PCI_ACC_CNTL_SWAP_WORD                  0x03000000
-#define        GT64260_PCI_ACC_CNTL_SWAP_MASK                  0x03000000
-#define        GT64260_PCI_ACC_CNTL_ACCPROT                    (1<<28)
-#define        GT64260_PCI_ACC_CNTL_WRPROT                     (1<<29)
-
-#define        GT64260_PCI_ACC_CNTL_ALL_BITS   (GT64260_PCI_ACC_CNTL_PREFETCHEN |    \
-                                        GT64260_PCI_ACC_CNTL_DREADEN |       \
-                                        GT64260_PCI_ACC_CNTL_RDPREFETCH |    \
-                                        GT64260_PCI_ACC_CNTL_RDLINEPREFETCH |\
-                                        GT64260_PCI_ACC_CNTL_RDMULPREFETCH | \
-                                        GT64260_PCI_ACC_CNTL_MBURST_MASK |   \
-                                        GT64260_PCI_ACC_CNTL_SWAP_MASK |     \
-                                        GT64260_PCI_ACC_CNTL_ACCPROT|        \
-                                        GT64260_PCI_ACC_CNTL_WRPROT)
-
-#define        MV64360_PCI_ACC_CNTL_ENABLE                     (1<<0)
-#define        MV64360_PCI_ACC_CNTL_REQ64                      (1<<1)
-#define        MV64360_PCI_ACC_CNTL_SNOOP_NONE                 0x00000000
-#define        MV64360_PCI_ACC_CNTL_SNOOP_WT                   0x00000004
-#define        MV64360_PCI_ACC_CNTL_SNOOP_WB                   0x00000008
-#define        MV64360_PCI_ACC_CNTL_SNOOP_MASK                 0x0000000c
-#define        MV64360_PCI_ACC_CNTL_ACCPROT                    (1<<4)
-#define        MV64360_PCI_ACC_CNTL_WRPROT                     (1<<5)
-#define        MV64360_PCI_ACC_CNTL_SWAP_BYTE                  0x00000000
-#define        MV64360_PCI_ACC_CNTL_SWAP_NONE                  0x00000040
-#define        MV64360_PCI_ACC_CNTL_SWAP_BYTE_WORD             0x00000080
-#define        MV64360_PCI_ACC_CNTL_SWAP_WORD                  0x000000c0
-#define        MV64360_PCI_ACC_CNTL_SWAP_MASK                  0x000000c0
-#define        MV64360_PCI_ACC_CNTL_MBURST_32_BYTES            0x00000000
-#define        MV64360_PCI_ACC_CNTL_MBURST_64_BYTES            0x00000100
-#define        MV64360_PCI_ACC_CNTL_MBURST_128_BYTES           0x00000200
-#define        MV64360_PCI_ACC_CNTL_MBURST_MASK                0x00000300
-#define        MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES            0x00000000
-#define        MV64360_PCI_ACC_CNTL_RDSIZE_64_BYTES            0x00000400
-#define        MV64360_PCI_ACC_CNTL_RDSIZE_128_BYTES           0x00000800
-#define        MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES           0x00000c00
-#define        MV64360_PCI_ACC_CNTL_RDSIZE_MASK                0x00000c00
-
-#define        MV64360_PCI_ACC_CNTL_ALL_BITS   (MV64360_PCI_ACC_CNTL_ENABLE |      \
-                                        MV64360_PCI_ACC_CNTL_REQ64 |       \
-                                        MV64360_PCI_ACC_CNTL_SNOOP_MASK |  \
-                                        MV64360_PCI_ACC_CNTL_ACCPROT |     \
-                                        MV64360_PCI_ACC_CNTL_WRPROT |      \
-                                        MV64360_PCI_ACC_CNTL_SWAP_MASK |   \
-                                        MV64360_PCI_ACC_CNTL_MBURST_MASK | \
-                                        MV64360_PCI_ACC_CNTL_RDSIZE_MASK)
-
-#define        MV64x60_PCI0_ACC_CNTL_0_BASE_LO                 0x1e00
-#define        MV64x60_PCI0_ACC_CNTL_0_BASE_HI                 0x1e04
-#define        MV64x60_PCI0_ACC_CNTL_0_SIZE                    0x1e08
-#define        MV64x60_PCI0_ACC_CNTL_1_BASE_LO                 0x1e10
-#define        MV64x60_PCI0_ACC_CNTL_1_BASE_HI                 0x1e14
-#define        MV64x60_PCI0_ACC_CNTL_1_SIZE                    0x1e18
-#define        MV64x60_PCI0_ACC_CNTL_2_BASE_LO                 0x1e20
-#define        MV64x60_PCI0_ACC_CNTL_2_BASE_HI                 0x1e24
-#define        MV64x60_PCI0_ACC_CNTL_2_SIZE                    0x1e28
-#define        MV64x60_PCI0_ACC_CNTL_3_BASE_LO                 0x1e30
-#define        MV64x60_PCI0_ACC_CNTL_3_BASE_HI                 0x1e34
-#define        MV64x60_PCI0_ACC_CNTL_3_SIZE                    0x1e38
-#define        MV64x60_PCI0_ACC_CNTL_4_BASE_LO                 0x1e40
-#define        MV64x60_PCI0_ACC_CNTL_4_BASE_HI                 0x1e44
-#define        MV64x60_PCI0_ACC_CNTL_4_SIZE                    0x1e48
-#define        MV64x60_PCI0_ACC_CNTL_5_BASE_LO                 0x1e50
-#define        MV64x60_PCI0_ACC_CNTL_5_BASE_HI                 0x1e54
-#define        MV64x60_PCI0_ACC_CNTL_5_SIZE                    0x1e58
-
-#define        GT64260_PCI0_ACC_CNTL_6_BASE_LO                 0x1e60
-#define        GT64260_PCI0_ACC_CNTL_6_BASE_HI                 0x1e64
-#define        GT64260_PCI0_ACC_CNTL_6_SIZE                    0x1e68
-#define        GT64260_PCI0_ACC_CNTL_7_BASE_LO                 0x1e70
-#define        GT64260_PCI0_ACC_CNTL_7_BASE_HI                 0x1e74
-#define        GT64260_PCI0_ACC_CNTL_7_SIZE                    0x1e78
-
-#define        MV64x60_PCI1_ACC_CNTL_0_BASE_LO                 0x1e80
-#define        MV64x60_PCI1_ACC_CNTL_0_BASE_HI                 0x1e84
-#define        MV64x60_PCI1_ACC_CNTL_0_SIZE                    0x1e88
-#define        MV64x60_PCI1_ACC_CNTL_1_BASE_LO                 0x1e90
-#define        MV64x60_PCI1_ACC_CNTL_1_BASE_HI                 0x1e94
-#define        MV64x60_PCI1_ACC_CNTL_1_SIZE                    0x1e98
-#define        MV64x60_PCI1_ACC_CNTL_2_BASE_LO                 0x1ea0
-#define        MV64x60_PCI1_ACC_CNTL_2_BASE_HI                 0x1ea4
-#define        MV64x60_PCI1_ACC_CNTL_2_SIZE                    0x1ea8
-#define        MV64x60_PCI1_ACC_CNTL_3_BASE_LO                 0x1eb0
-#define        MV64x60_PCI1_ACC_CNTL_3_BASE_HI                 0x1eb4
-#define        MV64x60_PCI1_ACC_CNTL_3_SIZE                    0x1eb8
-#define        MV64x60_PCI1_ACC_CNTL_4_BASE_LO                 0x1ec0
-#define        MV64x60_PCI1_ACC_CNTL_4_BASE_HI                 0x1ec4
-#define        MV64x60_PCI1_ACC_CNTL_4_SIZE                    0x1ec8
-#define        MV64x60_PCI1_ACC_CNTL_5_BASE_LO                 0x1ed0
-#define        MV64x60_PCI1_ACC_CNTL_5_BASE_HI                 0x1ed4
-#define        MV64x60_PCI1_ACC_CNTL_5_SIZE                    0x1ed8
-
-#define        GT64260_PCI1_ACC_CNTL_6_BASE_LO                 0x1ee0
-#define        GT64260_PCI1_ACC_CNTL_6_BASE_HI                 0x1ee4
-#define        GT64260_PCI1_ACC_CNTL_6_SIZE                    0x1ee8
-#define        GT64260_PCI1_ACC_CNTL_7_BASE_LO                 0x1ef0
-#define        GT64260_PCI1_ACC_CNTL_7_BASE_HI                 0x1ef4
-#define        GT64260_PCI1_ACC_CNTL_7_SIZE                    0x1ef8
-
-/* PCI Snoop Control Registers (64260 only) */
-#define        GT64260_PCI_SNOOP_NONE                          0x00000000
-#define        GT64260_PCI_SNOOP_WT                            0x00001000
-#define        GT64260_PCI_SNOOP_WB                            0x00002000
-
-#define        GT64260_PCI0_SNOOP_0_BASE_LO                    0x1f00
-#define        GT64260_PCI0_SNOOP_0_BASE_HI                    0x1f04
-#define        GT64260_PCI0_SNOOP_0_SIZE                       0x1f08
-#define        GT64260_PCI0_SNOOP_1_BASE_LO                    0x1f10
-#define        GT64260_PCI0_SNOOP_1_BASE_HI                    0x1f14
-#define        GT64260_PCI0_SNOOP_1_SIZE                       0x1f18
-#define        GT64260_PCI0_SNOOP_2_BASE_LO                    0x1f20
-#define        GT64260_PCI0_SNOOP_2_BASE_HI                    0x1f24
-#define        GT64260_PCI0_SNOOP_2_SIZE                       0x1f28
-#define        GT64260_PCI0_SNOOP_3_BASE_LO                    0x1f30
-#define        GT64260_PCI0_SNOOP_3_BASE_HI                    0x1f34
-#define        GT64260_PCI0_SNOOP_3_SIZE                       0x1f38
-
-#define        GT64260_PCI1_SNOOP_0_BASE_LO                    0x1f80
-#define        GT64260_PCI1_SNOOP_0_BASE_HI                    0x1f84
-#define        GT64260_PCI1_SNOOP_0_SIZE                       0x1f88
-#define        GT64260_PCI1_SNOOP_1_BASE_LO                    0x1f90
-#define        GT64260_PCI1_SNOOP_1_BASE_HI                    0x1f94
-#define        GT64260_PCI1_SNOOP_1_SIZE                       0x1f98
-#define        GT64260_PCI1_SNOOP_2_BASE_LO                    0x1fa0
-#define        GT64260_PCI1_SNOOP_2_BASE_HI                    0x1fa4
-#define        GT64260_PCI1_SNOOP_2_SIZE                       0x1fa8
-#define        GT64260_PCI1_SNOOP_3_BASE_LO                    0x1fb0
-#define        GT64260_PCI1_SNOOP_3_BASE_HI                    0x1fb4
-#define        GT64260_PCI1_SNOOP_3_SIZE                       0x1fb8
-
-/* PCI Error Report Registers */
-#define MV64x60_PCI0_ERR_SERR_MASK                     0x0c28
-#define MV64x60_PCI0_ERR_ADDR_LO                       0x1d40
-#define MV64x60_PCI0_ERR_ADDR_HI                       0x1d44
-#define MV64x60_PCI0_ERR_DATA_LO                       0x1d48
-#define MV64x60_PCI0_ERR_DATA_HI                       0x1d4c
-#define MV64x60_PCI0_ERR_CMD                           0x1d50
-#define MV64x60_PCI0_ERR_CAUSE                         0x1d58
-#define MV64x60_PCI0_ERR_MASK                          0x1d5c
-
-#define MV64x60_PCI1_ERR_SERR_MASK                     0x0ca8
-#define MV64x60_PCI1_ERR_ADDR_LO                       0x1dc0
-#define MV64x60_PCI1_ERR_ADDR_HI                       0x1dc4
-#define MV64x60_PCI1_ERR_DATA_LO                       0x1dc8
-#define MV64x60_PCI1_ERR_DATA_HI                       0x1dcc
-#define MV64x60_PCI1_ERR_CMD                           0x1dd0
-#define MV64x60_PCI1_ERR_CAUSE                         0x1dd8
-#define MV64x60_PCI1_ERR_MASK                          0x1ddc
-
-/* PCI Slave Address Decoding Registers */
-#define        MV64x60_PCI0_MEM_0_SIZE                         0x0c08
-#define        MV64x60_PCI0_MEM_1_SIZE                         0x0d08
-#define        MV64x60_PCI0_MEM_2_SIZE                         0x0c0c
-#define        MV64x60_PCI0_MEM_3_SIZE                         0x0d0c
-#define        MV64x60_PCI1_MEM_0_SIZE                         0x0c88
-#define        MV64x60_PCI1_MEM_1_SIZE                         0x0d88
-#define        MV64x60_PCI1_MEM_2_SIZE                         0x0c8c
-#define        MV64x60_PCI1_MEM_3_SIZE                         0x0d8c
-
-#define        MV64x60_PCI0_BAR_ENABLE                         0x0c3c
-#define        MV64x60_PCI1_BAR_ENABLE                         0x0cbc
-
-#define        MV64x60_PCI0_PCI_DECODE_CNTL                    0x0d3c
-
-
-
-
-
-#define        MV64x60_PCI0_SLAVE_BAR_REG_ENABLES              0x0c3c
-#define        MV64x60_PCI0_SLAVE_MEM_0_REMAP                  0x0c48
-#define        MV64x60_PCI0_SLAVE_MEM_1_REMAP                  0x0d48
-#define        MV64x60_PCI0_SLAVE_MEM_2_REMAP                  0x0c4c
-#define        MV64x60_PCI0_SLAVE_MEM_3_REMAP                  0x0d4c
-#define        MV64x60_PCI0_SLAVE_CS_0_REMAP                   0x0c50
-#define        MV64x60_PCI0_SLAVE_CS_1_REMAP                   0x0d50
-#define        MV64x60_PCI0_SLAVE_CS_2_REMAP                   0x0d58
-#define        MV64x60_PCI0_SLAVE_CS_3_REMAP                   0x0c54
-#define        MV64x60_PCI0_SLAVE_BOOT_REMAP                   0x0d54
-#define        MV64x60_PCI0_SLAVE_P2P_MEM_0_REMAP_LO           0x0d5c
-#define        MV64x60_PCI0_SLAVE_P2P_MEM_0_REMAP_HI           0x0d60
-#define        MV64x60_PCI0_SLAVE_P2P_MEM_1_REMAP_LO           0x0d64
-#define        MV64x60_PCI0_SLAVE_P2P_MEM_1_REMAP_HI           0x0d68
-#define        MV64x60_PCI0_SLAVE_P2P_IO_REMAP                 0x0d6c
-#define        MV64x60_PCI0_SLAVE_CPU_REMAP                    0x0d70
-
-#define        GT64260_PCI0_SLAVE_DAC_SCS_0_REMAP              0x0f00
-#define        GT64260_PCI0_SLAVE_DAC_SCS_1_REMAP              0x0f04
-#define        GT64260_PCI0_SLAVE_DAC_SCS_2_REMAP              0x0f08
-#define        GT64260_PCI0_SLAVE_DAC_SCS_3_REMAP              0x0f0c
-#define        GT64260_PCI0_SLAVE_DAC_CS_0_REMAP               0x0f10
-#define        GT64260_PCI0_SLAVE_DAC_CS_1_REMAP               0x0f14
-#define        GT64260_PCI0_SLAVE_DAC_CS_2_REMAP               0x0f18
-#define        GT64260_PCI0_SLAVE_DAC_CS_3_REMAP               0x0f1c
-#define        GT64260_PCI0_SLAVE_DAC_BOOT_REMAP               0x0f20
-#define        GT64260_PCI0_SLAVE_DAC_P2P_MEM_0_REMAP_LO       0x0f24
-#define        GT64260_PCI0_SLAVE_DAC_P2P_MEM_0_REMAP_HI       0x0f28
-#define        GT64260_PCI0_SLAVE_DAC_P2P_MEM_1_REMAP_LO       0x0f2c
-#define        GT64260_PCI0_SLAVE_DAC_P2P_MEM_1_REMAP_HI       0x0f30
-#define        GT64260_PCI0_SLAVE_DAC_CPU_REMAP                0x0f34
-
-#define        GT64260_PCI0_SLAVE_EXP_ROM_REMAP                0x0f38
-#define        GT64260_PCI0_SLAVE_PCI_DECODE_CNTL              0x0d3c
-
-
-
-
-
-/* XXXX BEGIN */
-#define        MV64x60_PCI1_PCI_DECODE_CNTL                    0x0dbc
-
-#define        MV64x60_PCI1_SLAVE_MEM_0_SIZE                   0x0c88
-#define        MV64x60_PCI1_SLAVE_MEM_1_SIZE                   0x0d88
-#define        MV64x60_PCI1_SLAVE_MEM_2_SIZE                   0x0c8c
-#define        MV64x60_PCI1_SLAVE_MEM_3_SIZE                   0x0d8c
-#define        MV64x60_PCI1_SLAVE_CS_0_SIZE                    0x0c90
-#define        MV64x60_PCI1_SLAVE_CS_1_SIZE                    0x0d90
-#define        MV64x60_PCI1_SLAVE_CS_2_SIZE                    0x0d98
-#define        MV64x60_PCI1_SLAVE_CS_3_SIZE                    0x0c94
-#define        MV64x60_PCI1_SLAVE_BOOT_SIZE                    0x0d94
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_0_SIZE               0x0d9c
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_1_SIZE               0x0da0
-#define        MV64x60_PCI1_SLAVE_P2P_IO_SIZE                  0x0da4
-#define        MV64x60_PCI1_SLAVE_CPU_SIZE                     0x0da8
-
-
-/* XXXXX END */
-
-
-#define        GT64260_PCI1_SLAVE_DAC_SCS_0_SIZE               0x0e80
-#define        GT64260_PCI1_SLAVE_DAC_SCS_1_SIZE               0x0e84
-#define        GT64260_PCI1_SLAVE_DAC_SCS_2_SIZE               0x0e88
-#define        GT64260_PCI1_SLAVE_DAC_SCS_3_SIZE               0x0e8c
-#define        GT64260_PCI1_SLAVE_DAC_CS_0_SIZE                0x0e90
-#define        GT64260_PCI1_SLAVE_DAC_CS_1_SIZE                0x0e94
-#define        GT64260_PCI1_SLAVE_DAC_CS_2_SIZE                0x0e98
-#define        GT64260_PCI1_SLAVE_DAC_CS_3_SIZE                0x0e9c
-#define        GT64260_PCI1_SLAVE_DAC_BOOT_SIZE                0x0ea0
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_0_SIZE           0x0ea4
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_1_SIZE           0x0ea8
-#define        GT64260_PCI1_SLAVE_DAC_CPU_SIZE                 0x0eac
-
-#define        GT64260_PCI1_SLAVE_EXP_ROM_SIZE                 0x0dac
-
-
-
-
-/* XXXX BEGIN */
-
-#define        MV64x60_PCI1_SLAVE_BAR_REG_ENABLES              0x0cbc
-#define        MV64x60_PCI1_SLAVE_MEM_0_REMAP                  0x0cc8
-#define        MV64x60_PCI1_SLAVE_MEM_1_REMAP                  0x0dc8
-#define        MV64x60_PCI1_SLAVE_MEM_2_REMAP                  0x0ccc
-#define        MV64x60_PCI1_SLAVE_MEM_3_REMAP                  0x0dcc
-#define        MV64x60_PCI1_SLAVE_CS_0_REMAP                   0x0cd0
-#define        MV64x60_PCI1_SLAVE_CS_1_REMAP                   0x0dd0
-#define        MV64x60_PCI1_SLAVE_CS_2_REMAP                   0x0dd8
-#define        MV64x60_PCI1_SLAVE_CS_3_REMAP                   0x0cd4
-#define        MV64x60_PCI1_SLAVE_BOOT_REMAP                   0x0dd4
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_0_REMAP_LO           0x0ddc
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_0_REMAP_HI           0x0de0
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_1_REMAP_LO           0x0de4
-#define        MV64x60_PCI1_SLAVE_P2P_MEM_1_REMAP_HI           0x0de8
-#define        MV64x60_PCI1_SLAVE_P2P_IO_REMAP                 0x0dec
-#define        MV64x60_PCI1_SLAVE_CPU_REMAP                    0x0df0
-
-/* XXXXX END */
-
-
-
-#define        GT64260_PCI1_SLAVE_DAC_SCS_0_REMAP              0x0f80
-#define        GT64260_PCI1_SLAVE_DAC_SCS_1_REMAP              0x0f84
-#define        GT64260_PCI1_SLAVE_DAC_SCS_2_REMAP              0x0f88
-#define        GT64260_PCI1_SLAVE_DAC_SCS_3_REMAP              0x0f8c
-#define        GT64260_PCI1_SLAVE_DAC_CS_0_REMAP               0x0f90
-#define        GT64260_PCI1_SLAVE_DAC_CS_1_REMAP               0x0f94
-#define        GT64260_PCI1_SLAVE_DAC_CS_2_REMAP               0x0f98
-#define        GT64260_PCI1_SLAVE_DAC_CS_3_REMAP               0x0f9c
-#define        GT64260_PCI1_SLAVE_DAC_BOOT_REMAP               0x0fa0
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_0_REMAP_LO       0x0fa4
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_0_REMAP_HI       0x0fa8
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_1_REMAP_LO       0x0fac
-#define        GT64260_PCI1_SLAVE_DAC_P2P_MEM_1_REMAP_HI       0x0fb0
-#define        GT64260_PCI1_SLAVE_DAC_CPU_REMAP                0x0fb4
-
-#define        GT64260_PCI1_SLAVE_EXP_ROM_REMAP                0x0fb8
-#define        GT64260_PCI1_SLAVE_PCI_DECODE_CNTL              0x0dbc
-
-
-/*
- *****************************************************************************
- *
- *     Timer/Counter Interface Registers
- *
- *****************************************************************************
- */
-
-#define        MV64x60_TIMR_CNTR_0                             0x0850
-#define        MV64x60_TIMR_CNTR_1                             0x0854
-#define        MV64x60_TIMR_CNTR_2                             0x0858
-#define        MV64x60_TIMR_CNTR_3                             0x085c
-#define        MV64x60_TIMR_CNTR_0_3_CNTL                      0x0864
-#define        MV64x60_TIMR_CNTR_0_3_INTR_CAUSE                0x0868
-#define        MV64x60_TIMR_CNTR_0_3_INTR_MASK                 0x086c
-
-#define        GT64260_TIMR_CNTR_4                             0x0950
-#define        GT64260_TIMR_CNTR_5                             0x0954
-#define        GT64260_TIMR_CNTR_6                             0x0958
-#define        GT64260_TIMR_CNTR_7                             0x095c
-#define        GT64260_TIMR_CNTR_4_7_CNTL                      0x0964
-#define        GT64260_TIMR_CNTR_4_7_INTR_CAUSE                0x0968
-#define        GT64260_TIMR_CNTR_4_7_INTR_MASK                 0x096c
-
-
-/*
- *****************************************************************************
- *
- *     Communications Controller (Enet, Serial, etc.) Interface Registers
- *
- *****************************************************************************
- */
-
-#define        GT64260_COMM_ENET_0_OFFSET              0xf200
-#define        GT64260_COMM_ENET_1_OFFSET              0xf220
-#define        GT64260_COMM_ENET_2_OFFSET              0xf240
-
-#define        GT64260_ENET_CNTL_LO                    \
-       (0xf200 - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_CNTL_HI                    \
-       (0xf204 - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_RX_BUF_PCI_ADDR_HI         \
-       (0xf208 - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_TX_BUF_PCI_ADDR_HI         \
-       (0xf20c - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_RX_DESC_ADDR_HI            \
-       (0xf210 - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_TX_DESC_ADDR_HI            \
-       (0xf214 - GT64260_COMM_ENET_0_BASE)
-#define        GT64260_ENET_HASH_TAB_PCI_ADDR_HI       \
-       (0xf218 - GT64260_COMM_ENET_0_BASE)
-
-#define        GT64260_COMM_MPSC_0_OFFSET              0xf280
-#define        GT64260_COMM_MPSC_1_OFFSET              0xf2c0
-
-#define        GT64260_MPSC_CNTL_LO                    \
-       (0xf280 - GT64260_COMM_MPSC_0_BASE)
-#define        GT64260_MPSC_CNTL_HI                    \
-       (0xf284 - GT64260_COMM_MPSC_0_BASE)
-#define        GT64260_MPSC_RX_BUF_PCI_ADDR_HI \
-       (0xf288 - GT64260_COMM_MPSC_0_BASE)
-#define        GT64260_MPSC_TX_BUF_PCI_ADDR_HI \
-       (0xf28c - GT64260_COMM_MPSC_0_BASE)
-#define        GT64260_MPSC_RX_DESC_ADDR_HI            \
-       (0xf290 - GT64260_COMM_MPSC_0_BASE)
-#define        GT64260_MPSC_TX_DESC_ADDR_HI            \
-       (0xf294 - GT64260_COMM_MPSC_0_BASE)
-
-#define        GT64260_SER_INIT_PCI_ADDR_HI            0xf320
-#define        GT64260_SER_INIT_LAST_DATA              0xf324
-#define        GT64260_SER_INIT_CONTROL                0xf328
-#define        GT64260_SER_INIT_STATUS                 0xf32c
-
-#define        GT64260_COMM_ARBITER_CNTL               0xf300
-#define        GT64260_COMM_CONFIG                     0xb40c
-#define        GT64260_COMM_XBAR_TO                    0xf304
-#define        GT64260_COMM_INTR_CAUSE                 0xf310
-#define        GT64260_COMM_INTR_MASK                  0xf314
-#define        GT64260_COMM_ERR_ADDR                   0xf318
-
-
-/*
- *****************************************************************************
- *
- *     Fast Ethernet Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        GT64260_ENET_PHY_ADDR                   0x2000
-#define        GT64260_ENET_ESMIR                      0x2010
-
-#define GT64260_ENET_0_OFFSET                  0x2400
-#define GT64260_ENET_1_OFFSET                  0x2800
-#define GT64260_ENET_2_OFFSET                  0x2c00
-
-#define        GT64260_ENET_EPCR                       (0x2400 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EPCXR                      (0x2408 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EPCMR                      (0x2410 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EPSR                       (0x2418 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ESPR                       (0x2420 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EHTPR                      (0x2428 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFCSAL                     (0x2430 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFCSAH                     (0x2438 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ESDCR                      (0x2440 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ESDCMR                     (0x2448 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EICR                       (0x2450 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EIMR                       (0x2458 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFRDP0                     (0x2480 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFRDP1                     (0x2484 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFRDP2                     (0x2488 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_EFRDP3                     (0x248c - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECRDP0                     (0x24a0 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECRDP1                     (0x24a4 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECRDP2                     (0x24a8 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECRDP3                     (0x24ac - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECTDP0                     (0x24e0 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_ECTDP1                     (0x24e4 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_DSCP2P0L                   (0x2460 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_DSCP2P0H                   (0x2464 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_DSCP2P1L                   (0x2468 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_DSCP2P1H                   (0x246c - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_VPT2P                      (0x2470 - GT64260_ENET_0_OFFSET)
-#define        GT64260_ENET_MIB_CTRS                   (0x2500 - GT64260_ENET_0_OFFSET)
-
-/*
- *****************************************************************************
- *
- *     IDMA Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        GT64260_IDMA_0_OFFSET                   0x0800
-#define        GT64260_IDMA_1_OFFSET                   0x0804
-#define        GT64260_IDMA_2_OFFSET                   0x0808
-#define        GT64260_IDMA_3_OFFSET                   0x080c
-#define        GT64260_IDMA_4_OFFSET                   0x0900
-#define        GT64260_IDMA_5_OFFSET                   0x0904
-#define        GT64260_IDMA_6_OFFSET                   0x0908
-#define        GT64260_IDMA_7_OFFSET                   0x090c
-
-#define        GT64260_IDMA_BYTE_COUNT                 (0x0800 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_SRC_ADDR                   (0x0810 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_DST_ADDR                   (0x0820 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_NEXT_DESC                  (0x0830 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_CUR_DESC                   (0x0870 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_SRC_PCI_ADDR_HI            (0x0890 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_DST_PCI_ADDR_HI            (0x08a0 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_NEXT_DESC_PCI_ADDR_HI      (0x08b0 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_CONTROL_LO                 (0x0840 - GT64260_IDMA_0_OFFSET)
-#define        GT64260_IDMA_CONTROL_HI                 (0x0880 - GT64260_IDMA_0_OFFSET)
-
-#define        GT64260_IDMA_0_3_ARBITER_CNTL           0x0860
-#define        GT64260_IDMA_4_7_ARBITER_CNTL           0x0960
-
-#define        GT64260_IDMA_0_3_XBAR_TO                0x08d0
-#define        GT64260_IDMA_4_7_XBAR_TO                0x09d0
-
-#define        GT64260_IDMA_0_3_INTR_CAUSE             0x08c0
-#define        GT64260_IDMA_0_3_INTR_MASK              0x08c4
-#define        GT64260_IDMA_0_3_ERROR_ADDR             0x08c8
-#define        GT64260_IDMA_0_3_ERROR_SELECT           0x08cc
-#define        GT64260_IDMA_4_7_INTR_CAUSE             0x09c0
-#define        GT64260_IDMA_4_7_INTR_MASK              0x09c4
-#define        GT64260_IDMA_4_7_ERROR_ADDR             0x09c8
-#define        GT64260_IDMA_4_7_ERROR_SELECT           0x09cc
-
-/*
- *****************************************************************************
- *
- *     Watchdog Timer Interface Registers
- *
- *****************************************************************************
- */
-
-#define        GT64260_WDT_WDC                                 0xb410
-#define        GT64260_WDT_WDV                                 0xb414
-
-
-/*
- *****************************************************************************
- *
- *      General Purpose Pins Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        MV64x60_GPP_IO_CNTL                             0xf100
-#define        MV64x60_GPP_LEVEL_CNTL                          0xf110
-#define        MV64x60_GPP_VALUE                               0xf104
-#define        MV64x60_GPP_INTR_CAUSE                          0xf108
-#define        MV64x60_GPP_INTR_MASK                           0xf10c
-
-
-/*
- *****************************************************************************
- *
- *     Multi-Purpose Pins Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        MV64x60_MPP_CNTL_0                              0xf000
-#define        MV64x60_MPP_CNTL_1                              0xf004
-#define        MV64x60_MPP_CNTL_2                              0xf008
-#define        MV64x60_MPP_CNTL_3                              0xf00c
-#define        GT64260_MPP_SERIAL_PORTS_MULTIPLEX              0xf010
-
-
-/*
- *****************************************************************************
- *
- *     I2C Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define GT64260_I2C_OFFSET                     0xc000
-
-#define GT64260_I2C_ADDR                       (0xc000 - GT64260_I2C_OFFSET)
-#define GT64260_I2C_EX_ADDR                    (0xc010 - GT64260_I2C_OFFSET)
-#define GT64260_I2C_DATA                       (0xc004 - GT64260_I2C_OFFSET)
-#define GT64260_I2C_CONTROL                    (0xc008 - GT64260_I2C_OFFSET)
-#define GT64260_I2C_STATUS                     (0xc00c - GT64260_I2C_OFFSET)
-#define GT64260_I2C_BAUD_RATE                  (0xc00c - GT64260_I2C_OFFSET)
-#define GT64260_I2C_RESET                      (0xc01c - GT64260_I2C_OFFSET)
-
-#define GT64260_I2C_ACK_BIT                    (1<<2)
-#define GT64260_I2C_IFLG_BIT                   (1<<3)
-#define GT64260_I2C_STOP_BIT                   (1<<4)
-#define GT64260_I2C_START_BIT                  (1<<5)
-#define GT64260_I2C_ENABLE_BIT                 (1<<6)
-#define GT64260_I2C_INT_ENABLE_BIT             (1<<7)
-
-#define GT64260_I2C_DATA_READ_BIT              0x01
-
-#define GT64260_I2C_STATUS_SENT_START          0x08
-#define GT64260_I2C_STATUS_RESENT_START                0x10
-#define GT64260_I2C_STATUS_WRITE_ADDR_ACK      0x18
-#define GT64260_I2C_STATUS_WRITE_ACK           0x28
-#define GT64260_I2C_STATUS_READ_ADDR_ACK       0x40
-#define GT64260_I2C_STATUS_READ_ACK            0x50
-#define GT64260_I2C_STATUS_READ_NO_ACK         0x58
-#define GT64260_I2C_STATUS_IDLE                        0xf8
-
-
-/*
- *****************************************************************************
- *
- *     Interrupt Controller Interface Registers
- *
- *****************************************************************************
- */
-
-#define        GT64260_IC_OFFSET                               0x0c18
-
-#define        GT64260_IC_MAIN_CAUSE_LO                (0x0c18 - GT64260_IC_OFFSET)
-#define        GT64260_IC_MAIN_CAUSE_HI                (0x0c68 - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INTR_MASK_LO             (0x0c1c - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INTR_MASK_HI             (0x0c6c - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_SELECT_CAUSE             (0x0c70 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI0_INTR_MASK_LO            (0x0c24 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI0_INTR_MASK_HI            (0x0c64 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI0_SELECT_CAUSE            (0x0c74 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI1_INTR_MASK_LO            (0x0ca4 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI1_INTR_MASK_HI            (0x0ce4 - GT64260_IC_OFFSET)
-#define        GT64260_IC_PCI1_SELECT_CAUSE            (0x0cf4 - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INT_0_MASK               (0x0e60 - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INT_1_MASK               (0x0e64 - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INT_2_MASK               (0x0e68 - GT64260_IC_OFFSET)
-#define        GT64260_IC_CPU_INT_3_MASK               (0x0e6c - GT64260_IC_OFFSET)
-
-#define        MV64360_IC_OFFSET                               0x0000
-
-#define        MV64360_IC_MAIN_CAUSE_LO                (0x0004 - MV64360_IC_OFFSET)
-#define        MV64360_IC_MAIN_CAUSE_HI                (0x000c - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU0_INTR_MASK_LO            (0x0014 - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU0_INTR_MASK_HI            (0x001c - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU0_SELECT_CAUSE            (0x0024 - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU1_INTR_MASK_LO            (0x0034 - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU1_INTR_MASK_HI            (0x003c - MV64360_IC_OFFSET)
-#define        MV64360_IC_CPU1_SELECT_CAUSE            (0x0044 - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT0_MASK_LO                 (0x0054 - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT0_MASK_HI                 (0x005c - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT0_SELECT_CAUSE            (0x0064 - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT1_MASK_LO                 (0x0074 - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT1_MASK_HI                 (0x007c - MV64360_IC_OFFSET)
-#define        MV64360_IC_INT1_SELECT_CAUSE            (0x0084 - MV64360_IC_OFFSET)
-
-#endif /* __ASMPPC_MV64x60_DEFS_H */
index 666796c..91be19d 100644 (file)
@@ -25,7 +25,6 @@
 #define        OCP_VENDOR_ARM          0x0004
 #define OCP_VENDOR_FREESCALE   0x1057
 #define OCP_VENDOR_IBM         0x1014
-#define OCP_VENDOR_MARVELL     0x11ab
 #define OCP_VENDOR_MOTOROLA    OCP_VENDOR_FREESCALE
 #define        OCP_VENDOR_XILINX       0x10ee
 #define        OCP_VENDOR_UNKNOWN      0xFFFF
@@ -43,9 +42,7 @@
 #define OCP_FUNC_16550         0x0031
 #define OCP_FUNC_IIC           0x0032
 #define OCP_FUNC_USB           0x0033
-#define        OCP_FUNC_MPSC           0x0034
-#define        OCP_FUNC_COMM_MPSC      0x0035
-#define        OCP_FUNC_SDMA           0x0036
+#define OCP_FUNC_PSC_UART      0x0034
 
 /* Memory devices 0x0090 - 0x009F */
 #define OCP_FUNC_MAL           0x0090
 #define OCP_FUNC_PERFMON       0x00D2  /* Performance Monitor */
 #define OCP_FUNC_RGMII         0x00D3
 #define OCP_FUNC_TAH           0x00D4
-#define        OCP_FUNC_I2C            0x00D5  /* I2C Controller */
-#define        OCP_FUNC_BRG            0x00D6  /* Baud Rate Generator */
-#define        OCP_FUNC_PIC            0x00D7  /* Programmable Interrupt Controller */
 
 /* Network 0x0200 - 0x02FF */
 #define OCP_FUNC_EMAC          0x0200
-#define OCP_FUNC_ENET          0x0201  /* TSEC & FEC */
-#define        OCP_FUNC_COMM_EMAC      0x0202
-#define OCP_FUNC_GFAR          0x0203  /* TSEC & FEC */
+#define OCP_FUNC_GFAR          0x0201  /* TSEC & FEC */
 
 /* Bridge devices 0xE00 - 0xEFF */
 #define OCP_FUNC_OPB           0x0E00
-#define        OCP_FUNC_HB             0x0E01  /* Host bridge */
 
 #define OCP_FUNC_UNKNOWN       0xFFFF
index 57838e8..b01542b 100644 (file)
@@ -163,5 +163,7 @@ extern __inline__ int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 #endif /* _PPC_PAGE_H */
diff --git a/include/asm-ppc/ppc405_dma.h b/include/asm-ppc/ppc405_dma.h
deleted file mode 100644 (file)
index 489eec5..0000000
+++ /dev/null
@@ -1,1271 +0,0 @@
-/*
- * Author: Pete Popov <ppopov@mvista.com>
- *
- * 2000 (c) MontaVista, Software, Inc.  This file is licensed under
- * the terms of the GNU General Public License version 2.  This program
- * is licensed "as is" without any warranty of any kind, whether express
- * or implied.
- *
- * Data structures specific to the IBM PowerPC 405 on-chip DMA controller
- * and API.
- */
-
-#ifdef __KERNEL__
-#ifndef __ASMPPC_405_DMA_H
-#define __ASMPPC_405_DMA_H
-
-#include <linux/types.h>
-
-/* #define DEBUG_405DMA */
-
-#define TRUE  1
-#define FALSE 0
-
-#define SGL_LIST_SIZE 4096
-/* #define PCI_ALLOC_IS_NONCONSISTENT */
-
-#define MAX_405GP_DMA_CHANNELS 4
-
-/* The maximum address that we can perform a DMA transfer to on this platform */
-/* Doesn't really apply... */
-#define MAX_DMA_ADDRESS                0xFFFFFFFF
-
-extern unsigned long ISA_DMA_THRESHOLD;
-
-#define dma_outb       outb
-#define dma_inb                inb
-
-
-/*
- * Function return status codes
- * These values are used to indicate whether or not the function
- * call was successful, or a bad/invalid parameter was passed.
- */
-#define DMA_STATUS_GOOD                        0
-#define DMA_STATUS_BAD_CHANNEL         1
-#define DMA_STATUS_BAD_HANDLE          2
-#define DMA_STATUS_BAD_MODE            3
-#define DMA_STATUS_NULL_POINTER                4
-#define DMA_STATUS_OUT_OF_MEMORY       5
-#define DMA_STATUS_SGL_LIST_EMPTY      6
-#define DMA_STATUS_GENERAL_ERROR       7
-
-
-/*
- * These indicate status as returned from the DMA Status Register.
- */
-#define DMA_STATUS_NO_ERROR    0
-#define DMA_STATUS_CS          1       /* Count Status        */
-#define DMA_STATUS_TS          2       /* Transfer Status     */
-#define DMA_STATUS_DMA_ERROR   3       /* DMA Error Occurred  */
-#define DMA_STATUS_DMA_BUSY    4       /* The channel is busy */
-
-
-/*
- * Transfer Modes
- * These modes are defined in a way that makes it possible to
- * simply "or" in the value in the control register.
- */
-#define DMA_MODE_READ          DMA_TD                /* Peripheral to Memory */
-#define DMA_MODE_WRITE         0                     /* Memory to Peripheral */
-#define DMA_MODE_MM            (SET_DMA_TM(TM_S_MM)) /* memory to memory */
-
-                               /* Device-paced memory to memory, */
-                               /* device is at source address    */
-#define DMA_MODE_MM_DEVATSRC   (DMA_TD | SET_DMA_TM(TM_D_MM))
-
-                               /* Device-paced memory to memory,      */
-                               /* device is at destination address    */
-#define DMA_MODE_MM_DEVATDST   (SET_DMA_TM(TM_D_MM))
-
-
-/*
- * DMA Polarity Configuration Register
- */
-#define DMAReq0_ActiveLow (1<<31)
-#define DMAAck0_ActiveLow (1<<30)
-#define EOT0_ActiveLow    (1<<29)           /* End of Transfer      */
-
-#define DMAReq1_ActiveLow (1<<28)
-#define DMAAck1_ActiveLow (1<<27)
-#define EOT1_ActiveLow    (1<<26)
-
-#define DMAReq2_ActiveLow (1<<25)
-#define DMAAck2_ActiveLow (1<<24)
-#define EOT2_ActiveLow    (1<<23)
-
-#define DMAReq3_ActiveLow (1<<22)
-#define DMAAck3_ActiveLow (1<<21)
-#define EOT3_ActiveLow    (1<<20)
-
-/*
- * DMA Sleep Mode Register
- */
-#define SLEEP_MODE_ENABLE (1<<21)
-
-
-/*
- * DMA Status Register
- */
-#define DMA_CS0           (1<<31) /* Terminal Count has been reached */
-#define DMA_CS1           (1<<30)
-#define DMA_CS2           (1<<29)
-#define DMA_CS3           (1<<28)
-
-#define DMA_TS0           (1<<27) /* End of Transfer has been requested */
-#define DMA_TS1           (1<<26)
-#define DMA_TS2           (1<<25)
-#define DMA_TS3           (1<<24)
-
-#define DMA_CH0_ERR       (1<<23) /* DMA Chanel 0 Error */
-#define DMA_CH1_ERR       (1<<22)
-#define DMA_CH2_ERR       (1<<21)
-#define DMA_CH3_ERR       (1<<20)
-
-#define DMA_IN_DMA_REQ0   (1<<19) /* Internal DMA Request is pending */
-#define DMA_IN_DMA_REQ1   (1<<18)
-#define DMA_IN_DMA_REQ2   (1<<17)
-#define DMA_IN_DMA_REQ3   (1<<16)
-
-#define DMA_EXT_DMA_REQ0  (1<<15) /* External DMA Request is pending */
-#define DMA_EXT_DMA_REQ1  (1<<14)
-#define DMA_EXT_DMA_REQ2  (1<<13)
-#define DMA_EXT_DMA_REQ3  (1<<12)
-
-#define DMA_CH0_BUSY      (1<<11) /* DMA Channel 0 Busy */
-#define DMA_CH1_BUSY      (1<<10)
-#define DMA_CH2_BUSY       (1<<9)
-#define DMA_CH3_BUSY       (1<<8)
-
-#define DMA_SG0            (1<<7) /* DMA Channel 0 Scatter/Gather in progress */
-#define DMA_SG1            (1<<6)
-#define DMA_SG2            (1<<5)
-#define DMA_SG3            (1<<4)
-
-
-
-/*
- * DMA Channel Control Registers
- */
-#define DMA_CH_ENABLE         (1<<31)     /* DMA Channel Enable */
-#define SET_DMA_CH_ENABLE(x)  (((x)&0x1)<<31)
-#define GET_DMA_CH_ENABLE(x)  (((x)&DMA_CH_ENABLE)>>31)
-
-#define DMA_CIE_ENABLE        (1<<30)     /* DMA Channel Interrupt Enable */
-#define SET_DMA_CIE_ENABLE(x) (((x)&0x1)<<30)
-#define GET_DMA_CIE_ENABLE(x) (((x)&DMA_CIE_ENABLE)>>30)
-
-#define DMA_TD                (1<<29)
-#define SET_DMA_TD(x)         (((x)&0x1)<<29)
-#define GET_DMA_TD(x)         (((x)&DMA_TD)>>29)
-
-#define DMA_PL                (1<<28)     /* Peripheral Location */
-#define SET_DMA_PL(x)         (((x)&0x1)<<28)
-#define GET_DMA_PL(x)         (((x)&DMA_PL)>>28)
-
-#define EXTERNAL_PERIPHERAL    0
-#define INTERNAL_PERIPHERAL    1
-
-
-#define SET_DMA_PW(x)     (((x)&0x3)<<26) /* Peripheral Width */
-#define DMA_PW_MASK       SET_DMA_PW(3)
-#define   PW_8                 0
-#define   PW_16                1
-#define   PW_32                2
-#define   PW_64                3
-#define GET_DMA_PW(x)     (((x)&DMA_PW_MASK)>>26)
-
-#define DMA_DAI           (1<<25)         /* Destination Address Increment */
-#define SET_DMA_DAI(x)    (((x)&0x1)<<25)
-
-#define DMA_SAI           (1<<24)         /* Source Address Increment */
-#define SET_DMA_SAI(x)    (((x)&0x1)<<24)
-
-#define DMA_BEN           (1<<23)         /* Buffer Enable */
-#define SET_DMA_BEN(x)    (((x)&0x1)<<23)
-
-#define SET_DMA_TM(x)     (((x)&0x3)<<21) /* Transfer Mode */
-#define DMA_TM_MASK       SET_DMA_TM(3)
-#define   TM_PERIPHERAL        0          /* Peripheral */
-#define   TM_RESERVED          1          /* Reserved */
-#define   TM_S_MM              2          /* Memory to Memory */
-#define   TM_D_MM              3          /* Device Paced Memory to Memory */
-#define GET_DMA_TM(x)     (((x)&DMA_TM_MASK)>>21)
-
-#define SET_DMA_PSC(x)    (((x)&0x3)<<19) /* Peripheral Setup Cycles */
-#define DMA_PSC_MASK      SET_DMA_PSC(3)
-#define GET_DMA_PSC(x)    (((x)&DMA_PSC_MASK)>>19)
-
-#define SET_DMA_PWC(x)    (((x)&0x3F)<<13) /* Peripheral Wait Cycles */
-#define DMA_PWC_MASK      SET_DMA_PWC(0x3F)
-#define GET_DMA_PWC(x)    (((x)&DMA_PWC_MASK)>>13)
-
-#define SET_DMA_PHC(x)    (((x)&0x7)<<10) /* Peripheral Hold Cycles */
-#define DMA_PHC_MASK      SET_DMA_PHC(0x7)
-#define GET_DMA_PHC(x)    (((x)&DMA_PHC_MASK)>>10)
-
-#define DMA_ETD_OUTPUT     (1<<9)         /* EOT pin is a TC output */
-#define SET_DMA_ETD(x)     (((x)&0x1)<<9)
-
-#define DMA_TCE_ENABLE     (1<<8)
-#define SET_DMA_TCE(x)     (((x)&0x1)<<8)
-
-#define SET_DMA_PRIORITY(x)   (((x)&0x3)<<6)   /* DMA Channel Priority */
-#define DMA_PRIORITY_MASK SET_DMA_PRIORITY(3)
-#define   PRIORITY_LOW         0
-#define   PRIORITY_MID_LOW     1
-#define   PRIORITY_MID_HIGH    2
-#define   PRIORITY_HIGH        3
-#define GET_DMA_PRIORITY(x) (((x)&DMA_PRIORITY_MASK)>>6)
-
-#define SET_DMA_PREFETCH(x)   (((x)&0x3)<<4)  /* Memory Read Prefetch */
-#define DMA_PREFETCH_MASK      SET_DMA_PREFETCH(3)
-#define   PREFETCH_1           0              /* Prefetch 1 Double Word */
-#define   PREFETCH_2           1
-#define   PREFETCH_4           2
-#define GET_DMA_PREFETCH(x) (((x)&DMA_PREFETCH_MASK)>>4)
-
-#define DMA_PCE            (1<<3)         /* Parity Check Enable */
-#define SET_DMA_PCE(x)     (((x)&0x1)<<3)
-#define GET_DMA_PCE(x)     (((x)&DMA_PCE)>>3)
-
-#define DMA_DEC            (1<<2)         /* Address Decrement */
-#define SET_DMA_DEC(x)     (((x)&0x1)<<2)
-#define GET_DMA_DEC(x)     (((x)&DMA_DEC)>>2)
-
-/*
- * DMA SG Command Register
- */
-#define SSG0_ENABLE        (1<<31)        /* Start Scatter Gather */
-#define SSG1_ENABLE        (1<<30)
-#define SSG2_ENABLE        (1<<29)
-#define SSG3_ENABLE        (1<<28)
-#define SSG0_MASK_ENABLE   (1<<15)        /* Enable writing to SSG0 bit */
-#define SSG1_MASK_ENABLE   (1<<14)
-#define SSG2_MASK_ENABLE   (1<<13)
-#define SSG3_MASK_ENABLE   (1<<12)
-
-
-/*
- * DMA Scatter/Gather Descriptor Bit fields
- */
-#define SG_LINK            (1<<31)        /* Link */
-#define SG_TCI_ENABLE      (1<<29)        /* Enable Terminal Count Interrupt */
-#define SG_ETI_ENABLE      (1<<28)        /* Enable End of Transfer Interrupt */
-#define SG_ERI_ENABLE      (1<<27)        /* Enable Error Interrupt */
-#define SG_COUNT_MASK       0xFFFF        /* Count Field */
-
-
-
-
-typedef uint32_t sgl_handle_t;
-
-typedef struct {
-
-       /*
-        * Valid polarity settings:
-        *   DMAReq0_ActiveLow
-        *   DMAAck0_ActiveLow
-        *   EOT0_ActiveLow
-        *
-        *   DMAReq1_ActiveLow
-        *   DMAAck1_ActiveLow
-        *   EOT1_ActiveLow
-        *
-        *   DMAReq2_ActiveLow
-        *   DMAAck2_ActiveLow
-        *   EOT2_ActiveLow
-        *
-        *   DMAReq3_ActiveLow
-        *   DMAAck3_ActiveLow
-        *   EOT3_ActiveLow
-        */
-       unsigned int polarity;
-
-       char buffer_enable;      /* Boolean: buffer enable            */
-       char tce_enable;         /* Boolean: terminal count enable    */
-       char etd_output;         /* Boolean: eot pin is a tc output   */
-       char pce;                /* Boolean: parity check enable      */
-
-       /*
-        * Peripheral location:
-        * INTERNAL_PERIPHERAL (UART0 on the 405GP)
-        * EXTERNAL_PERIPHERAL
-        */
-       char pl;                 /* internal/external peripheral      */
-
-       /*
-        * Valid pwidth settings:
-        *   PW_8
-        *   PW_16
-        *   PW_32
-        *   PW_64
-        */
-       unsigned int pwidth;
-
-       char dai;                /* Boolean: dst address increment   */
-       char sai;                /* Boolean: src address increment   */
-
-       /*
-        * Valid psc settings: 0-3
-        */
-       unsigned int psc;        /* Peripheral Setup Cycles         */
-
-       /*
-        * Valid pwc settings:
-        * 0-63
-        */
-       unsigned int pwc;        /* Peripheral Wait Cycles          */
-
-       /*
-        * Valid phc settings:
-        * 0-7
-        */
-       unsigned int phc;        /* Peripheral Hold Cycles          */
-
-       /*
-        * Valid cp (channel priority) settings:
-        *   PRIORITY_LOW
-        *   PRIORITY_MID_LOW
-        *   PRIORITY_MID_HIGH
-        *   PRIORITY_HIGH
-        */
-       unsigned int cp;         /* channel priority                */
-
-       /*
-        * Valid pf (memory read prefetch) settings:
-        *
-        *   PREFETCH_1
-        *   PREFETCH_2
-        *   PREFETCH_4
-        */
-       unsigned int pf;         /* memory read prefetch            */
-
-       /*
-        * Boolean: channel interrupt enable
-        * NOTE: for sgl transfers, only the last descriptor will be setup to
-        * interrupt.
-        */
-       char int_enable;
-
-       char shift;              /* easy access to byte_count shift, based on */
-                                /* the width of the channel                  */
-
-       uint32_t control;        /* channel control word                      */
-
-
-       /* These variabled are used ONLY in single dma transfers              */
-       unsigned int mode;       /* transfer mode                     */
-       dma_addr_t addr;
-
-} ppc_dma_ch_t;
-
-
-typedef struct {
-       uint32_t control;
-       uint32_t src_addr;
-       uint32_t dst_addr;
-       uint32_t control_count;
-       uint32_t next;
-} ppc_sgl_t;
-
-
-
-typedef struct {
-       unsigned int dmanr;
-       uint32_t control;     /* channel ctrl word; loaded from each descrptr */
-       uint32_t sgl_control; /* LK, TCI, ETI, and ERI bits in sgl descriptor */
-       dma_addr_t dma_addr;  /* dma (physical) address of this list          */
-       ppc_sgl_t *phead;
-       ppc_sgl_t *ptail;
-
-} sgl_list_info_t;
-
-
-typedef struct {
-       unsigned int *src_addr;
-       unsigned int *dst_addr;
-       dma_addr_t dma_src_addr;
-       dma_addr_t dma_dst_addr;
-} pci_alloc_desc_t;
-
-
-extern ppc_dma_ch_t dma_channels[];
-
-/*
- *
- * DMA API inline functions
- * These functions are implemented here as inline functions for
- * performance reasons.
- *
- */
-
-static __inline__ int get_405gp_dma_status(void)
-{
-       return (mfdcr(DCRN_DMASR));
-}
-
-
-static __inline__ int enable_405gp_dma(unsigned int dmanr)
-{
-       unsigned int control;
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-#ifdef DEBUG_405DMA
-       if (dmanr >= MAX_405GP_DMA_CHANNELS) {
-               printk("enable_dma: bad channel: %d\n", dmanr);
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-#endif
-
-
-       switch (dmanr) {
-       case 0:
-               if (p_dma_ch->mode == DMA_MODE_READ) {
-                       /* peripheral to memory */
-                       mtdcr(DCRN_DMASA0, NULL);
-                       mtdcr(DCRN_DMADA0, p_dma_ch->addr);
-                       }
-               else if (p_dma_ch->mode == DMA_MODE_WRITE) {
-                       /* memory to peripheral */
-                       mtdcr(DCRN_DMASA0, p_dma_ch->addr);
-                       mtdcr(DCRN_DMADA0, NULL);
-               }
-               /* for other xfer modes, the addresses are already set */
-               control = mfdcr(DCRN_DMACR0);
-               control &= ~(DMA_TM_MASK | DMA_TD);   /* clear all mode bits */
-               control |= (p_dma_ch->mode | DMA_CH_ENABLE);
-               mtdcr(DCRN_DMACR0, control);
-               break;
-       case 1:
-               if (p_dma_ch->mode == DMA_MODE_READ) {
-                       mtdcr(DCRN_DMASA1, NULL);
-                       mtdcr(DCRN_DMADA1, p_dma_ch->addr);
-               } else if (p_dma_ch->mode == DMA_MODE_WRITE) {
-                       mtdcr(DCRN_DMASA1, p_dma_ch->addr);
-                       mtdcr(DCRN_DMADA1, NULL);
-               }
-               control = mfdcr(DCRN_DMACR1);
-               control &= ~(DMA_TM_MASK | DMA_TD);
-               control |= (p_dma_ch->mode | DMA_CH_ENABLE);
-               mtdcr(DCRN_DMACR1, control);
-               break;
-       case 2:
-               if (p_dma_ch->mode == DMA_MODE_READ) {
-                       mtdcr(DCRN_DMASA2, NULL);
-                       mtdcr(DCRN_DMADA2, p_dma_ch->addr);
-               } else if (p_dma_ch->mode == DMA_MODE_WRITE) {
-                       mtdcr(DCRN_DMASA2, p_dma_ch->addr);
-                       mtdcr(DCRN_DMADA2, NULL);
-               }
-               control = mfdcr(DCRN_DMACR2);
-               control &= ~(DMA_TM_MASK | DMA_TD);
-               control |= (p_dma_ch->mode | DMA_CH_ENABLE);
-               mtdcr(DCRN_DMACR2, control);
-               break;
-       case 3:
-               if (p_dma_ch->mode == DMA_MODE_READ) {
-                       mtdcr(DCRN_DMASA3, NULL);
-                       mtdcr(DCRN_DMADA3, p_dma_ch->addr);
-               } else if (p_dma_ch->mode == DMA_MODE_WRITE) {
-                       mtdcr(DCRN_DMASA3, p_dma_ch->addr);
-                       mtdcr(DCRN_DMADA3, NULL);
-               }
-               control = mfdcr(DCRN_DMACR3);
-               control &= ~(DMA_TM_MASK | DMA_TD);
-               control |= (p_dma_ch->mode | DMA_CH_ENABLE);
-               mtdcr(DCRN_DMACR3, control);
-               break;
-       default:
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-       return DMA_STATUS_GOOD;
-}
-
-
-
-static __inline__ void disable_405gp_dma(unsigned int dmanr)
-{
-       unsigned int control;
-
-       switch (dmanr) {
-       case 0:
-               control = mfdcr(DCRN_DMACR0);
-               control &= ~DMA_CH_ENABLE;
-               mtdcr(DCRN_DMACR0, control);
-               break;
-       case 1:
-               control = mfdcr(DCRN_DMACR1);
-               control &= ~DMA_CH_ENABLE;
-               mtdcr(DCRN_DMACR1, control);
-               break;
-       case 2:
-               control = mfdcr(DCRN_DMACR2);
-               control &= ~DMA_CH_ENABLE;
-               mtdcr(DCRN_DMACR2, control);
-               break;
-       case 3:
-               control = mfdcr(DCRN_DMACR3);
-               control &= ~DMA_CH_ENABLE;
-               mtdcr(DCRN_DMACR3, control);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("disable_dma: bad channel: %d\n", dmanr);
-#endif
-       }
-}
-
-
-
-/*
- * Sets the dma mode for single DMA transfers only.
- * For scatter/gather transfers, the mode is passed to the
- * alloc_dma_handle() function as one of the parameters.
- *
- * The mode is simply saved and used later.  This allows
- * the driver to call set_dma_mode() and set_dma_addr() in
- * any order.
- *
- * Valid mode values are:
- *
- * DMA_MODE_READ          peripheral to memory
- * DMA_MODE_WRITE         memory to peripheral
- * DMA_MODE_MM            memory to memory
- * DMA_MODE_MM_DEVATSRC   device-paced memory to memory, device at src
- * DMA_MODE_MM_DEVATDST   device-paced memory to memory, device at dst
- */
-static __inline__ int set_405gp_dma_mode(unsigned int dmanr, unsigned int mode)
-{
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-#ifdef DEBUG_405DMA
-       switch (mode) {
-       case DMA_MODE_READ:
-       case DMA_MODE_WRITE:
-       case DMA_MODE_MM:
-       case DMA_MODE_MM_DEVATSRC:
-       case DMA_MODE_MM_DEVATDST:
-               break;
-       default:
-               printk("set_dma_mode: bad mode 0x%x\n", mode);
-               return DMA_STATUS_BAD_MODE;
-       }
-       if (dmanr >= MAX_405GP_DMA_CHANNELS) {
-               printk("set_dma_mode: bad channel 0x%x\n", dmanr);
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-#endif
-
-       p_dma_ch->mode = mode;
-       return DMA_STATUS_GOOD;
-}
-
-
-
-/*
- * Sets the DMA Count register. Note that 'count' is in bytes.
- * However, the DMA Count register counts the number of "transfers",
- * where each transfer is equal to the bus width.  Thus, count
- * MUST be a multiple of the bus width.
- */
-static __inline__ void
-set_405gp_dma_count(unsigned int dmanr, unsigned int count)
-{
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-#ifdef DEBUG_405DMA
-       {
-       int error = 0;
-       switch(p_dma_ch->pwidth) {
-       case PW_8:
-               break;
-       case PW_16:
-               if (count & 0x1)
-               error = 1;
-               break;
-       case PW_32:
-               if (count & 0x3)
-               error = 1;
-               break;
-       case PW_64:
-               if (count & 0x7)
-               error = 1;
-               break;
-       default:
-               printk("set_dma_count: invalid bus width: 0x%x\n",
-                       p_dma_ch->pwidth);
-               return;
-       }
-       if (error)
-               printk("Warning: set_dma_count count 0x%x bus width %d\n",
-                       count, p_dma_ch->pwidth);
-       }
-#endif
-
-       count = count >> p_dma_ch->shift;
-       switch (dmanr) {
-       case 0:
-               mtdcr(DCRN_DMACT0, count);
-               break;
-       case 1:
-               mtdcr(DCRN_DMACT1, count);
-               break;
-       case 2:
-               mtdcr(DCRN_DMACT2, count);
-               break;
-       case 3:
-               mtdcr(DCRN_DMACT3, count);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("set_dma_count: bad channel: %d\n", dmanr);
-#endif
-       }
-}
-
-
-
-/*
- *   Returns the number of bytes left to be transfered.
- *   After a DMA transfer, this should return zero.
- *   Reading this while a DMA transfer is still in progress will return
- *   unpredictable results.
- */
-static __inline__ int get_405gp_dma_residue(unsigned int dmanr)
-{
-       unsigned int count;
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-       switch (dmanr) {
-       case 0:
-               count = mfdcr(DCRN_DMACT0);
-               break;
-       case 1:
-               count = mfdcr(DCRN_DMACT1);
-               break;
-       case 2:
-               count = mfdcr(DCRN_DMACT2);
-               break;
-       case 3:
-               count = mfdcr(DCRN_DMACT3);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("get_dma_residue: bad channel: %d\n", dmanr);
-#endif
-           return 0;
-       }
-
-       return (count << p_dma_ch->shift);
-}
-
-
-
-/*
- * Sets the DMA address for a memory to peripheral or peripheral
- * to memory transfer.  The address is just saved in the channel
- * structure for now and used later in enable_dma().
- */
-static __inline__ void set_405gp_dma_addr(unsigned int dmanr, dma_addr_t addr)
-{
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-#ifdef DEBUG_405DMA
-       {
-       int error = 0;
-       switch(p_dma_ch->pwidth) {
-       case PW_8:
-               break;
-       case PW_16:
-               if ((unsigned)addr & 0x1)
-               error = 1;
-               break;
-       case PW_32:
-               if ((unsigned)addr & 0x3)
-               error = 1;
-               break;
-       case PW_64:
-               if ((unsigned)addr & 0x7)
-               error = 1;
-               break;
-       default:
-               printk("set_dma_addr: invalid bus width: 0x%x\n",
-                       p_dma_ch->pwidth);
-               return;
-       }
-       if (error)
-               printk("Warning: set_dma_addr addr 0x%x bus width %d\n",
-                       addr, p_dma_ch->pwidth);
-       }
-#endif
-
-       /* save dma address and program it later after we know the xfer mode */
-       p_dma_ch->addr = addr;
-}
-
-
-
-
-/*
- * Sets both DMA addresses for a memory to memory transfer.
- * For memory to peripheral or peripheral to memory transfers
- * the function set_dma_addr() should be used instead.
- */
-static __inline__ void
-set_405gp_dma_addr2(unsigned int dmanr, dma_addr_t src_dma_addr,
-       dma_addr_t dst_dma_addr)
-{
-#ifdef DEBUG_405DMA
-       {
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-       int error = 0;
-       switch(p_dma_ch->pwidth) {
-       case PW_8:
-               break;
-       case PW_16:
-               if (((unsigned)src_dma_addr & 0x1) ||
-                   ((unsigned)dst_dma_addr & 0x1)
-                  )
-                       error = 1;
-               break;
-       case PW_32:
-               if (((unsigned)src_dma_addr & 0x3) ||
-                   ((unsigned)dst_dma_addr & 0x3)
-                  )
-                       error = 1;
-               break;
-       case PW_64:
-               if (((unsigned)src_dma_addr & 0x7) ||
-                   ((unsigned)dst_dma_addr & 0x7)
-                  )
-                       error = 1;
-               break;
-       default:
-               printk("set_dma_addr2: invalid bus width: 0x%x\n",
-                       p_dma_ch->pwidth);
-               return;
-       }
-       if (error)
-               printk("Warning: set_dma_addr2 src 0x%x dst 0x%x bus width %d\n",
-                       src_dma_addr, dst_dma_addr, p_dma_ch->pwidth);
-       }
-#endif
-
-       switch (dmanr) {
-       case 0:
-               mtdcr(DCRN_DMASA0, src_dma_addr);
-               mtdcr(DCRN_DMADA0, dst_dma_addr);
-               break;
-       case 1:
-               mtdcr(DCRN_DMASA1, src_dma_addr);
-               mtdcr(DCRN_DMADA1, dst_dma_addr);
-               break;
-       case 2:
-               mtdcr(DCRN_DMASA2, src_dma_addr);
-               mtdcr(DCRN_DMADA2, dst_dma_addr);
-               break;
-       case 3:
-               mtdcr(DCRN_DMASA3, src_dma_addr);
-               mtdcr(DCRN_DMADA3, dst_dma_addr);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("set_dma_addr2: bad channel: %d\n", dmanr);
-#endif
-       }
-}
-
-
-
-/*
- * Enables the channel interrupt.
- *
- * If performing a scatter/gatter transfer, this function
- * MUST be called before calling alloc_dma_handle() and building
- * the sgl list.  Otherwise, interrupts will not be enabled, if
- * they were previously disabled.
- */
-static __inline__ int
-enable_405gp_dma_interrupt(unsigned int dmanr)
-{
-       unsigned int control;
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-       p_dma_ch->int_enable = TRUE;
-       switch (dmanr) {
-       case 0:
-               control = mfdcr(DCRN_DMACR0);
-               control|= DMA_CIE_ENABLE;        /* Channel Interrupt Enable */
-               mtdcr(DCRN_DMACR0, control);
-               break;
-       case 1:
-               control = mfdcr(DCRN_DMACR1);
-               control|= DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR1, control);
-               break;
-       case 2:
-               control = mfdcr(DCRN_DMACR2);
-               control|= DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR2, control);
-               break;
-       case 3:
-               control = mfdcr(DCRN_DMACR3);
-               control|= DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR3, control);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("enable_dma_interrupt: bad channel: %d\n", dmanr);
-#endif
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-       return DMA_STATUS_GOOD;
-}
-
-
-
-/*
- * Disables the channel interrupt.
- *
- * If performing a scatter/gatter transfer, this function
- * MUST be called before calling alloc_dma_handle() and building
- * the sgl list.  Otherwise, interrupts will not be disabled, if
- * they were previously enabled.
- */
-static __inline__ int
-disable_405gp_dma_interrupt(unsigned int dmanr)
-{
-       unsigned int control;
-       ppc_dma_ch_t *p_dma_ch = &dma_channels[dmanr];
-
-       p_dma_ch->int_enable = TRUE;
-       switch (dmanr) {
-       case 0:
-               control = mfdcr(DCRN_DMACR0);
-               control &= ~DMA_CIE_ENABLE;       /* Channel Interrupt Enable */
-               mtdcr(DCRN_DMACR0, control);
-               break;
-       case 1:
-               control = mfdcr(DCRN_DMACR1);
-               control &= ~DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR1, control);
-               break;
-       case 2:
-               control = mfdcr(DCRN_DMACR2);
-               control &= ~DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR2, control);
-               break;
-       case 3:
-               control = mfdcr(DCRN_DMACR3);
-               control &= ~DMA_CIE_ENABLE;
-               mtdcr(DCRN_DMACR3, control);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("enable_dma_interrupt: bad channel: %d\n", dmanr);
-#endif
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-       return DMA_STATUS_GOOD;
-}
-
-
-#ifdef DCRNCAP_DMA_SG
-
-/*
- *   Add a new sgl descriptor to the end of a scatter/gather list
- *   which was created by alloc_dma_handle().
- *
- *   For a memory to memory transfer, both dma addresses must be
- *   valid. For a peripheral to memory transfer, one of the addresses
- *   must be set to NULL, depending on the direction of the transfer:
- *   memory to peripheral: set dst_addr to NULL,
- *   peripheral to memory: set src_addr to NULL.
- */
-static __inline__ int
-add_405gp_dma_sgl(sgl_handle_t handle, dma_addr_t src_addr, dma_addr_t dst_addr,
-       unsigned int count)
-{
-       sgl_list_info_t *psgl = (sgl_list_info_t *)handle;
-       ppc_dma_ch_t *p_dma_ch;
-
-       if (!handle) {
-#ifdef DEBUG_405DMA
-               printk("add_dma_sgl: null handle\n");
-#endif
-               return DMA_STATUS_BAD_HANDLE;
-       }
-
-#ifdef DEBUG_405DMA
-       if (psgl->dmanr >= MAX_405GP_DMA_CHANNELS) {
-               printk("add_dma_sgl error: psgl->dmanr == %d\n", psgl->dmanr);
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-#endif
-
-       p_dma_ch = &dma_channels[psgl->dmanr];
-
-#ifdef DEBUG_405DMA
-       {
-       int error = 0;
-       unsigned int aligned = (unsigned)src_addr | (unsigned)dst_addr | count;
-       switch(p_dma_ch->pwidth) {
-       case PW_8:
-               break;
-       case PW_16:
-               if (aligned & 0x1)
-               error = 1;
-               break;
-       case PW_32:
-               if (aligned & 0x3)
-                       error = 1;
-               break;
-       case PW_64:
-               if (aligned & 0x7)
-                       error = 1;
-               break;
-       default:
-               printk("add_dma_sgl: invalid bus width: 0x%x\n",
-                       p_dma_ch->pwidth);
-               return DMA_STATUS_GENERAL_ERROR;
-       }
-       if (error)
-               printk("Alignment warning: add_dma_sgl src 0x%x dst 0x%x count 0x%x bus width var %d\n",
-                       src_addr, dst_addr, count, p_dma_ch->pwidth);
-
-       }
-#endif
-
-       if ((unsigned)(psgl->ptail + 1) >= ((unsigned)psgl + SGL_LIST_SIZE)) {
-#ifdef DEBUG_405DMA
-               printk("sgl handle out of memory \n");
-#endif
-               return DMA_STATUS_OUT_OF_MEMORY;
-       }
-
-
-       if (!psgl->ptail) {
-               psgl->phead = (ppc_sgl_t *)
-                             ((unsigned)psgl + sizeof(sgl_list_info_t));
-               psgl->ptail = psgl->phead;
-       } else {
-               psgl->ptail->next = virt_to_bus(psgl->ptail + 1);
-               psgl->ptail++;
-       }
-
-       psgl->ptail->control       = psgl->control;
-       psgl->ptail->src_addr      = src_addr;
-       psgl->ptail->dst_addr      = dst_addr;
-       psgl->ptail->control_count = (count >> p_dma_ch->shift) |
-                                    psgl->sgl_control;
-       psgl->ptail->next          = (uint32_t)NULL;
-
-       return DMA_STATUS_GOOD;
-}
-
-
-
-/*
- * Enable (start) the DMA described by the sgl handle.
- */
-static __inline__ void enable_405gp_dma_sgl(sgl_handle_t handle)
-{
-       sgl_list_info_t *psgl = (sgl_list_info_t *)handle;
-       ppc_dma_ch_t *p_dma_ch;
-       uint32_t sg_command;
-
-#ifdef DEBUG_405DMA
-       if (!handle) {
-               printk("enable_dma_sgl: null handle\n");
-               return;
-       } else if (psgl->dmanr > (MAX_405GP_DMA_CHANNELS - 1)) {
-               printk("enable_dma_sgl: bad channel in handle %d\n",
-                       psgl->dmanr);
-               return;
-       } else if (!psgl->phead) {
-               printk("enable_dma_sgl: sg list empty\n");
-               return;
-       }
-#endif
-
-       p_dma_ch = &dma_channels[psgl->dmanr];
-       psgl->ptail->control_count &= ~SG_LINK; /* make this the last dscrptr */
-       sg_command = mfdcr(DCRN_ASGC);
-
-       switch(psgl->dmanr) {
-       case 0:
-               mtdcr(DCRN_ASG0, virt_to_bus(psgl->phead));
-               sg_command |= SSG0_ENABLE;
-               break;
-       case 1:
-               mtdcr(DCRN_ASG1, virt_to_bus(psgl->phead));
-               sg_command |= SSG1_ENABLE;
-               break;
-       case 2:
-               mtdcr(DCRN_ASG2, virt_to_bus(psgl->phead));
-               sg_command |= SSG2_ENABLE;
-               break;
-       case 3:
-               mtdcr(DCRN_ASG3, virt_to_bus(psgl->phead));
-               sg_command |= SSG3_ENABLE;
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("enable_dma_sgl: bad channel: %d\n", psgl->dmanr);
-#endif
-       }
-
-#if 0 /* debug */
-       printk("\n\nenable_dma_sgl at dma_addr 0x%x\n",
-               virt_to_bus(psgl->phead));
-       {
-       ppc_sgl_t *pnext, *sgl_addr;
-
-       pnext = psgl->phead;
-       while (pnext) {
-               printk("dma descriptor at 0x%x, dma addr 0x%x\n",
-                       (unsigned)pnext, (unsigned)virt_to_bus(pnext));
-               printk("control 0x%x src 0x%x dst 0x%x c_count 0x%x, next 0x%x\n",
-                       (unsigned)pnext->control, (unsigned)pnext->src_addr,
-                       (unsigned)pnext->dst_addr,
-                       (unsigned)pnext->control_count, (unsigned)pnext->next);
-
-               (unsigned)pnext = bus_to_virt(pnext->next);
-       }
-       printk("sg_command 0x%x\n", sg_command);
-       }
-#endif
-
-#ifdef PCI_ALLOC_IS_NONCONSISTENT
-       /*
-       * This is temporary only, until pci_alloc_consistent() really does
-       * return "consistent" memory.
-       */
-       flush_dcache_range((unsigned)handle, (unsigned)handle + SGL_LIST_SIZE);
-#endif
-
-       mtdcr(DCRN_ASGC, sg_command);             /* start transfer */
-}
-
-
-
-/*
- * Halt an active scatter/gather DMA operation.
- */
-static __inline__ void disable_405gp_dma_sgl(sgl_handle_t handle)
-{
-       sgl_list_info_t *psgl = (sgl_list_info_t *)handle;
-       uint32_t sg_command;
-
-#ifdef DEBUG_405DMA
-       if (!handle) {
-               printk("enable_dma_sgl: null handle\n");
-               return;
-       } else if (psgl->dmanr > (MAX_405GP_DMA_CHANNELS - 1)) {
-               printk("enable_dma_sgl: bad channel in handle %d\n",
-                       psgl->dmanr);
-               return;
-       }
-#endif
-       sg_command = mfdcr(DCRN_ASGC);
-       switch(psgl->dmanr) {
-       case 0:
-               sg_command &= ~SSG0_ENABLE;
-               break;
-       case 1:
-               sg_command &= ~SSG1_ENABLE;
-               break;
-       case 2:
-               sg_command &= ~SSG2_ENABLE;
-               break;
-       case 3:
-               sg_command &= ~SSG3_ENABLE;
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("enable_dma_sgl: bad channel: %d\n", psgl->dmanr);
-#endif
-       }
-
-       mtdcr(DCRN_ASGC, sg_command);             /* stop transfer */
-}
-
-
-
-/*
- *  Returns number of bytes left to be transferred from the entire sgl list.
- *  *src_addr and *dst_addr get set to the source/destination address of
- *  the sgl descriptor where the DMA stopped.
- *
- *  An sgl transfer must NOT be active when this function is called.
- */
-static __inline__ int
-get_405gp_dma_sgl_residue(sgl_handle_t handle, dma_addr_t *src_addr,
-       dma_addr_t *dst_addr)
-{
-       sgl_list_info_t *psgl = (sgl_list_info_t *)handle;
-       ppc_dma_ch_t *p_dma_ch;
-       ppc_sgl_t *pnext, *sgl_addr;
-       uint32_t count_left;
-
-#ifdef DEBUG_405DMA
-       if (!handle) {
-               printk("get_dma_sgl_residue: null handle\n");
-               return DMA_STATUS_BAD_HANDLE;
-       } else if (psgl->dmanr > (MAX_405GP_DMA_CHANNELS - 1)) {
-               printk("get_dma_sgl_residue: bad channel in handle %d\n",
-                       psgl->dmanr);
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-#endif
-
-       switch(psgl->dmanr) {
-       case 0:
-               sgl_addr = (ppc_sgl_t *)bus_to_virt(mfdcr(DCRN_ASG0));
-               count_left = mfdcr(DCRN_DMACT0);
-               break;
-       case 1:
-               sgl_addr = (ppc_sgl_t *)bus_to_virt(mfdcr(DCRN_ASG1));
-               count_left = mfdcr(DCRN_DMACT1);
-               break;
-       case 2:
-               sgl_addr = (ppc_sgl_t *)bus_to_virt(mfdcr(DCRN_ASG2));
-               count_left = mfdcr(DCRN_DMACT2);
-               break;
-       case 3:
-               sgl_addr = (ppc_sgl_t *)bus_to_virt(mfdcr(DCRN_ASG3));
-               count_left = mfdcr(DCRN_DMACT3);
-               break;
-       default:
-#ifdef DEBUG_405DMA
-               printk("get_dma_sgl_residue: bad channel: %d\n", psgl->dmanr);
-#endif
-               goto error;
-       }
-
-       if (!sgl_addr) {
-#ifdef DEBUG_405DMA
-               printk("get_dma_sgl_residue: sgl addr register is null\n");
-#endif
-               goto error;
-       }
-
-       pnext = psgl->phead;
-       while (pnext &&
-               ((unsigned)pnext < ((unsigned)psgl + SGL_LIST_SIZE) &&
-               (pnext != sgl_addr))
-             ) {
-               pnext = pnext++;
-       }
-
-       if (pnext == sgl_addr) {           /* found the sgl descriptor */
-
-               *src_addr = pnext->src_addr;
-               *dst_addr = pnext->dst_addr;
-
-               /*
-                * Now search the remaining descriptors and add their count.
-                * We already have the remaining count from this descriptor in
-                * count_left.
-                */
-               pnext++;
-
-               while ((pnext != psgl->ptail) &&
-                       ((unsigned)pnext < ((unsigned)psgl + SGL_LIST_SIZE))
-                     ) {
-                       count_left += pnext->control_count & SG_COUNT_MASK;
-               }
-
-               if (pnext != psgl->ptail) { /* should never happen */
-#ifdef DEBUG_405DMA
-                       printk("get_dma_sgl_residue error (1) psgl->ptail 0x%x handle 0x%x\n",
-                               (unsigned int)psgl->ptail,
-                               (unsigned int)handle);
-#endif
-                       goto error;
-               }
-
-               /* success */
-               p_dma_ch = &dma_channels[psgl->dmanr];
-               return (count_left << p_dma_ch->shift);  /* count in bytes */
-
-       } else {
-       /* this shouldn't happen */
-#ifdef DEBUG_405DMA
-               printk("get_dma_sgl_residue, unable to match current address 0x%x, handle 0x%x\n",
-                       (unsigned int)sgl_addr, (unsigned int)handle);
-
-#endif
-       }
-
-
-error:
-       *src_addr = (dma_addr_t)NULL;
-       *dst_addr = (dma_addr_t)NULL;
-       return 0;
-}
-
-
-
-
-/*
- * Returns the address(es) of the buffer(s) contained in the head element of
- * the scatter/gather list.  The element is removed from the scatter/gather
- * list and the next element becomes the head.
- *
- * This function should only be called when the DMA is not active.
- */
-static __inline__ int
-delete_405gp_dma_sgl_element(sgl_handle_t handle, dma_addr_t *src_dma_addr,
-       dma_addr_t *dst_dma_addr)
-{
-       sgl_list_info_t *psgl = (sgl_list_info_t *)handle;
-
-#ifdef DEBUG_405DMA
-       if (!handle) {
-               printk("delete_sgl_element: null handle\n");
-               return DMA_STATUS_BAD_HANDLE;
-       } else if (psgl->dmanr > (MAX_405GP_DMA_CHANNELS - 1)) {
-               printk("delete_sgl_element: bad channel in handle %d\n",
-                       psgl->dmanr);
-               return DMA_STATUS_BAD_CHANNEL;
-       }
-#endif
-
-       if (!psgl->phead) {
-#ifdef DEBUG_405DMA
-               printk("delete_sgl_element: sgl list empty\n");
-#endif
-               *src_dma_addr = (dma_addr_t)NULL;
-               *dst_dma_addr = (dma_addr_t)NULL;
-               return DMA_STATUS_SGL_LIST_EMPTY;
-       }
-
-       *src_dma_addr = (dma_addr_t)psgl->phead->src_addr;
-       *dst_dma_addr = (dma_addr_t)psgl->phead->dst_addr;
-
-       if (psgl->phead == psgl->ptail) {
-               /* last descriptor on the list */
-               psgl->phead = NULL;
-               psgl->ptail = NULL;
-       } else {
-               psgl->phead++;
-       }
-
-       return DMA_STATUS_GOOD;
-}
-
-#endif /* DCRNCAP_DMA_SG */
-
-/*
- * The rest of the DMA API, in ppc405_dma.c
- */
-extern int hw_init_dma_channel(unsigned int,  ppc_dma_ch_t *);
-extern int get_channel_config(unsigned int, ppc_dma_ch_t *);
-extern int set_channel_priority(unsigned int, unsigned int);
-extern unsigned int get_peripheral_width(unsigned int);
-extern int alloc_dma_handle(sgl_handle_t *, unsigned int, unsigned int);
-extern void free_dma_handle(sgl_handle_t);
-
-#endif
-#endif /* __KERNEL__ */
index b60773a..ca2c16b 100644 (file)
@@ -54,6 +54,9 @@ typedef struct bd_info {
        unsigned long   bi_sramsize;    /* size  of SRAM memory */
 #if defined(CONFIG_8xx) || defined(CONFIG_CPM2) || defined(CONFIG_85xx)
        unsigned long   bi_immr_base;   /* base of IMMR register */
+#endif
+#if defined(CONFIG_PPC_MPC52xx)
+       unsigned long   bi_mbar_base;   /* base of internal registers */
 #endif
        unsigned long   bi_bootflags;   /* boot / reboot flag (for LynxOS) */
        unsigned long   bi_ip_addr;     /* IP Address */
@@ -66,6 +69,10 @@ typedef struct bd_info {
        unsigned long   bi_brgfreq;     /* BRG_CLK Freq, in MHz */
        unsigned long   bi_sccfreq;     /* SCC_CLK Freq, in MHz */
        unsigned long   bi_vco;         /* VCO Out from PLL, in MHz */
+#endif
+#if defined(CONFIG_PPC_MPC52xx)
+       unsigned long   bi_ipbfreq;     /* IPB Bus Freq, in MHz */
+       unsigned long   bi_pcifreq;     /* PCI Bus Freq, in MHz */
 #endif
        unsigned long   bi_baudrate;    /* Console Baudrate */
 #if defined(CONFIG_405GP)
index 15c93af..73eab45 100644 (file)
 #define DBAT6U SPRN_DBAT6U     /* Data BAT 6 Upper Register */
 #define DBAT7L SPRN_DBAT7L     /* Data BAT 7 Lower Register */
 #define DBAT7U SPRN_DBAT7U     /* Data BAT 7 Upper Register */
-#define DEC    SPRN_DEC        /* Decrement Register */
+//#define DEC  SPRN_DEC        /* Decrement Register */
 #define DMISS  SPRN_DMISS      /* Data TLB Miss Register */
 #define DSISR  SPRN_DSISR      /* Data Storage Interrupt Status Register */
 #define EAR    SPRN_EAR        /* External Address Register */
 #define IMMR   SPRN_IMMR       /* PPC 860/821 Internal Memory Map Register */
 #define L2CR   SPRN_L2CR       /* Classic PPC L2 cache control register */
 #define L3CR   SPRN_L3CR       /* PPC 745x L3 cache control register */
-#define LR     SPRN_LR
+//#define LR   SPRN_LR
 #define PVR    SPRN_PVR        /* Processor Version */
-#define RPA    SPRN_RPA        /* Required Physical Address Register */
+//#define RPA  SPRN_RPA        /* Required Physical Address Register */
 #define SDR1   SPRN_SDR1       /* MMU hash base register */
 #define SPR0   SPRN_SPRG0      /* Supervisor Private Registers */
 #define SPR1   SPRN_SPRG1
 #define SVR_8555E      0x80790000
 #define SVR_8560       0x80700000
 
+#if 0
 /* Segment Registers */
 #define SR0    0
 #define SR1    1
 #define SR13   13
 #define SR14   14
 #define SR15   15
+#endif
 
 /* Macros for setting and retrieving special purpose registers */
 #ifndef __ASSEMBLY__
index 032ea53..f4325ea 100644 (file)
@@ -36,7 +36,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index c77cfb4..310206e 100644 (file)
@@ -10,8 +10,6 @@
 
 #if defined(CONFIG_EV64260)
 #include <platforms/ev64260.h>
-#elif defined(CONFIG_DMV182)
-#include <platforms/dmv182_serial.h>
 #elif defined(CONFIG_GEMINI)
 #include <platforms/gemini_serial.h>
 #elif defined(CONFIG_POWERPMC250)
index aac30af..10aeae0 100644 (file)
@@ -34,7 +34,8 @@
        ((addr) <= current->thread.fs.seg                                   \
         && ((size) == 0 || (size) - 1 <= current->thread.fs.seg - (addr)))
 
-#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size))
+#define access_ok(type, addr, size) \
+       (__chk_user_ptr(addr),__access_ok((unsigned long)(addr),(size)))
 
 extern inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
@@ -105,6 +106,7 @@ extern long __put_user_bad(void);
 #define __put_user_nocheck(x,ptr,size)                 \
 ({                                                     \
        long __pu_err;                                  \
+       __chk_user_ptr(ptr);                            \
        __put_user_size((x),(ptr),(size),__pu_err);     \
        __pu_err;                                       \
 })
@@ -112,7 +114,7 @@ extern long __put_user_bad(void);
 #define __put_user_check(x,ptr,size)                           \
 ({                                                             \
        long __pu_err = -EFAULT;                                \
-       __typeof__(*(ptr)) *__pu_addr = (ptr);                  \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);           \
        if (access_ok(VERIFY_WRITE,__pu_addr,size))             \
                __put_user_size((x),__pu_addr,(size),__pu_err); \
        __pu_err;                                               \
@@ -179,6 +181,7 @@ do {                                                        \
 #define __get_user_nocheck(x, ptr, size)                       \
 ({                                                             \
        long __gu_err, __gu_val;                                \
+       __chk_user_ptr(ptr);                                    \
        __get_user_size(__gu_val, (ptr), (size), __gu_err);     \
        (x) = (__typeof__(*(ptr)))__gu_val;                     \
        __gu_err;                                               \
@@ -188,6 +191,7 @@ do {                                                        \
 ({                                                             \
        long __gu_err;                                          \
        long long __gu_val;                                     \
+       __chk_user_ptr(ptr);                                    \
        __get_user_size64(__gu_val, (ptr), (size), __gu_err);   \
        (x) = (__typeof__(*(ptr)))__gu_val;                     \
        __gu_err;                                               \
@@ -196,7 +200,7 @@ do {                                                        \
 #define __get_user_check(x, ptr, size)                                 \
 ({                                                                     \
        long __gu_err = -EFAULT, __gu_val = 0;                          \
-       const __typeof__(*(ptr)) *__gu_addr = (ptr);                    \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
        if (access_ok(VERIFY_READ, __gu_addr, (size)))                  \
                __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
        (x) = (__typeof__(*(ptr)))__gu_val;                             \
@@ -207,7 +211,7 @@ do {                                                        \
 ({                                                                       \
        long __gu_err = -EFAULT;                                          \
        long long __gu_val = 0;                                           \
-       const __typeof__(*(ptr)) *__gu_addr = (ptr);                      \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);               \
        if (access_ok(VERIFY_READ, __gu_addr, (size)))                    \
                __get_user_size64(__gu_val, __gu_addr, (size), __gu_err); \
        (x) = (__typeof__(*(ptr)))__gu_val;                               \
index d5e44bf..a877ce9 100644 (file)
@@ -180,27 +180,96 @@ static inline void eeh_raw_writeq(u64 val, void *addr) {
        out_be64(vaddr, val);
 }
 
+#define EEH_CHECK_ALIGN(v,a) \
+       ((((unsigned long)(v)) & ((a) - 1)) == 0)
+
 static inline void eeh_memset_io(void *addr, int c, unsigned long n) {
        void *vaddr = (void *)IO_TOKEN_TO_ADDR(addr);
-       memset(vaddr, c, n);
+       u32 lc = c;
+       lc |= lc << 8;
+       lc |= lc << 16;
+
+       while(n && !EEH_CHECK_ALIGN(vaddr, 4)) {
+               *((volatile u8 *)vaddr) = c;
+               vaddr = (void *)((unsigned long)vaddr + 1);
+               n--;
+       }
+       while(n >= 4) {
+               *((volatile u32 *)vaddr) = lc;
+               vaddr = (void *)((unsigned long)vaddr + 4);
+               n -= 4;
+       }
+       while(n) {
+               *((volatile u8 *)vaddr) = c;
+               vaddr = (void *)((unsigned long)vaddr + 1);
+               n--;
+       }
+       __asm__ __volatile__ ("sync" : : : "memory");
 }
 static inline void eeh_memcpy_fromio(void *dest, void *src, unsigned long n) {
        void *vsrc = (void *)IO_TOKEN_TO_ADDR(src);
-       memcpy(dest, vsrc, n);
+       void *vsrcsave = vsrc, *destsave = dest, *srcsave = src;
+       unsigned long nsave = n;
+
+       while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
+               *((u8 *)dest) = *((volatile u8 *)vsrc);
+               __asm__ __volatile__ ("eieio" : : : "memory");
+               vsrc = (void *)((unsigned long)vsrc + 1);
+               dest = (void *)((unsigned long)dest + 1);                       
+               n--;
+       }
+       while(n > 4) {
+               *((u32 *)dest) = *((volatile u32 *)vsrc);
+               __asm__ __volatile__ ("eieio" : : : "memory");
+               vsrc = (void *)((unsigned long)vsrc + 4);
+               dest = (void *)((unsigned long)dest + 4);                       
+               n -= 4;
+       }
+       while(n) {
+               *((u8 *)dest) = *((volatile u8 *)vsrc);
+               __asm__ __volatile__ ("eieio" : : : "memory");
+               vsrc = (void *)((unsigned long)vsrc + 1);
+               dest = (void *)((unsigned long)dest + 1);                       
+               n--;
+       }
+       __asm__ __volatile__ ("sync" : : : "memory");
+
        /* Look for ffff's here at dest[n].  Assume that at least 4 bytes
         * were copied. Check all four bytes.
         */
-       if ((n >= 4) &&
-               (EEH_POSSIBLE_ERROR(src, vsrc, (*((u32 *) dest+n-4)), u32))) {
-               eeh_check_failure(src, (*((u32 *) dest+n-4)));
+       if ((nsave >= 4) &&
+               (EEH_POSSIBLE_ERROR(srcsave, vsrcsave, (*((u32 *) destsave+nsave-4)),
+                                   u32))) {
+               eeh_check_failure(srcsave, (*((u32 *) destsave+nsave-4)));
        }
 }
 
 static inline void eeh_memcpy_toio(void *dest, void *src, unsigned long n) {
        void *vdest = (void *)IO_TOKEN_TO_ADDR(dest);
-       memcpy(vdest, src, n);
+
+       while(n && (!EEH_CHECK_ALIGN(vdest, 4) || !EEH_CHECK_ALIGN(src, 4))) {
+               *((volatile u8 *)vdest) = *((u8 *)src);
+               src = (void *)((unsigned long)src + 1);
+               vdest = (void *)((unsigned long)vdest + 1);                     
+               n--;
+       }
+       while(n > 4) {
+               *((volatile u32 *)vdest) = *((volatile u32 *)src);
+               src = (void *)((unsigned long)src + 4);
+               vdest = (void *)((unsigned long)vdest + 4);                     
+               n-=4;
+       }
+       while(n) {
+               *((volatile u8 *)vdest) = *((u8 *)src);
+               src = (void *)((unsigned long)src + 1);
+               vdest = (void *)((unsigned long)vdest + 1);                     
+               n--;
+       }
+       __asm__ __volatile__ ("sync" : : : "memory");
 }
 
+#undef EEH_CHECK_ALIGN
+
 #define MAX_ISA_PORT 0x10000
 extern unsigned long io_page_mask;
 #define _IO_IS_VALID(port) ((port) >= MAX_ISA_PORT || (1 << (port>>PAGE_SHIFT)) & io_page_mask)
index 842560d..59a3555 100644 (file)
@@ -28,6 +28,7 @@
 #define O_LARGEFILE     0200000
 #define O_DIRECT       0400000 /* direct disk access hint */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP 02000000 /* do atomic file lookup */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
index 6544827..9c49181 100644 (file)
@@ -9,8 +9,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <linux/config.h>
 #include <linux/threads.h>
-#include <asm/atomic.h>
 
 /*
  * Maximum number of interrupt sources that we can handle.
@@ -46,6 +46,8 @@ static inline unsigned int virt_irq_to_real(unsigned int virt_irq)
        return virt_irq_to_real_map[virt_irq];
 }
 
+extern unsigned int real_irq_to_virt_slowpath(unsigned int real_irq);
+
 /*
  * Because many systems have two overlapping names spaces for
  * interrupts (ISA and XICS for example), and the ISA interrupts
index 54a1466..3b66f32 100644 (file)
@@ -37,12 +37,6 @@ typedef struct {
                mm_context_t ctx = { .id = REGION_ID(ea), KERNEL_LOW_HPAGES}; \
                ctx; })
 
-/*
- * Hardware Segment Lookaside Buffer Entry
- * This structure has been padded out to two 64b doublewords (actual SLBE's are
- * 94 bits).  This padding facilites use by the segment management
- * instructions.
- */
 typedef struct {
        unsigned long esid: 36; /* Effective segment ID */
        unsigned long resv0:20; /* Reserved */
@@ -71,35 +65,6 @@ typedef struct _STE {
        } dw1;
 } STE;
 
-typedef struct {
-       unsigned long esid: 36; /* Effective segment ID */
-       unsigned long v:     1; /* Entry valid (v=1) or invalid */
-       unsigned long null1:15; /* padding to a 64b boundary */
-       unsigned long index:12; /* Index to select SLB entry. Used by slbmte */
-} slb_dword0;
-
-typedef struct {
-       unsigned long vsid: 52; /* Virtual segment ID */
-       unsigned long ks:    1; /* Supervisor (privileged) state storage key */
-       unsigned long kp:    1; /* Problem state storage key */
-       unsigned long n:     1; /* No-execute if n=1 */
-       unsigned long l:     1; /* Virt pages are large (l=1) or 4KB (l=0) */
-       unsigned long c:     1; /* Class */
-       unsigned long resv0: 7; /* Padding to a 64b boundary */
-} slb_dword1;
-
-typedef struct {
-       union {
-               unsigned long dword0;
-               slb_dword0    dw0;
-       } dw0;
-
-       union {
-               unsigned long dword1;
-               slb_dword1    dw1;
-       } dw1;
-} SLBE;
-
 /* Hardware Page Table Entry */
 
 #define HPTES_PER_GROUP 8
@@ -259,6 +224,30 @@ extern void htab_finish_init(void);
 #define STAB0_PHYS_ADDR        (STAB0_PAGE<<PAGE_SHIFT)
 #define STAB0_VIRT_ADDR        (KERNELBASE+STAB0_PHYS_ADDR)
 
+#define SLB_NUM_BOLTED         2
+#define SLB_CACHE_ENTRIES      8
+
+/* Bits in the SLB ESID word */
+#define SLB_ESID_V             0x0000000008000000      /* entry is valid */
+
+/* Bits in the SLB VSID word */
+#define SLB_VSID_SHIFT         12
+#define SLB_VSID_KS            0x0000000000000800
+#define SLB_VSID_KP            0x0000000000000400
+#define SLB_VSID_N             0x0000000000000200      /* no-execute */
+#define SLB_VSID_L             0x0000000000000100      /* largepage (4M) */
+#define SLB_VSID_C             0x0000000000000080      /* class */
+
+#define SLB_VSID_KERNEL                (SLB_VSID_KP|SLB_VSID_C)
+#define SLB_VSID_USER          (SLB_VSID_KP|SLB_VSID_KS)
+
+#define VSID_RANDOMIZER ASM_CONST(42470972311)
+#define VSID_MASK      0xfffffffffUL
+/* Because we never access addresses below KERNELBASE as kernel
+ * addresses, this VSID is never used for anything real, and will
+ * never have pages hashed into it */
+#define BAD_VSID       ASM_CONST(0)
+
 /* Block size masks */
 #define BL_128K        0x000
 #define BL_256K 0x001
index 505ad13..03561b5 100644 (file)
@@ -136,7 +136,7 @@ destroy_context(struct mm_struct *mm)
 }
 
 extern void flush_stab(struct task_struct *tsk, struct mm_struct *mm);
-extern void flush_slb(struct task_struct *tsk, struct mm_struct *mm);
+extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
 
 /*
  * switch_mm is the entry point called from the architecture independent
@@ -161,7 +161,7 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
                return;
 
        if (cur_cpu_spec->cpu_features & CPU_FTR_SLB)
-               flush_slb(tsk, next);
+               switch_slb(tsk, next);
        else
                flush_stab(tsk, next);
 }
@@ -181,10 +181,6 @@ static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
        local_irq_restore(flags);
 }
 
-#define VSID_RANDOMIZER 42470972311UL
-#define VSID_MASK      0xfffffffffUL
-
-
 /* This is only valid for kernel (including vmalloc, imalloc and bolted) EA's
  */
 static inline unsigned long
index 0eab911..851082c 100644 (file)
@@ -78,20 +78,26 @@ struct paca_struct {
        u64 exmc[8];            /* used for machine checks */
        u64 exslb[8];           /* used for SLB/segment table misses
                                 * on the linear mapping */
-       u64 exdsi[8];           /* used for linear mapping hash table misses */
+       u64 slb_r3;             /* spot to save R3 on SLB miss */
+       mm_context_t context;
+       u16 slb_cache[SLB_CACHE_ENTRIES];
+       u16 slb_cache_ptr;
 
        /*
         * then miscellaneous read-write fields
         */
        struct task_struct *__current;  /* Pointer to current */
        u64 kstack;                     /* Saved Kernel stack addr */
-       u64 stab_next_rr;               /* stab/slb round-robin counter */
+       u64 stab_rr;                    /* stab/slb round-robin counter */
        u64 next_jiffy_update_tb;       /* TB value for next jiffy update */
        u64 saved_r1;                   /* r1 save for RTAS calls */
        u64 saved_msr;                  /* MSR saved here by enter_rtas */
        u32 lpevent_count;              /* lpevents processed  */
        u8 proc_enabled;                /* irq soft-enable flag */
 
+       /* not yet used */
+       u64 exdsi[8];           /* used for linear mapping hash table misses */
+
        /*
         * iSeries structues which the hypervisor knows about - Not
         * sure if these particularly need to be cacheline aligned.
index b144b14..9d390be 100644 (file)
@@ -27,6 +27,7 @@
 
 #define SID_SHIFT       28
 #define SID_MASK        0xfffffffffUL
+#define ESID_MASK      0xfffffffff0000000UL
 #define GET_ESID(x)     (((x) >> SID_SHIFT) & SID_MASK)
 
 #ifdef CONFIG_HUGETLB_PAGE
@@ -37,8 +38,8 @@
 #define HUGETLB_PAGE_ORDER     (HPAGE_SHIFT - PAGE_SHIFT)
 
 /* For 64-bit processes the hugepage range is 1T-1.5T */
-#define TASK_HPAGE_BASE        (0x0000010000000000UL)
-#define TASK_HPAGE_END         (0x0000018000000000UL)
+#define TASK_HPAGE_BASE ASM_CONST(0x0000010000000000)
+#define TASK_HPAGE_END         ASM_CONST(0x0000018000000000)
 
 #define LOW_ESID_MASK(addr, len)       (((1U << (GET_ESID(addr+len-1)+1)) \
                                        - (1U << GET_ESID(addr))) & 0xffff)
@@ -245,5 +246,7 @@ extern int page_is_ram(unsigned long physaddr);
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 #endif /* _PPC64_PAGE_H */
index 341c951..0378011 100644 (file)
 #define        PVR     SPRN_PVR        /* Processor Version */
 #define        PIR     SPRN_PIR        /* Processor ID */
 #define        PURR    SPRN_PURR       /* Processor Utilization of Resource Register */
-#define        RPA     SPRN_RPA        /* Required Physical Address Register */
+//#define      RPA     SPRN_RPA        /* Required Physical Address Register */
 #define        SDR1    SPRN_SDR1       /* MMU hash base register */
 #define        SPR0    SPRN_SPRG0      /* Supervisor Private Registers */
 #define        SPR1    SPRN_SPRG1
@@ -633,6 +633,8 @@ static inline void prefetchw(const void *x)
 
 #endif /* ASSEMBLY */
 
+#define HAVE_ARCH_PICK_MMAP_LAYOUT
+
 /*
  * Number of entries in the SLB. If this ever changes we should handle
  * it with a use a cpu feature fixup.
index fdc158a..87db2ec 100644 (file)
@@ -269,6 +269,7 @@ extern unsigned char *get_property(struct device_node *node, const char *name,
 extern void print_properties(struct device_node *node);
 extern int prom_n_addr_cells(struct device_node* np);
 extern int prom_n_size_cells(struct device_node* np);
+extern int prom_n_intr_cells(struct device_node* np);
 extern void prom_get_irq_senses(unsigned char *senses, int off, int max);
 extern void prom_add_property(struct device_node* np, struct property* prop);
 
index 0edebf0..d95a919 100644 (file)
@@ -45,7 +45,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index 8a20f95..16dbcb9 100644 (file)
@@ -175,7 +175,7 @@ do {                                                                        \
 #define __get_user_check(x,ptr,size)                                   \
 ({                                                                     \
        long __gu_err = -EFAULT, __gu_val = 0;                          \
-       const __typeof__(*(ptr)) *__gu_addr = (ptr);                    \
+       const __typeof__(*(ptr)) __user *__gu_addr = (ptr);             \
        if (access_ok(VERIFY_READ,__gu_addr,size))                      \
                __get_user_size(__gu_val,__gu_addr,(size),__gu_err,-EFAULT);\
        (x) = (__typeof__(*(ptr)))__gu_val;                             \
index 48f692b..c36e16d 100644 (file)
@@ -28,6 +28,7 @@
 #define O_DIRECTORY    0200000 /* must be a directory */
 #define O_NOFOLLOW     0400000 /* don't follow links */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP 02000000        /* do atomic file lookup (tux) */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
index 6bed8d9..f377bc1 100644 (file)
@@ -181,6 +181,8 @@ typedef struct { unsigned long pgd; } pgd_t;
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _S390_PAGE_H */
index 4c9d607..b99592e 100644 (file)
@@ -76,6 +76,8 @@ extern struct task_struct *last_task_used_math;
 
 #define MM_VM_SIZE(mm)         DEFAULT_TASK_SIZE
 
+#define HAVE_ARCH_PICK_MMAP_LAYOUT
+
 typedef struct {
         __u32 ar4;
 } mm_segment_t;
index 3ba323b..68ba34e 100644 (file)
@@ -47,7 +47,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        { INR_OPEN, INR_OPEN },                         \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index edd2934..a19c266 100644 (file)
@@ -133,6 +133,8 @@ static __inline__ int get_order(unsigned long size)
 
 #endif
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* __ASM_SH_PAGE_H */
index 390630f..b3d6ae5 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE,     PAGE_SIZE     },               \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index df9c75d..8464d26 100644 (file)
@@ -20,6 +20,7 @@
 #define O_DIRECTORY    0x10000 /* must be a directory */
 #define O_NOFOLLOW     0x20000 /* don't follow links */
 #define O_LARGEFILE    0x40000
+#define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */
 #define O_DIRECT        0x100000 /* direct disk access hint */
 #define O_NOATIME      0x200000
 
index 383060e..fb230be 100644 (file)
@@ -176,6 +176,8 @@ extern unsigned long pfn_base;
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* __KERNEL__ */
 
 #endif /* _SPARC_PAGE_H */
index 623c068..d200a25 100644 (file)
@@ -87,12 +87,6 @@ extern dma_addr_t pci_map_page(struct pci_dev *hwdev, struct page *page,
 extern void pci_unmap_page(struct pci_dev *hwdev,
                        dma_addr_t dma_address, size_t size, int direction);
 
-/* map_page and map_single cannot fail */
-static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
-{
-       return 0;
-}
-
 /* Map a set of buffers described by scatterlist in streaming
  * mode for DMA.  This is the scather-gather version of the
  * above pci_map_single interface.  Here the scatter gather list
@@ -154,6 +148,13 @@ static inline void pcibios_add_platform_entries(struct pci_dev *dev)
 {
 }
 
+#define PCI_DMA_ERROR_CODE      (~(dma_addr_t)0x0)
+
+static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
+{
+        return (dma_addr == PCI_DMA_ERROR_CODE);
+}
+
 #endif /* __KERNEL__ */
 
 /* generic pci stuff */
index 280fcd2..7df635a 100644 (file)
@@ -44,7 +44,7 @@
     {       0, RLIM_INFINITY},         \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {INR_OPEN, INR_OPEN}, {0, 0},      \
-    {PAGE_SIZE, PAGE_SIZE},    \
+    {32768,         32768},    \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {MAX_SIGPENDING, MAX_SIGPENDING},  \
index fc19316..b04024f 100644 (file)
@@ -9,7 +9,8 @@
 /* These are the same regardless of whether this is an SMP kernel or not. */
 #define flush_cache_mm(__mm) \
        do { if ((__mm) == current->mm) flushw_user(); } while(0)
-extern void flush_cache_range(struct vm_area_struct *, unsigned long, unsigned long);
+#define flush_cache_range(vma, start, end) \
+       flush_cache_mm((vma)->vm_mm)
 #define flush_cache_page(vma, page) \
        flush_cache_mm((vma)->vm_mm)
 
index e36def0..42c8ab4 100644 (file)
@@ -20,6 +20,7 @@
 #define O_DIRECTORY    0x10000 /* must be a directory */
 #define O_NOFOLLOW     0x20000 /* don't follow links */
 #define O_LARGEFILE    0x40000
+#define O_ATOMICLOOKUP 0x80000 /* do atomic file lookup */
 #define O_DIRECT        0x100000 /* direct disk access hint */
 #define O_NOATIME      0x200000
 
index b8d0117..45ff8ed 100644 (file)
@@ -18,7 +18,7 @@ extern void _clear_page(void *page);
 #define clear_page(X)  _clear_page((void *)(X))
 struct page;
 extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
-#define copy_page(X,Y) __memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
+#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
 extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
 
 /* GROSS, defining this makes gcc pass these types as aggregates,
@@ -165,6 +165,8 @@ static __inline__ int get_order(unsigned long size)
 #define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
+#define devmem_is_allowed(x) 1
+
 #endif /* !(__KERNEL__) */
 
 #endif /* !(_SPARC64_PAGE_H) */
index 6fa1a1b..91b30ef 100644 (file)
@@ -188,14 +188,29 @@ static __inline__ void free_pmd_slow(pmd_t *pmd)
 #define pmd_populate(MM,PMD,PTE_PAGE)          \
        pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
 
-extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address);
+extern pte_t *__pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address);
+
+static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+{
+       pte_t *pte = __pte_alloc_one_kernel(mm, address);
+       if (pte) {
+               struct page *page = virt_to_page(pte);
+               page->mapping = (void *) mm;
+               page->index = address & PMD_MASK;
+       }
+       return pte;
+}
 
 static inline struct page *
 pte_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
-       pte_t *pte = pte_alloc_one_kernel(mm, addr);
-       if (pte)
-               return virt_to_page(pte);
+       pte_t *pte = __pte_alloc_one_kernel(mm, addr);
+       if (pte) {
+               struct page *page = virt_to_page(pte);
+               page->mapping = (void *) mm;
+               page->index = addr & PMD_MASK;
+               return page;
+       }
        return NULL;
 }
 
@@ -230,8 +245,18 @@ static __inline__ void free_pte_slow(pte_t *pte)
        free_page((unsigned long)pte);
 }
 
-#define pte_free_kernel(pte)   free_pte_fast(pte)
-#define pte_free(pte)          free_pte_fast(page_address(pte))
+static inline void pte_free_kernel(pte_t *pte)
+{
+       virt_to_page(pte)->mapping = NULL;
+       free_pte_fast(pte);
+}
+
+static inline void pte_free(struct page *ptepage)
+{
+       ptepage->mapping = NULL;
+       free_pte_fast(page_address(ptepage));
+}
+
 #define pmd_free(pmd)          free_pmd_fast(pmd)
 #define pgd_free(pgd)          free_pgd_fast(pgd)
 #define pgd_alloc(mm)          get_pgd_fast()
index cdb6545..cb0b469 100644 (file)
 
 #include <linux/sched.h>
 
-/* Certain architectures need to do special things when pte's
- * within a page table are directly modified.  Thus, the following
- * hook is made available.
- */
-#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
-
 /* Entries per page directory level. */
 #define PTRS_PER_PTE           (1UL << (PAGE_SHIFT-3))
 
  * is different so we can optimize correctly for 32-bit tasks.
  */
 #define REAL_PTRS_PER_PMD      (1UL << PMD_BITS)
-#define PTRS_PER_PMD           ((const int)(test_thread_flag(TIF_32BIT) ? \
-                                (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : \
-                                (REAL_PTRS_PER_PMD)))
+
+/* This is gross, but unless we do this gcc retests the
+ * thread flag every interation in pmd traversal loops.
+ */
+extern unsigned long __ptrs_per_pmd(void) __attribute_const__;
+#define PTRS_PER_PMD           __ptrs_per_pmd()
 
 /*
  * We cannot use the top address range because VPTE table lives there. This
@@ -273,7 +270,6 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
        ((unsigned long) __va((((unsigned long)pgd_val(pgd))<<11UL)))
 #define pte_none(pte)                  (!pte_val(pte))
 #define pte_present(pte)               (pte_val(pte) & _PAGE_PRESENT)
-#define pte_clear(pte)                 (pte_val(*(pte)) = 0UL)
 #define pmd_none(pmd)                  (!pmd_val(pmd))
 #define pmd_bad(pmd)                   (0)
 #define pmd_present(pmd)               (pmd_val(pmd) != 0U)
@@ -287,7 +283,7 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
  * Undefined behaviour if not..
  */
 #define pte_read(pte)          (pte_val(pte) & _PAGE_READ)
-#define pte_exec(pte)          pte_read(pte)
+#define pte_exec(pte)          (pte_val(pte) & _PAGE_EXEC)
 #define pte_write(pte)         (pte_val(pte) & _PAGE_WRITE)
 #define pte_dirty(pte)         (pte_val(pte) & _PAGE_MODIFIED)
 #define pte_young(pte)         (pte_val(pte) & _PAGE_ACCESSED)
@@ -329,6 +325,20 @@ static inline pte_t pte_modify(pte_t orig_pte, pgprot_t new_prot)
 #define pte_unmap(pte)                 do { } while (0)
 #define pte_unmap_nested(pte)          do { } while (0)
 
+/* Actual page table PTE updates.  */
+extern void tlb_batch_add(pte_t *ptep, pte_t orig);
+
+static inline void set_pte(pte_t *ptep, pte_t pte)
+{
+       pte_t orig = *ptep;
+
+       *ptep = pte;
+       if (pte_present(orig))
+               tlb_batch_add(ptep, orig);
+}
+
+#define pte_clear(ptep)                set_pte((ptep), __pte(0UL))
+
 extern pgd_t swapper_pg_dir[1];
 
 /* These do nothing with the way I have things setup. */
index faeca79..2716da1 100644 (file)
@@ -43,7 +43,7 @@
     {       0, RLIM_INFINITY},         \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {INR_OPEN, INR_OPEN}, {0, 0},      \
-    {PAGE_SIZE,     PAGE_SIZE    },    \
+    {32768,      32768           },    \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {RLIM_INFINITY, RLIM_INFINITY},    \
     {MAX_SIGPENDING, MAX_SIGPENDING},  \
index 7e5459f..fde8521 100644 (file)
 
 #ifdef __KERNEL__
 
+#include <linux/config.h>
 #include <linux/compat.h>
 
+#ifdef CONFIG_COMPAT
+
 typedef union sigval32 {
        int sival_int;
        u32 sival_ptr;
@@ -72,6 +75,7 @@ typedef struct siginfo32 {
                } _sigpoll;
        } _sifields;
 } siginfo_t32;
+#endif /* CONFIG_COMPAT */
 
 #endif /* __KERNEL__ */
 
@@ -85,6 +89,8 @@ typedef struct siginfo32 {
 
 #ifdef __KERNEL__
 
+#ifdef CONFIG_COMPAT
+
 typedef struct sigevent32 {
        sigval_t32 sigev_value;
        int sigev_signo;
@@ -101,6 +107,8 @@ typedef struct sigevent32 {
 
 extern int copy_siginfo_to_user32(siginfo_t32 __user *to, siginfo_t *from);
 
+#endif /* CONFIG_COMPAT */
+
 #endif /* __KERNEL__ */
 
 #endif
index de2bb39..6428e36 100644 (file)
@@ -6,6 +6,7 @@
 
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
+#include <linux/config.h>
 #include <linux/personality.h>
 #include <linux/types.h>
 #include <linux/compat.h>
@@ -208,12 +209,15 @@ struct __new_sigaction {
 };
 
 #ifdef __KERNEL__
+
+#ifdef CONFIG_COMPAT
 struct __new_sigaction32 {
        unsigned                sa_handler;
        unsigned int            sa_flags;
        unsigned                sa_restorer;     /* not used by Linux/SPARC yet */
        compat_sigset_t         sa_mask;
 };
+#endif
 
 struct k_sigaction {
        struct __new_sigaction  sa;
@@ -229,6 +233,8 @@ struct __old_sigaction {
 };
 
 #ifdef __KERNEL__
+
+#ifdef CONFIG_COMPAT
 struct __old_sigaction32 {
        unsigned                sa_handler;
        compat_old_sigset_t     sa_mask;
@@ -237,6 +243,8 @@ struct __old_sigaction32 {
 };
 #endif
 
+#endif
+
 typedef struct sigaltstack {
        void                    __user *ss_sp;
        int                     ss_flags;
@@ -244,11 +252,14 @@ typedef struct sigaltstack {
 } stack_t;
 
 #ifdef __KERNEL__
+
+#ifdef CONFIG_COMPAT
 typedef struct sigaltstack32 {
        u32                     ss_sp;
        int                     ss_flags;
        compat_size_t           ss_size;
 } stack_t32;
+#endif
 
 struct signal_deliver_cookie {
        int restart_syscall;
index 08a6e55..a995805 100644 (file)
@@ -41,22 +41,8 @@ typedef unsigned char spinlock_t;
 do {   membar("#LoadLoad");    \
 } while(*((volatile unsigned char *)lock))
 
-static __inline__ void _raw_spin_lock(spinlock_t *lock)
-{
-       __asm__ __volatile__(
-"1:    ldstub          [%0], %%g7\n"
-"      brnz,pn         %%g7, 2f\n"
-"       membar         #StoreLoad | #StoreStore\n"
-"      .subsection     2\n"
-"2:    ldub            [%0], %%g7\n"
-"      brnz,pt         %%g7, 2b\n"
-"       membar         #LoadLoad\n"
-"      b,a,pt          %%xcc, 1b\n"
-"      .previous\n"
-       : /* no outputs */
-       : "r" (lock)
-       : "g7", "memory");
-}
+/* arch/sparc64/lib/spinlock.S */
+extern void _raw_spin_lock(spinlock_t *lock);
 
 static __inline__ int _raw_spin_trylock(spinlock_t *lock)
 {
index f989fbd..d1a5362 100644 (file)
@@ -47,6 +47,7 @@ struct thread_info {
        struct pt_regs          *kregs;
        struct exec_domain      *exec_domain;
        int                     preempt_count;
+       int                     __pad;
 
        unsigned long           *utraps;
 
@@ -101,10 +102,11 @@ struct thread_info {
 #define TI_FPREGS      0x00000500
 
 /* We embed this in the uppermost byte of thread_info->flags */
-#define FAULT_CODE_WRITE       0x01    /* Write access, implies D-TLB          */
-#define FAULT_CODE_DTLB                0x02    /* Miss happened in D-TLB               */
-#define FAULT_CODE_ITLB                0x04    /* Miss happened in I-TLB               */
-#define FAULT_CODE_WINFIXUP    0x08    /* Miss happened during spill/fill      */
+#define FAULT_CODE_WRITE       0x01    /* Write access, implies D-TLB     */
+#define FAULT_CODE_DTLB                0x02    /* Miss happened in D-TLB          */
+#define FAULT_CODE_ITLB                0x04    /* Miss happened in I-TLB          */
+#define FAULT_CODE_WINFIXUP    0x08    /* Miss happened during spill/fill */
+#define FAULT_CODE_BLKCOMMIT   0x10    /* Use blk-commit ASI in copy_page */
 
 #if PAGE_SHIFT == 13
 #define THREAD_SIZE (2*PAGE_SIZE)
@@ -218,10 +220,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define TIF_NEWSIGNALS         6       /* wants new-style signals */
 #define TIF_32BIT              7       /* 32-bit binary */
 #define TIF_NEWCHILD           8       /* just-spawned child process */
-
-/* XXX Make this one FAULT_CODE_BLKCOMMIT XXX */
-#define TIF_BLKCOMMIT          9       /* use ASI_BLK_COMMIT_* in copy_user_page */
-
+/* TIF_* value 9 is available */
 #define TIF_POLLING_NRFLAG     10
 #define TIF_SYSCALL_SUCCESS    11
 /* NOTE: Thread flags >= 12 should be ones we have no interest
@@ -239,7 +238,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
 #define _TIF_NEWSIGNALS                (1<<TIF_NEWSIGNALS)
 #define _TIF_32BIT             (1<<TIF_32BIT)
 #define _TIF_NEWCHILD          (1<<TIF_NEWCHILD)
-#define _TIF_BLKCOMMIT         (1<<TIF_BLKCOMMIT)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
 #define _TIF_ABI_PENDING       (1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_SUCCESS   (1<<TIF_SYSCALL_SUCCESS)
index 4ad178b..8e7134b 100644 (file)
@@ -45,6 +45,7 @@ extern void *to_virt(unsigned long phys);
 
 extern struct page *arch_validate(struct page *page, int mask, int order);
 #define HAVE_ARCH_VALIDATE
+#define devmem_is_allowed(x) 1
 
 extern void arch_free_page(struct page *page, int order);
 #define HAVE_ARCH_FREE_PAGE
index b60bd23..7c4ecaf 100644 (file)
@@ -267,6 +267,12 @@ found_middle:
        return result + generic_ffs_for_find_next_bit(tmp);
 }
 
+/*
+ * find_first_bit - find the first set bit in a memory region
+ */
+#define find_first_bit(addr, size) \
+       find_next_bit((addr), (size), 0)
+
 
 #define ffs(x) generic_ffs (x)
 #define fls(x) generic_fls (x)
index 06085b0..60d9ea1 100644 (file)
@@ -141,6 +141,8 @@ extern __inline__ int get_order (unsigned long size)
 #define __va(x)                     ((void *)__phys_to_virt ((unsigned long)(x)))
 
 
+#define devmem_is_allowed(x) 1
+
 #endif /* KERNEL */
 
 #endif /* __V850_PAGE_H__ */
index 25fbc6d..27d2f58 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE, PAGE_SIZE  },              \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index c1e04aa..3acf9f2 100644 (file)
@@ -118,7 +118,7 @@ typedef u32         compat_old_sigset_t;    /* at least 32 bits */
 typedef u32               compat_sigset_word;
 
 #define COMPAT_OFF_T_MAX       0x7fffffff
-#define COMPAT_LOFF_T_MAX      0x7fffffffffffffff
+#define COMPAT_LOFF_T_MAX      0x7fffffffffffffffL
 
 struct compat_ipc64_perm {
        compat_key_t key;
index 4411f22..89425e2 100644 (file)
@@ -21,6 +21,7 @@
 #define O_DIRECTORY    0200000 /* must be a directory */
 #define O_NOFOLLOW     0400000 /* don't follow links */
 #define O_NOATIME      01000000
+#define O_ATOMICLOOKUP 02000000 /* TUX */
 
 #define F_DUPFD                0       /* dup */
 #define F_GETFD                1       /* get close_on_exec */
index 219d40a..2768b7c 100644 (file)
@@ -166,7 +166,7 @@ enum mp_bustype {
 };
 extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES];
 extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
-extern cpumask_t mp_bus_to_cpumask [MAX_MP_BUSSES];
+extern cpumask_t pci_bus_to_cpumask [256];
 
 extern unsigned int boot_cpu_physical_apicid;
 extern int smp_found_config;
index c5c2b01..c0c8e23 100644 (file)
@@ -148,6 +148,7 @@ extern __inline__ int get_order(unsigned long size)
 struct task_struct;
 struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
 int in_gate_area(struct task_struct *task, unsigned long addr);
+extern int devmem_is_allowed(unsigned long pagenr);
 #endif
 
 #endif /* __KERNEL__ */
index ec696b2..597df19 100644 (file)
@@ -163,10 +163,6 @@ static inline void clear_in_cr4 (unsigned long mask)
 #define MCA_bus__is_a_macro
 
 
-/*
- * User space process size: 512GB - 1GB (default).
- */
-#define TASK_SIZE      (0x0000007fc0000000UL)
 
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
@@ -177,6 +173,14 @@ static inline void clear_in_cr4 (unsigned long mask)
 #define TASK_UNMAPPED_BASE     \
        (test_thread_flag(TIF_IA32) ? TASK_UNMAPPED_32 : TASK_UNMAPPED_64)  
 
+
+/*
+ * User space process size: 512GB - 1GB (default).
+ */
+#define TASK_SIZE_64   (0x0000007fc0000000UL)
+
+#define TASK_SIZE (test_thread_flag(TIF_IA32) ? IA32_PAGE_OFFSET : TASK_SIZE_64)
+
 /*
  * Size of io_bitmap, covering ports 0 to 0x3ff.
  */
@@ -461,4 +465,6 @@ static inline void __mwait(unsigned long eax, unsigned long ecx)
 #define ARCH_HAS_SCHED_WAKE_IDLE
 #endif
 
+#define HAVE_ARCH_PICK_MMAP_LAYOUT
+
 #endif /* __ASM_X86_64_PROCESSOR_H */
index c7f0811..a946b0b 100644 (file)
@@ -39,7 +39,7 @@
        { RLIM_INFINITY, RLIM_INFINITY },               \
        {             0,             0 },               \
        {      INR_OPEN,     INR_OPEN  },               \
-       { PAGE_SIZE , PAGE_SIZE  },             \
+       {         32768,         32768 },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { RLIM_INFINITY, RLIM_INFINITY },               \
        { MAX_SIGPENDING, MAX_SIGPENDING },             \
index 9310f9a..dbc3f15 100644 (file)
@@ -22,9 +22,9 @@ extern cpumask_t     node_to_cpumask[];
 
 static inline cpumask_t pcibus_to_cpumask(int bus)
 {
-       cpumask_t tmp;
-       cpus_and(tmp, mp_bus_to_cpumask[bus], cpu_online_map);
-       return tmp;
+       cpumask_t res;
+       cpus_and(res,  pci_bus_to_cpumask[bus], cpu_online_map);
+       return res;
 }
 
 #define NODE_BALANCE_RATE 30   /* CHECKME */ 
index 9e58bf0..8d0598d 100644 (file)
@@ -148,7 +148,7 @@ extern void __put_user_bad(void);
 #define __put_user_check(x,ptr,size)                   \
 ({                                                     \
        int __pu_err = -EFAULT;                         \
-       __typeof__(*(ptr)) *__pu_addr = (ptr);          \
+       __typeof__(*(ptr)) __user *__pu_addr = (ptr);   \
        if (likely(access_ok(VERIFY_WRITE,__pu_addr,size)))     \
                __put_user_size((x),__pu_addr,(size),__pu_err); \
        __pu_err;                                       \
index 6c2bd56..b46ce1a 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/types.h>
 #include <asm/param.h>
+#include <asm/byteorder.h>
 
 /* 
  *  comp_t is a 16-bit "floating" point number with a 3-bit base 8
@@ -104,7 +105,12 @@ struct acct_v3
 #define ACOMPAT                0x04    /* ... used compatibility mode (VAX only not used) */
 #define ACORE          0x08    /* ... dumped core */
 #define AXSIG          0x10    /* ... was killed by a signal */
-#define ABYTESEX       0x80    /* always set, allows to detect byteorder */
+
+#ifdef __BIG_ENDIAN
+#define ACCT_BYTEORDER 0x80    /* accounting file is big endian */
+#else
+#define ACCT_BYTEORDER 0x00    /* accounting file is little endian */
+#endif
 
 #ifdef __KERNEL__
 
index 7a99d7e..4b6d0e4 100644 (file)
@@ -209,8 +209,8 @@ struct ata_taskfile {
 #define ata_id_has_lba48(dev)  ((dev)->id[83] & (1 << 10))
 #define ata_id_has_wcache(dev) ((dev)->id[82] & (1 << 5))
 #define ata_id_has_pm(dev)     ((dev)->id[82] & (1 << 3))
-#define ata_id_has_lba(dev)    ((dev)->id[49] & (1 << 8))
-#define ata_id_has_dma(dev)    ((dev)->id[49] & (1 << 9))
+#define ata_id_has_lba(dev)    ((dev)->id[49] & (1 << 9))
+#define ata_id_has_dma(dev)    ((dev)->id[49] & (1 << 8))
 #define ata_id_removeable(dev) ((dev)->id[0] & (1 << 7))
 #define ata_id_u32(dev,n)      \
        (((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)]))
index 601531c..b90e06c 100644 (file)
@@ -120,6 +120,7 @@ struct bio {
 #define BIO_SEG_VALID  3       /* nr_hw_seg valid */
 #define BIO_CLONED     4       /* doesn't own data */
 #define BIO_BOUNCED    5       /* bio is a bounce bio */
+#define BIO_USER_MAPPED 6      /* contains user pages */
 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
 
 /*
@@ -264,9 +265,11 @@ extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
 extern int bio_get_nr_vecs(struct block_device *);
 extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
                                unsigned long, unsigned int, int);
-extern void bio_unmap_user(struct bio *, int);
+extern void bio_unmap_user(struct bio *);
 extern void bio_set_pages_dirty(struct bio *bio);
 extern void bio_check_pages_dirty(struct bio *bio);
+extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
+extern int bio_uncopy_user(struct bio *);
 
 #ifdef CONFIG_HIGHMEM
 /*
index 0ac26da..eb4d10b 100644 (file)
@@ -517,14 +517,14 @@ extern int blk_remove_plug(request_queue_t *);
 extern void blk_recount_segments(request_queue_t *, struct bio *);
 extern int blk_phys_contig_segment(request_queue_t *q, struct bio *, struct bio *);
 extern int blk_hw_contig_segment(request_queue_t *q, struct bio *, struct bio *);
-extern int scsi_cmd_ioctl(struct gendisk *, unsigned int, void __user *);
+extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
 extern void blk_start_queue(request_queue_t *q);
 extern void blk_stop_queue(request_queue_t *q);
 extern void __blk_stop_queue(request_queue_t *q);
 extern void blk_run_queue(request_queue_t *);
 extern void blk_queue_activity_fn(request_queue_t *, activity_fn *, void *);
 extern struct request *blk_rq_map_user(request_queue_t *, int, void __user *, unsigned int);
-extern int blk_rq_unmap_user(struct request *, void __user *, struct bio *, unsigned int);
+extern int blk_rq_unmap_user(struct request *, struct bio *, unsigned int);
 extern int blk_execute_rq(request_queue_t *, struct gendisk *, struct request *);
 
 static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
index f5d13d1..2908c7a 100644 (file)
@@ -194,6 +194,7 @@ int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
 int generic_cont_expand(struct inode *inode, loff_t size) ;
 int block_commit_write(struct page *page, unsigned from, unsigned to);
 int block_sync_page(struct page *);
+void flush_inode_pages (struct inode * inode);
 sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
 int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
 int block_truncate_page(struct address_space *, loff_t, get_block_t *);
index 282e9b7..0e46b2d 100644 (file)
@@ -984,8 +984,8 @@ struct cdrom_device_ops {
 extern int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip,
                        struct file *fp);
 extern int cdrom_release(struct cdrom_device_info *cdi, struct file *fp);
-extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct inode *ip,
-               unsigned int cmd, unsigned long arg);
+extern int cdrom_ioctl(struct file *file, struct cdrom_device_info *cdi,
+               struct inode *ip, unsigned int cmd, unsigned long arg);
 extern int cdrom_media_changed(struct cdrom_device_info *);
 
 extern int register_cdrom(struct cdrom_device_info *cdi);
index f8159dd..d43dbfe 100644 (file)
@@ -384,6 +384,7 @@ COMPATIBLE_IOCTL(DVD_WRITE_STRUCT)
 COMPATIBLE_IOCTL(DVD_AUTH)
 /* Big L */
 ULONG_IOCTL(LOOP_SET_FD)
+ULONG_IOCTL(LOOP_CHANGE_FD)
 COMPATIBLE_IOCTL(LOOP_CLR_FD)
 COMPATIBLE_IOCTL(LOOP_GET_STATUS64)
 COMPATIBLE_IOCTL(LOOP_SET_STATUS64)
index 488678c..d507775 100644 (file)
@@ -19,6 +19,7 @@
 
 struct vc_data;
 struct console_font_op;
+struct console_font;
 struct module;
 
 /*
@@ -40,7 +41,10 @@ struct consw {
        void    (*con_bmove)(struct vc_data *, int, int, int, int, int, int);
        int     (*con_switch)(struct vc_data *);
        int     (*con_blank)(struct vc_data *, int, int);
-       int     (*con_font_op)(struct vc_data *, struct console_font_op *);
+       int     (*con_font_set)(struct vc_data *, struct console_font *, unsigned);
+       int     (*con_font_get)(struct vc_data *, struct console_font *);
+       int     (*con_font_default)(struct vc_data *, struct console_font *, char *);
+       int     (*con_font_copy)(struct vc_data *, int);
        int     (*con_resize)(struct vc_data *, unsigned int, unsigned int);
        int     (*con_set_palette)(struct vc_data *, unsigned char *);
        int     (*con_scrolldelta)(struct vc_data *, int);
index 66e2732..a4c8f46 100644 (file)
@@ -103,6 +103,7 @@ struct dentry {
        struct super_block *d_sb;       /* The root of the dentry tree */
        int d_mounted;
        void *d_fsdata;                 /* fs-specific data */
+       void * d_extra_attributes;      /* TUX-specific data */
        struct rcu_head d_rcu;
        struct dcookie_struct *d_cookie; /* cookie, if any */
        struct hlist_node d_hash;       /* lookup hash list */  
@@ -210,6 +211,7 @@ extern void shrink_dcache_sb(struct super_block *);
 extern void shrink_dcache_parent(struct dentry *);
 extern void shrink_dcache_anon(struct hlist_head *);
 extern int d_invalidate(struct dentry *);
+extern void flush_dentry_attributes(void);
 
 /* only used at mount-time */
 extern struct dentry * d_alloc_root(struct inode *);
@@ -253,8 +255,12 @@ extern struct dentry * __d_lookup(struct dentry *, struct qstr *);
 /* validate "insecure" dentry pointer */
 extern int d_validate(struct dentry *, struct dentry *);
 
+char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
+                struct dentry *root, struct vfsmount *rootmnt,
+                char *buffer, int buflen);
+
 extern char * d_path(struct dentry *, struct vfsmount *, char *, int);
-  
 /* Allocation counts.. */
 
 /**
index 5ccf274..cdaff25 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _DVBOSD_H_
 #define _DVBOSD_H_
 
+#include <linux/compiler.h>
+
 typedef enum {
   // All functions return -2 on "not open"
   OSD_Close=1,    // ()
index 8fb2eb3..2ed5d7b 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef _DVBVIDEO_H_
 #define _DVBVIDEO_H_
 
+#include <linux/compiler.h>
+
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
index f8115ac..8d0dd82 100644 (file)
@@ -4,6 +4,13 @@
 #include <linux/types.h>
 #include <asm/elf.h>
 
+#ifndef elf_read_implies_exec
+  /* Executables for which elf_read_implies_exec() returns TRUE will
+     have the READ_IMPLIES_EXEC personality flag set automatically.
+     Override in asm/elf.h as needed.  */
+# define elf_read_implies_exec(ex, have_pt_gnu_stack)  0
+#endif
+
 /* 32-bit ELF base types. */
 typedef __u32  Elf32_Addr;
 typedef __u16  Elf32_Half;
index a1f948f..96c5313 100644 (file)
@@ -23,6 +23,9 @@
 #define EJUKEBOX       528     /* Request initiated, but will not complete before timeout */
 #define EIOCBQUEUED    529     /* iocb queued, will get completion event */
 
+/* Defined for TUX async IO */
+#define EWOULDBLOCKIO  530     /* Would block due to block-IO */
+
 #endif
 
 #endif
index afcdc66..9186883 100644 (file)
 #define FBIOGETCMAP            0x4604
 #define FBIOPUTCMAP            0x4605
 #define FBIOPAN_DISPLAY                0x4606
+#ifdef __KERNEL__
+#define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor_user)
+#else
 #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)
+#endif
 /* 0x4607-0x460B are defined below */
 /* #define FBIOGET_MONITORSPEC 0x460C */
 /* #define FBIOPUT_MONITORSPEC 0x460D */
@@ -397,6 +401,36 @@ struct fb_info;
 struct device;
 struct file;
 
+struct fb_cmap_user {
+       __u32 start;                    /* First entry  */
+       __u32 len;                      /* Number of entries */
+       __u16 __user *red;              /* Red values   */
+       __u16 __user *green;
+       __u16 __user *blue;
+       __u16 __user *transp;           /* transparency, can be NULL */
+};
+
+struct fb_image_user {
+       __u32 dx;                       /* Where to place image */
+       __u32 dy;
+       __u32 width;                    /* Size of image */
+       __u32 height;
+       __u32 fg_color;                 /* Only used when a mono bitmap */
+       __u32 bg_color;
+       __u8  depth;                    /* Depth of the image */
+       const char __user *data;        /* Pointer to image data */
+       struct fb_cmap_user cmap;       /* color map info */
+};
+
+struct fb_cursor_user {
+       __u16 set;                      /* what to set */
+       __u16 enable;                   /* cursor on/off */
+       __u16 rop;                      /* bitop operation */
+       const char __user *mask;        /* cursor mask bits */
+       struct fbcurpos hot;            /* cursor hot spot */
+       struct fb_image_user image;     /* Cursor image */
+};
+
 /*
  * Register/unregister for framebuffer events
  */
@@ -696,8 +730,10 @@ extern const struct fb_videomode vesa_modes[];
 /* drivers/video/fbcmap.c */
 extern int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp);
 extern void fb_dealloc_cmap(struct fb_cmap *cmap);
-extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to, int fsfromto);
-extern int fb_set_cmap(struct fb_cmap *cmap, int kspc, struct fb_info *fb_info);
+extern int fb_copy_cmap(struct fb_cmap *from, struct fb_cmap *to);
+extern int fb_cmap_to_user(struct fb_cmap *from, struct fb_cmap_user *to);
+extern int fb_set_cmap(struct fb_cmap *cmap, struct fb_info *fb_info);
+extern int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *fb_info);
 extern struct fb_cmap *fb_default_cmap(int len);
 extern void fb_invert_cmaps(void);
 
index b3fbadf..1c1e0b3 100644 (file)
@@ -81,4 +81,6 @@ struct task_struct;
 struct files_struct *get_files_struct(struct task_struct *);
 void FASTCALL(put_files_struct(struct files_struct *fs));
 
+extern int dupfd(struct file *file, unsigned int start);
+
 #endif /* __LINUX_FILE_H */
index aea3544..73960d2 100644 (file)
@@ -75,6 +75,11 @@ extern int leases_enable, dir_notify_enable, lease_break_time;
 #define FMODE_READ 1
 #define FMODE_WRITE 2
 
+/* Internal kernel extensions */
+#define FMODE_LSEEK    4
+#define FMODE_PREAD    8
+#define FMODE_PWRITE   FMODE_PREAD     /* These go hand in hand */
+
 #define RW_MASK                1
 #define RWA_MASK       2
 #define READ 0
@@ -367,6 +372,7 @@ struct block_device {
        struct block_device *   bd_contains;
        unsigned                bd_block_size;
        struct hd_struct *      bd_part;
+       /* number of times partitions within this device have been opened. */
        unsigned                bd_part_count;
        int                     bd_invalidated;
        struct gendisk *        bd_disk;
@@ -671,9 +677,6 @@ extern struct list_head file_lock_list;
 
 #include <linux/fcntl.h>
 
-extern long generic_file_fcntl(int fd, unsigned int cmd,
-                               unsigned long arg, struct file *filp);
-
 extern int fcntl_getlk(struct file *, struct flock __user *);
 extern int fcntl_setlk(struct file *, unsigned int, struct flock __user *);
 
@@ -901,8 +904,8 @@ struct file_operations {
        ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
        ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
        unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
-       long (*fcntl)(int fd, unsigned int cmd,
-                       unsigned long arg, struct file *filp);
+       int (*check_flags)(int);
+       int (*dir_notify)(struct file *filp, unsigned long arg);
 };
 
 struct inode_operations {
@@ -1428,7 +1431,7 @@ ssize_t generic_file_write_nolock(struct file *file, const struct iovec *iov,
 extern ssize_t generic_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
 extern void do_generic_mapping_read(struct address_space *mapping,
                                    struct file_ra_state *, struct file *,
-                                   loff_t *, read_descriptor_t *, read_actor_t);
+                                   loff_t *, read_descriptor_t *, read_actor_t, int);
 extern void
 file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
 extern ssize_t generic_file_direct_IO(int rw, struct kiocb *iocb,
@@ -1441,17 +1444,19 @@ extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
 extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
 extern loff_t remote_llseek(struct file *file, loff_t offset, int origin);
 extern int generic_file_open(struct inode * inode, struct file * filp);
+extern int nonseekable_open(struct inode * inode, struct file * filp);
 
 static inline void do_generic_file_read(struct file * filp, loff_t *ppos,
                                        read_descriptor_t * desc,
-                                       read_actor_t actor)
+                                       read_actor_t actor, int nonblock)
 {
        do_generic_mapping_read(filp->f_mapping,
                                &filp->f_ra,
                                filp,
                                ppos,
                                desc,
-                               actor);
+                               actor,
+                               nonblock);
 }
 
 ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
@@ -1538,6 +1543,8 @@ extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
 extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
 extern void simple_release_fs(struct vfsmount **mount, int *count);
 
+extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const void *, size_t);
+
 extern int inode_change_ok(struct inode *, struct iattr *);
 extern int __must_check inode_setattr(struct inode *, struct iattr *);
 
index c282796..7a5de34 100644 (file)
@@ -12,7 +12,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
        return vma->vm_flags & VM_HUGETLB;
 }
 
-int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *);
+int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
 int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
 int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int);
 void zap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
index fe54e41..0654296 100644 (file)
@@ -1194,7 +1194,7 @@ typedef struct ide_driver_s {
 
 #define DRIVER(drive)          ((drive)->driver)
 
-extern int generic_ide_ioctl(struct block_device *, unsigned, unsigned long);
+extern int generic_ide_ioctl(struct file *, struct block_device *, unsigned, unsigned long);
 
 /*
  * ide_hwifs[] is the master data structure used to keep track
index 91e49f8..4a44892 100644 (file)
@@ -155,6 +155,14 @@ struct ipmi_lan_addr
  * out).
  */
 struct ipmi_msg
+{
+       unsigned char  netfn;
+       unsigned char  cmd;
+       unsigned short data_len;
+       unsigned char  __user *data;
+};
+
+struct kernel_ipmi_msg
 {
        unsigned char  netfn;
        unsigned char  cmd;
@@ -223,7 +231,7 @@ struct ipmi_recv_msg
        ipmi_user_t      user;
        struct ipmi_addr addr;
        long             msgid;
-       struct ipmi_msg  msg;
+       struct kernel_ipmi_msg  msg;
 
        /* The user_msg_data is the data supplied when a message was
           sent, if this is a response to a sent message.  If this is
@@ -316,7 +324,7 @@ unsigned char ipmi_get_my_LUN(ipmi_user_t user);
 int ipmi_request(ipmi_user_t      user,
                 struct ipmi_addr *addr,
                 long             msgid,
-                struct ipmi_msg  *msg,
+                struct kernel_ipmi_msg *msg,
                 void             *user_msg_data,
                 int              priority);
 
@@ -336,7 +344,7 @@ int ipmi_request(ipmi_user_t      user,
 int ipmi_request_settime(ipmi_user_t      user,
                         struct ipmi_addr *addr,
                         long             msgid,
-                        struct ipmi_msg  *msg,
+                        struct kernel_ipmi_msg  *msg,
                         void             *user_msg_data,
                         int              priority,
                         int              max_retries,
@@ -348,7 +356,7 @@ int ipmi_request_settime(ipmi_user_t      user,
 int ipmi_request_with_source(ipmi_user_t      user,
                             struct ipmi_addr *addr,
                             long             msgid,
-                            struct ipmi_msg  *msg,
+                            struct kernel_ipmi_msg  *msg,
                             void             *user_msg_data,
                             int              priority,
                             unsigned char    source_address,
@@ -366,7 +374,7 @@ int ipmi_request_with_source(ipmi_user_t      user,
 int ipmi_request_supply_msgs(ipmi_user_t          user,
                             struct ipmi_addr     *addr,
                             long                 msgid,
-                            struct ipmi_msg      *msg,
+                            struct kernel_ipmi_msg *msg,
                             void                 *user_msg_data,
                             void                 *supplied_smi,
                             struct ipmi_recv_msg *supplied_recv,
index f8c48b4..28be4fb 100644 (file)
@@ -147,6 +147,12 @@ struct kbd_repeat {
 struct console_font_op {
        unsigned int op;        /* operation code KD_FONT_OP_* */
        unsigned int flags;     /* KD_FONT_FLAG_* */
+       unsigned int width, height;     /* font size */
+       unsigned int charcount;
+       unsigned char __user *data;     /* font data with height fixed to 32 */
+};
+
+struct console_font {
        unsigned int width, height;     /* font size */
        unsigned int charcount;
        unsigned char *data;    /* font data with height fixed to 32 */
index 502e9fc..af2555f 100644 (file)
@@ -26,6 +26,8 @@ extern void * high_memory;
 extern unsigned long vmalloc_earlyreserve;
 extern int page_cluster;
 
+extern int sysctl_legacy_va_layout;
+
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
@@ -496,7 +498,7 @@ int shmem_set_policy(struct vm_area_struct *vma, struct mempolicy *new);
 struct mempolicy *shmem_get_policy(struct vm_area_struct *vma,
                                        unsigned long addr);
 struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags);
-int shmem_lock(struct file * file, int lock, struct user_struct *);
+int shmem_lock(struct file *file, int lock, struct user_struct *user);
 int shmem_zero_setup(struct vm_area_struct *);
 
 static inline int can_do_mlock(void)
@@ -507,7 +509,8 @@ static inline int can_do_mlock(void)
                return 1;
        return 0;
 }
-
+extern int user_shm_lock(size_t, struct user_struct *);
+extern void user_shm_unlock(size_t, struct user_struct *);
 
 /*
  * Parameter block passed down to zap_pte_range in exceptional cases.
@@ -644,7 +647,14 @@ extern struct vm_area_struct *copy_vma(struct vm_area_struct **,
        unsigned long addr, unsigned long len, pgoff_t pgoff);
 extern void exit_mmap(struct mm_struct *);
 
-extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
+extern unsigned long get_unmapped_area_prot(struct file *, unsigned long, unsigned long, unsigned long, unsigned long, int);
+
+
+static inline unsigned long get_unmapped_area(struct file * file, unsigned long addr, 
+               unsigned long len, unsigned long pgoff, unsigned long flags)
+{
+       return get_unmapped_area_prot(file, addr, len, pgoff, flags, 0);        
+}
 
 extern unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file *file, 
                                   unsigned long addr, unsigned long len,
@@ -721,8 +731,6 @@ static inline unsigned long vma_pages(struct vm_area_struct *vma)
 
 extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr);
 
-extern unsigned int nr_used_zone_pages(void);
-
 extern struct page * vmalloc_to_page(void *addr);
 extern struct page * follow_page(struct mm_struct *mm, unsigned long address,
                int write);
index 2560131..e2f19aa 100644 (file)
@@ -341,6 +341,15 @@ static inline struct zone *next_zone(struct zone *zone)
 #define for_each_zone(zone) \
        for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
 
+static inline int is_highmem_idx(int idx)
+{
+       return (idx == ZONE_HIGHMEM);
+}
+
+static inline int is_normal_idx(int idx)
+{
+       return (idx == ZONE_NORMAL);
+}
 /**
  * is_highmem - helper function to quickly check if a struct zone is a 
  *              highmem zone or not.  This is an attempt to keep references
@@ -349,21 +358,21 @@ static inline struct zone *next_zone(struct zone *zone)
  */
 static inline int is_highmem(struct zone *zone)
 {
-       return (zone - zone->zone_pgdat->node_zones == ZONE_HIGHMEM);
+       return (is_highmem_idx(zone - zone->zone_pgdat->node_zones));
 }
 
 static inline int is_normal(struct zone *zone)
 {
-       return (zone - zone->zone_pgdat->node_zones == ZONE_NORMAL);
+       return (is_normal_idx(zone - zone->zone_pgdat->node_zones));
 }
 
 /* These two functions are used to setup the per zone pages min values */
 struct ctl_table;
 struct file;
 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
-                                       void __user *, size_t *);
+                                       void __user *, size_t *, loff_t *);
 int lower_zone_protection_sysctl_handler(struct ctl_table *, int, struct file *,
-                                       void __user *, size_t *);
+                                       void __user *, size_t *, loff_t *);
 
 #include <linux/topology.h>
 /* Returns the number of the current Node. */
index 1278162..a3efae0 100644 (file)
@@ -1,7 +1,7 @@
 
 /* Common Flash Interface structures 
  * See http://support.intel.com/design/flash/technote/index.htm
- * $Id: cfi.h,v 1.44 2004/07/13 22:32:52 dwmw2 Exp $
+ * $Id: cfi.h,v 1.45 2004/07/20 02:44:27 dwmw2 Exp $
  */
 
 #ifndef __MTD_CFI_H__
@@ -328,14 +328,12 @@ static inline uint8_t cfi_read_query(struct map_info *map, uint32_t addr)
 
 static inline void cfi_udelay(int us)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
        unsigned long t = us * HZ / 1000000;
        if (t) {
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(t);
                return;
        }
-#endif
        udelay(us);
        cond_resched();
 }
index fd7b15d..b3d1343 100644 (file)
@@ -1,5 +1,5 @@
 /* 
- * $Id: mtd.h,v 1.54 2004/07/15 01:13:12 dwmw2 Exp $
+ * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $
  *
  * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al.
  *
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/uio.h>
 
+#include <linux/mtd/compatmac.h>
 #include <mtd/mtd-abi.h>
 
 #define MTD_CHAR_MAJOR 90
@@ -192,6 +193,17 @@ int default_mtd_readv(struct mtd_info *mtd, struct kvec *vecs,
 #define MTD_WRITEOOB(mtd, args...) (*(mtd->write_oob))(mtd, args)
 #define MTD_SYNC(mtd) do { if (mtd->sync) (*(mtd->sync))(mtd);  } while (0) 
 
+
+#ifdef CONFIG_MTD_PARTITIONS
+void mtd_erase_callback(struct erase_info *instr);
+#else
+static inline void mtd_erase_callback(struct erase_info *instr)
+{
+       if (instr->callback)
+               instr->callback(instr);
+}
+#endif
+
 /*
  * Debugging macro and defines
  */
index 1bbfa29..43a5c67 100644 (file)
@@ -10,7 +10,7 @@ struct open_intent {
        int     create_mode;
 };
 
-enum { MAX_NESTED_LINKS = 5 };
+enum { MAX_NESTED_LINKS = 8 };
 
 struct nameidata {
        struct dentry   *dentry;
@@ -45,6 +45,8 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_CONTINUE                 4
 #define LOOKUP_PARENT          16
 #define LOOKUP_NOALT           32
+#define LOOKUP_ATOMIC          64
+
 /*
  * Intent data
  */
index 1f531a9..22daf78 100644 (file)
@@ -143,6 +143,7 @@ struct net_proto_family {
 };
 
 struct iovec;
+struct kvec;
 
 extern int          sock_wake_async(struct socket *sk, int how, int band);
 extern int          sock_register(struct net_proto_family *fam);
@@ -170,6 +171,12 @@ extern int      net_ratelimit(void);
 extern unsigned long net_random(void);
 extern void         net_srandom(unsigned long);
 
+extern int          kernel_sendmsg(struct socket *sock, struct msghdr *msg,
+                                   struct kvec *vec, size_t num, size_t len);
+extern int          kernel_recvmsg(struct socket *sock, struct msghdr *msg,
+                                   struct kvec *vec, size_t num,
+                                   size_t len, int flags);
+
 #ifndef CONFIG_SMP
 #define SOCKOPS_WRAPPED(name) name
 #define SOCKOPS_WRAP(name, fam)
index 143aa60..d35a75b 100644 (file)
@@ -362,8 +362,8 @@ struct net_device
 
        struct Qdisc            *qdisc;
        struct Qdisc            *qdisc_sleeping;
-       struct Qdisc            *qdisc_list;
        struct Qdisc            *qdisc_ingress;
+       struct list_head        qdisc_list;
        unsigned long           tx_queue_len;   /* Max frames per queue allowed */
 
        /* ingress path synchronizer */
@@ -472,12 +472,6 @@ struct net_device
        /* bridge stuff */
        struct net_bridge_port  *br_port;
 
-#ifdef CONFIG_NET_FASTROUTE
-#define NETDEV_FASTROUTE_HMASK 0xF
-       /* Semi-private data. Keep it at the end of device struct. */
-       rwlock_t                fastpath_lock;
-       struct dst_entry        *fastpath[NETDEV_FASTROUTE_HMASK+1];
-#endif
 #ifdef CONFIG_NET_DIVERT
        /* this will get initialized at each interface type init routine */
        struct divert_blk       *divert;
@@ -953,11 +947,6 @@ extern unsigned long       netdev_fc_xoff;
 extern atomic_t netdev_dropping;
 extern int             netdev_set_master(struct net_device *dev, struct net_device *master);
 extern int skb_checksum_help(struct sk_buff **pskb, int inward);
-#ifdef CONFIG_NET_FASTROUTE
-extern int             netdev_fastroute;
-extern int             netdev_fastroute_obstacles;
-extern void            dev_clear_fastroute(struct net_device *dev);
-#endif
 
 #ifdef CONFIG_SYSCTL
 extern char *net_sysctl_strdup(const char *s);
index 520f00b..5757370 100644 (file)
@@ -92,9 +92,9 @@ int           nfsd_open(struct svc_rqst *, struct svc_fh *, int,
                                int, struct file *);
 void           nfsd_close(struct file *);
 int            nfsd_read(struct svc_rqst *, struct svc_fh *,
-                               loff_t, struct iovec *,int, unsigned long *);
+                               loff_t, struct kvec *,int, unsigned long *);
 int            nfsd_write(struct svc_rqst *, struct svc_fh *,
-                               loff_t, struct iovec *,int, unsigned long, int *);
+                               loff_t, struct kvec *,int, unsigned long, int *);
 int            nfsd_readlink(struct svc_rqst *, struct svc_fh *,
                                char *, int *);
 int            nfsd_symlink(struct svc_rqst *, struct svc_fh *,
index 9201a47..ff18ed7 100644 (file)
@@ -241,7 +241,7 @@ struct nfsd4_read {
        stateid_t       rd_stateid;         /* request */
        u64             rd_offset;          /* request */
        u32             rd_length;          /* request */
-       struct iovec    rd_iov[RPCSVC_MAXPAGES];
+       struct kvec     rd_iov[RPCSVC_MAXPAGES];
        int             rd_vlen;
        
        struct svc_rqst *rd_rqstp;          /* response */
@@ -324,7 +324,7 @@ struct nfsd4_write {
        u64             wr_offset;          /* request */
        u32             wr_stable_how;      /* request */
        u32             wr_buflen;          /* request */
-       struct iovec    wr_vec[RPCSVC_MAXPAGES]; /* request */
+       struct kvec     wr_vec[RPCSVC_MAXPAGES]; /* request */
        int             wr_vlen;
 
        u32             wr_bytes_written;   /* response */
index 5940705..8935251 100644 (file)
@@ -831,16 +831,27 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max, int pass
 extern struct pci_dev *isa_bridge;
 #endif
 
-#ifndef CONFIG_PCI_USE_VECTOR
+struct msix_entry {
+       u16     vector; /* kernel uses to write allocated vector */
+       u16     entry;  /* driver uses to specify entry, OS writes */
+};
+
+#ifndef CONFIG_PCI_MSI
 static inline void pci_scan_msi_device(struct pci_dev *dev) {}
 static inline int pci_enable_msi(struct pci_dev *dev) {return -1;}
+static inline void pci_disable_msi(struct pci_dev *dev) {}
+static inline int pci_enable_msix(struct pci_dev* dev,
+       struct msix_entry *entries, int nvec) {return -1;}
+static inline void pci_disable_msix(struct pci_dev *dev) {}
 static inline void msi_remove_pci_irq_vectors(struct pci_dev *dev) {}
 #else
 extern void pci_scan_msi_device(struct pci_dev *dev);
 extern int pci_enable_msi(struct pci_dev *dev);
+extern void pci_disable_msi(struct pci_dev *dev);
+extern int pci_enable_msix(struct pci_dev* dev,
+       struct msix_entry *entries, int nvec);
+extern void pci_disable_msix(struct pci_dev *dev);
 extern void msi_remove_pci_irq_vectors(struct pci_dev *dev);
-extern int msi_alloc_vectors(struct pci_dev* dev, int *vector, int nvec);
-extern int msi_free_vectors(struct pci_dev* dev, int *vector, int nvec);
 #endif
 
 #endif /* CONFIG_PCI */
index 6544a8c..50a7470 100644 (file)
 #define PCI_DEVICE_ID_TTI_HPT302       0x0006
 #define PCI_DEVICE_ID_TTI_HPT371       0x0007
 #define PCI_DEVICE_ID_TTI_HPT374       0x0008
+#define PCI_DEVICE_ID_TTI_HPT372N      0x0009  // apparently a 372N variant?
 
 #define PCI_VENDOR_ID_VIA              0x1106
 #define PCI_DEVICE_ID_VIA_8763_0       0x0198
 #define PCI_DEVICE_ID_VIA_8380_0       0x0204
+#define PCI_DEVICE_ID_VIA_3238_0       0x0238
 #define PCI_DEVICE_ID_VIA_PX8X0_0      0x0259
+#define PCI_DEVICE_ID_VIA_3269_0       0x0269
 #define PCI_DEVICE_ID_VIA_K8T800PRO_0  0x0282
 #define PCI_DEVICE_ID_VIA_8363_0       0x0305
 #define PCI_DEVICE_ID_VIA_8371_0       0x0391
 #define PCI_DEVICE_ID_VIA_82C686_6     0x3068
 #define PCI_DEVICE_ID_VIA_8233_0       0x3074
 #define PCI_DEVICE_ID_VIA_8633_0       0x3091
-#define PCI_DEVICE_ID_VIA_8367_0       0x3099 
+#define PCI_DEVICE_ID_VIA_8367_0       0x3099
 #define PCI_DEVICE_ID_VIA_8653_0       0x3101
-#define PCI_DEVICE_ID_VIA_8622         0x3102 
+#define PCI_DEVICE_ID_VIA_8622         0x3102
 #define PCI_DEVICE_ID_VIA_8233C_0      0x3109
 #define PCI_DEVICE_ID_VIA_8361         0x3112
 #define PCI_DEVICE_ID_VIA_XM266                0x3116
 #define PCI_DEVICE_ID_VIA_PT880                0x3258
 #define PCI_DEVICE_ID_VIA_P4M400       0x3209
 #define PCI_DEVICE_ID_VIA_8237         0x3227
+#define PCI_DEVICE_ID_VIA_3296_0       0x0296
 #define PCI_DEVICE_ID_VIA_86C100A      0x6100
 #define PCI_DEVICE_ID_VIA_8231         0x8231
 #define PCI_DEVICE_ID_VIA_8231_4       0x8235
 #define PCI_DEVICE_ID_INTEL_82865_IG   0x2572
 #define PCI_DEVICE_ID_INTEL_82875_HB   0x2578
 #define PCI_DEVICE_ID_INTEL_82875_IG   0x257b
+#define PCI_DEVICE_ID_INTEL_82915G_HB  0x2580
+#define PCI_DEVICE_ID_INTEL_82915G_IG  0x2582
 #define PCI_DEVICE_ID_INTEL_ICH6_0     0x2640
 #define PCI_DEVICE_ID_INTEL_ICH6_1     0x2641
 #define PCI_DEVICE_ID_INTEL_ICH6_2     0x2642
index 9b009b6..7efc05e 100644 (file)
@@ -30,6 +30,7 @@ extern int abi_fake_utsname;
  */
 enum {
        MMAP_PAGE_ZERO =        0x0100000,
+       ADDR_COMPAT_LAYOUT =    0x0200000,
        READ_IMPLIES_EXEC =     0x0400000,
        ADDR_LIMIT_32BIT =      0x0800000,
        SHORT_INODE =           0x1000000,
index 59339ce..9abc5b5 100644 (file)
@@ -117,17 +117,6 @@ enum
 struct tc_police
 {
        __u32                   index;
-#ifdef CONFIG_NET_CLS_ACT
-       int                     refcnt;
-       int                     bindcnt;
-#endif
-/* Turned off because it requires new tc
- * to work (for now maintain ABI)
- *
-#ifdef CONFIG_NET_CLS_ACT
-       __u32                   capab;
-#endif
-*/
        int                     action;
 #define TC_POLICE_UNSPEC       TC_ACT_UNSPEC
 #define TC_POLICE_OK           TC_ACT_OK
@@ -140,6 +129,9 @@ struct tc_police
        __u32                   mtu;
        struct tc_ratespec      rate;
        struct tc_ratespec      peakrate;
+       int                     refcnt;
+       int                     bindcnt;
+       __u32                   capab;
 };
 
 struct tcf_t
@@ -195,12 +187,9 @@ enum
        TCA_U32_DIVISOR,
        TCA_U32_SEL,
        TCA_U32_POLICE,
-#ifdef CONFIG_NET_CLS_ACT
        TCA_U32_ACT,   
-#endif
-#ifdef CONFIG_NET_CLS_IND
        TCA_U32_INDEV,
-#endif
+       TCA_U32_PCNT,
        __TCA_U32_MAX
 };
 
@@ -212,9 +201,6 @@ struct tc_u32_key
        __u32           val;
        int             off;
        int             offmask;
-#ifdef CONFIG_CLS_U32_PERF
-       unsigned long   kcnt;
-#endif
 };
 
 struct tc_u32_sel
@@ -229,13 +215,17 @@ struct tc_u32_sel
 
        short                   hoff;
        __u32                   hmask;
-#ifdef CONFIG_CLS_U32_PERF
-       unsigned long           rcnt;
-       unsigned long           rhit;
-#endif
        struct tc_u32_key       keys[0];
 };
 
+#ifdef CONFIG_CLS_U32_PERF
+struct tc_u32_pcnt
+{
+       __u64 rcnt;
+       __u64 rhit;
+       __u64 kcnts[0];
+};
+#endif
 /* Flags */
 
 #define TC_U32_TERMINAL                1
@@ -300,12 +290,8 @@ enum
        TCA_FW_UNSPEC,
        TCA_FW_CLASSID,
        TCA_FW_POLICE,
-#ifdef CONFIG_NET_CLS_IND
-       TCA_FW_INDEV,
-#endif
-#ifdef CONFIG_NET_CLS_ACT
-       TCA_FW_ACT,
-#endif
+       TCA_FW_INDEV, /*  used by CONFIG_NET_CLS_IND */
+       TCA_FW_ACT, /* used by CONFIG_NET_CLS_ACT */
        __TCA_FW_MAX
 };
 
index a44feb5..b4bb681 100644 (file)
@@ -82,14 +82,10 @@ int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
 }
 
 static inline
-int set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
+void set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
 {
-       int ret = 0;
        if (ufdset)
-               ret = __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
-       if (ret)
-               return -EFAULT;
-       return 0;
+               __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
 }
 
 static inline
index 9ccb52f..fb7473c 100644 (file)
@@ -73,6 +73,9 @@ extern __u32 secure_ipv6_id(__u32 *daddr);
 extern struct file_operations random_fops, urandom_fops;
 #endif
 
+unsigned int get_random_int(void);
+unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
+
 #endif /* __KERNEL___ */
 
 #endif /* _LINUX_RANDOM_H */
index df5ff42..2a206e8 100644 (file)
@@ -630,8 +630,8 @@ static inline loff_t le_ih_k_type (const struct item_head * ih)
 static inline void set_le_key_k_offset (int version, struct key * key, loff_t offset)
 {
     (version == KEY_FORMAT_3_5) ?
-        (key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */
-       (set_offset_v2_k_offset( &(key->u.k_offset_v2), offset ));
+        (void)(key->u.k_offset_v1.k_offset = cpu_to_le32 (offset)) : /* jdm check */
+       (void)(set_offset_v2_k_offset( &(key->u.k_offset_v2), offset ));
 }
 
 
@@ -644,8 +644,8 @@ static inline void set_le_ih_k_offset (struct item_head * ih, loff_t offset)
 static inline void set_le_key_k_type (int version, struct key * key, int type)
 {
     (version == KEY_FORMAT_3_5) ?
-        (key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))):
-       (set_offset_v2_k_type( &(key->u.k_offset_v2), type ));
+        (void)(key->u.k_offset_v1.k_uniqueness = cpu_to_le32(type2uniqueness(type))):
+       (void)(set_offset_v2_k_type( &(key->u.k_offset_v2), type ));
 }
 static inline void set_le_ih_k_type (struct item_head * ih, int type)
 {
index 4f94996..58c6429 100644 (file)
@@ -746,10 +746,6 @@ extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change);
 
 extern struct semaphore rtnl_sem;
 
-#define rtnl_exlock()          do { } while(0)
-#define rtnl_exunlock()                do { } while(0)
-#define rtnl_exlock_nowait()   (0)
-
 #define rtnl_shlock()          down(&rtnl_sem)
 #define rtnl_shlock_nowait()   down_trylock(&rtnl_sem)
 
index c22973f..93f3c32 100644 (file)
@@ -196,13 +196,34 @@ extern int sysctl_max_map_count;
 
 #include <linux/aio.h>
 
+extern unsigned long
+arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
+                      unsigned long, unsigned long);
+
+extern unsigned long
+arch_get_unmapped_exec_area(struct file *, unsigned long, unsigned long,
+                      unsigned long, unsigned long);
+extern unsigned long
+arch_get_unmapped_area_topdown(struct file *filp, unsigned long addr,
+                         unsigned long len, unsigned long pgoff,
+                         unsigned long flags);
+extern void arch_unmap_area(struct vm_area_struct *area);
+extern void arch_unmap_area_topdown(struct vm_area_struct *area);
+
+
 struct mm_struct {
        struct vm_area_struct * mmap;           /* list of VMAs */
        struct rb_root mm_rb;
        struct vm_area_struct * mmap_cache;     /* last find_vma result */
+       unsigned long (*get_unmapped_area) (struct file *filp,
+                               unsigned long addr, unsigned long len,
+                               unsigned long pgoff, unsigned long flags);
+       unsigned long (*get_unmapped_exec_area) (struct file *filp,
+                               unsigned long addr, unsigned long len,
+                               unsigned long pgoff, unsigned long flags);
+       void (*unmap_area) (struct vm_area_struct *area);
+       unsigned long mmap_base;                /* base of mmap area */
        unsigned long free_area_cache;          /* first hole */
-       unsigned long non_executable_cache;     /* last hole top */
-       unsigned long mmap_top;                 /* top of mmap area */
        pgd_t * pgd;
        atomic_t mm_users;                      /* How many users with user space? */
        atomic_t mm_count;                      /* How many references to "struct mm_struct" (users count as 1) */
@@ -230,6 +251,10 @@ struct mm_struct {
        mm_context_t context;
        struct vx_info *mm_vx_info;
 
+       /* Token based thrashing protection. */
+       unsigned long swap_token_time;
+       char recent_pagein;
+
        /* coredumping support */
        int core_waiters;
        struct completion *core_startup_done, core_done;
@@ -422,6 +447,10 @@ struct task_struct {
        unsigned int time_slice, first_time_slice;
 
        struct list_head tasks;
+       /*
+        * ptrace_list/ptrace_children forms the list of my children
+        * that were stolen by a ptracer.
+        */
        struct list_head ptrace_children;
        struct list_head ptrace_list;
 
@@ -443,6 +472,10 @@ struct task_struct {
         */
        struct task_struct *real_parent; /* real parent process (when being debugged) */
        struct task_struct *parent;     /* parent process */
+       /*
+        * children/sibling forms the list of my children plus the
+        * tasks I'm ptracing.
+        */
        struct list_head children;      /* list of my children */
        struct list_head sibling;       /* linkage in my parent's children list */
        struct task_struct *group_leader;       /* threadgroup leader */
@@ -499,6 +532,11 @@ struct task_struct {
        int (*notifier)(void *priv);
        void *notifier_data;
        sigset_t *notifier_mask;
+
+       /* TUX state */
+       void *tux_info;
+       void (*tux_exit)(void);
+
        
        void *security;
        struct audit_context *audit_context;
@@ -1258,6 +1296,17 @@ inline static void init_delays(struct task_struct *tsk)
 
 
 
+#ifdef HAVE_ARCH_PICK_MMAP_LAYOUT
+extern void arch_pick_mmap_layout(struct mm_struct *mm);
+#else
+static inline void arch_pick_mmap_layout(struct mm_struct *mm)
+{
+       mm->mmap_base = TASK_UNMAPPED_BASE;
+       mm->get_unmapped_area = arch_get_unmapped_area;
+       mm->unmap_area = arch_unmap_area;
+}
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif
index 4e57b45..e7e8bb9 100644 (file)
@@ -86,8 +86,8 @@
 /* PPC CPM type number */
 #define PORT_CPM        58
 
-/* Marvell MPSC for PPC & MIPS */
-#define PORT_MPSC      59
+/* MPC52xx type numbers */
+#define PORT_MPC52xx   59
 
 #ifdef __KERNEL__
 
index 19ef545..1907355 100644 (file)
@@ -84,7 +84,7 @@ struct shmid_kernel /* private to the kernel */
        time_t                  shm_ctim;
        pid_t                   shm_cprid;
        pid_t                   shm_lprid;
-       struct user_struct *    mlock_user;
+       struct user_struct      *mlock_user;
 };
 
 /* shm_mode upper byte flags */
index f139821..111bb73 100644 (file)
@@ -233,7 +233,7 @@ struct sk_buff {
         * want to keep them across layers you have to do a skb_clone()
         * first. This is owned by whoever has the skb queued ATM.
         */
-       char                    cb[48];
+       char                    cb[40];
 
        unsigned int            len,
                                data_len,
@@ -1109,6 +1109,24 @@ extern void             skb_split(struct sk_buff *skb,
 extern void skb_init(void);
 extern void skb_add_mtu(int mtu);
 
+struct skb_iter {
+       /* Iteration functions set these */
+       unsigned char *data;
+       unsigned int len;
+
+       /* Private to iteration */
+       unsigned int nextfrag;
+       struct sk_buff *fraglist;
+};
+
+/* Keep iterating until skb_iter_next returns false. */
+extern void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i);
+extern int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i);
+/* Call this if aborting loop before !skb_iter_next */
+extern void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i);
+
+struct tux_req_struct;
+
 #ifdef CONFIG_NETFILTER
 static inline void nf_conntrack_put(struct nf_ct_info *nfct)
 {
index 3a18d6e..4cd4850 100644 (file)
@@ -288,6 +288,11 @@ extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __us
 extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr);
 extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
 
+struct socket;
+struct file * sock_map_file(struct socket *sock);
+extern int sock_map_fd(struct socket *sock);
+extern struct socket *sockfd_lookup(int fd, int *err);
+
 #endif
 #endif /* not kernel and not glibc */
 #endif /* _LINUX_SOCKET_H */
index b9edc33..99ecc28 100644 (file)
@@ -148,7 +148,7 @@ struct swap_list_t {
 #define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
 
 /* linux/mm/oom_kill.c */
-extern void out_of_memory(void);
+extern void out_of_memory(int gfp_mask);
 
 /* linux/mm/memory.c */
 extern void swapin_readahead(swp_entry_t, unsigned long, struct vm_area_struct *);
@@ -204,6 +204,27 @@ extern void free_pages_and_swap_cache(struct page **, int);
 extern struct page * lookup_swap_cache(swp_entry_t);
 extern struct page * read_swap_cache_async(swp_entry_t, struct vm_area_struct *vma,
                                           unsigned long addr);
+/* linux/mm/thrash.c */
+#ifdef CONFIG_SWAP
+extern struct mm_struct * swap_token_mm;
+extern void grab_swap_token(void);
+extern void __put_swap_token(struct mm_struct *);
+
+static inline int has_swap_token(struct mm_struct *mm)
+{
+       return (mm == swap_token_mm);
+}
+
+static inline void put_swap_token(struct mm_struct *mm)
+{
+       if (has_swap_token(mm))
+               __put_swap_token(mm);
+}
+#else /* CONFIG_SWAP */
+#define put_swap_token(x) do { } while(0)
+#define grab_swap_token  do { } while(0)
+#define has_swap_token 0
+#endif /* CONFIG_SWAP */
 
 /* linux/mm/swapfile.c */
 extern long total_swap_pages;
index 7715c2e..8baf21a 100644 (file)
@@ -167,6 +167,7 @@ enum
        VM_BLOCK_DUMP=24,       /* block dump mode */
        VM_HUGETLB_GROUP=25,    /* permitted hugetlb group */
        VM_VFS_CACHE_PRESSURE=26, /* dcache/icache reclaim pressure */
+       VM_LEGACY_VA_LAYOUT=27, /* legacy/compatibility virtual address space layout */
 };
 
 
@@ -190,6 +191,7 @@ enum
        NET_DECNET=15,
        NET_ECONET=16,
        NET_SCTP=17, 
+       NET_TUX=18,
 };
 
 /* /proc/sys/kernel/random */
@@ -635,6 +637,55 @@ enum {
        NET_BRIDGE_NF_FILTER_VLAN_TAGGED = 4,
 };
 
+/* /proc/sys/net/tux/ */
+enum {
+       NET_TUX_DOCROOT                 =  1,
+       NET_TUX_LOGFILE                 =  2,
+       NET_TUX_EXTCGI                  =  3,
+       NET_TUX_STOP                    =  4,
+       NET_TUX_CLIENTPORT              =  5,
+       NET_TUX_LOGGING                 =  6,
+       NET_TUX_SERVERPORT              =  7,
+       NET_TUX_THREADS                 =  8,
+       NET_TUX_KEEPALIVE_TIMEOUT       =  9,
+       NET_TUX_MAX_KEEPALIVE_BW        = 10,
+       NET_TUX_DEFER_ACCEPT            = 11,
+       NET_TUX_MAX_FREE_REQUESTS       = 12,
+       NET_TUX_MAX_CONNECT             = 13,
+       NET_TUX_MAX_BACKLOG             = 14,
+       NET_TUX_MODE_FORBIDDEN          = 15,
+       NET_TUX_MODE_ALLOWED            = 16,
+       NET_TUX_MODE_USERSPACE          = 17,
+       NET_TUX_MODE_CGI                = 18,
+       NET_TUX_CGI_UID                 = 19,
+       NET_TUX_CGI_GID                 = 20,
+       NET_TUX_CGIROOT                 = 21,
+       NET_TUX_LOGENTRY_ALIGN_ORDER    = 22,
+       NET_TUX_NONAGLE                 = 23,
+       NET_TUX_ACK_PINGPONG            = 24,
+       NET_TUX_PUSH_ALL                = 25,
+       NET_TUX_ZEROCOPY_PARSE          = 26,
+       NET_CONFIG_TUX_DEBUG_BLOCKING   = 27,
+       NET_TUX_PAGE_AGE_START          = 28,
+       NET_TUX_PAGE_AGE_ADV            = 29,
+       NET_TUX_PAGE_AGE_MAX            = 30,
+       NET_TUX_VIRTUAL_SERVER          = 31,
+       NET_TUX_MAX_OBJECT_SIZE         = 32,
+       NET_TUX_COMPRESSION             = 33,
+       NET_TUX_NOID                    = 34,
+       NET_TUX_CGI_INHERIT_CPU         = 35,
+       NET_TUX_CGI_CPU_MASK            = 36,
+       NET_TUX_ZEROCOPY_HEADER         = 37,
+       NET_TUX_ZEROCOPY_SENDFILE       = 38,
+       NET_TUX_ALL_USERSPACE           = 39,
+       NET_TUX_REDIRECT_LOGGING        = 40,
+       NET_TUX_REFERER_LOGGING         = 41,
+       NET_TUX_MAX_HEADER_LEN          = 42,
+       NET_TUX_404_PAGE                = 43,
+       NET_TUX_MAX_KEEPALIVES          = 44,
+       NET_TUX_IGNORE_QUERY            = 45,
+};
+
 /* CTL_PROC names: */
 
 /* CTL_FS names: */
@@ -771,24 +822,24 @@ typedef int ctl_handler (ctl_table *table, int __user *name, int nlen,
                         void **context);
 
 typedef int proc_handler (ctl_table *ctl, int write, struct file * filp,
-                         void __user *buffer, size_t *lenp);
+                         void __user *buffer, size_t *lenp, loff_t *ppos);
 
 extern int proc_dostring(ctl_table *, int, struct file *,
-                        void __user *, size_t *);
+                        void __user *, size_t *, loff_t *);
 extern int proc_dointvec(ctl_table *, int, struct file *,
-                        void __user *, size_t *);
+                        void __user *, size_t *, loff_t *);
 extern int proc_dointvec_bset(ctl_table *, int, struct file *,
-                             void __user *, size_t *);
+                             void __user *, size_t *, loff_t *);
 extern int proc_dointvec_minmax(ctl_table *, int, struct file *,
-                               void __user *, size_t *);
+                               void __user *, size_t *, loff_t *);
 extern int proc_dointvec_jiffies(ctl_table *, int, struct file *,
-                                void __user *, size_t *);
+                                void __user *, size_t *, loff_t *);
 extern int proc_dointvec_userhz_jiffies(ctl_table *, int, struct file *,
-                                       void __user *, size_t *);
+                                       void __user *, size_t *, loff_t *);
 extern int proc_doulongvec_minmax(ctl_table *, int, struct file *,
-                                 void __user *, size_t *);
+                                 void __user *, size_t *, loff_t *);
 extern int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int,
-                                     struct file *, void __user *, size_t *);
+                                     struct file *, void __user *, size_t *, loff_t *);
 
 extern int do_sysctl (int __user *name, int nlen,
                      void __user *oldval, size_t __user *oldlenp,
index aee265d..9cdf696 100644 (file)
@@ -438,6 +438,7 @@ struct tcp_opt {
                __u32   cnt;            /* increase cwnd by 1 after this number of ACKs */
                __u32   last_max_cwnd;  /* last maximium snd_cwnd */
                __u32   last_cwnd;      /* the last snd_cwnd */
+               __u32   last_stamp;     /* time when updated last_cwnd */
        } bictcp;
 
 #ifdef CONFIG_ACCEPT_QUEUES
index 9a559f9..383a93c 100644 (file)
@@ -50,6 +50,10 @@ void do_unblank_screen(int leaving_gfx);
 void unblank_screen(void);
 void poke_blanked_console(void);
 int con_font_op(int currcons, struct console_font_op *op);
+int con_font_set(int currcons, struct console_font_op *op);
+int con_font_get(int currcons, struct console_font_op *op);
+int con_font_default(int currcons, struct console_font_op *op);
+int con_font_copy(int currcons, struct console_font_op *op);
 int con_set_cmap(unsigned char __user *cmap);
 int con_get_cmap(unsigned char __user *cmap);
 void scrollback(int);
index 99c02a8..6f91e4d 100644 (file)
@@ -87,7 +87,7 @@ extern int laptop_mode;
 struct ctl_table;
 struct file;
 int dirty_writeback_centisecs_handler(struct ctl_table *, int, struct file *,
-                                     void __user *, size_t *);
+                                     void __user *, size_t *, loff_t *);
 
 void page_writeback_init(void);
 void balance_dirty_pages_ratelimited(struct address_space *mapping);
index 4928cfd..fc2b279 100644 (file)
@@ -160,8 +160,8 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp)
                inet6_ifa_finish_destroy(ifp);
 }
 
-#define __in6_ifa_put(idev)  atomic_dec(&(idev)->refcnt)
-#define in6_ifa_hold(idev)   atomic_inc(&(idev)->refcnt)
+#define __in6_ifa_put(ifp)     atomic_dec(&(ifp)->refcnt)
+#define in6_ifa_hold(ifp)      atomic_inc(&(ifp)->refcnt)
 
 
 extern void                    addrconf_forwarding_on(void);
@@ -178,8 +178,8 @@ static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr)
         * This will include the IEEE address token on links that support it.
         */
 
-       word = addr->s6_addr[2] ^ addr->s6_addr32[3];
-       word  ^= (word>>16);
+       word = addr->s6_addr32[2] ^ addr->s6_addr32[3];
+       word ^= (word >> 16);
        word ^= (word >> 8);
 
        return ((word ^ (word >> 4)) & 0x0f);
index 8bdea57..06e19d3 100644 (file)
@@ -432,7 +432,7 @@ struct inquiry_info_with_rssi {
        __u8     pscan_period_mode;
        __u8     dev_class[3];
        __u16    clock_offset;
-       __u8     rssi;
+       __s8     rssi;
 } __attribute__ ((packed));
 
 #define HCI_EV_CONN_COMPLETE   0x03
index 7b6ea43..bacccde 100644 (file)
@@ -109,6 +109,9 @@ extern ssize_t              ip_append_page(struct sock *sk, struct page *page,
 extern int             ip_push_pending_frames(struct sock *sk);
 extern void            ip_flush_pending_frames(struct sock *sk);
 
+/* datagram.c */
+extern int             ip4_datagram_connect(struct sock *sk, 
+                                            struct sockaddr *uaddr, int addr_len);
 
 /*
  *     Map a multicast IP onto multicast MAC for type Token Ring.
@@ -128,10 +131,10 @@ static inline void ip_tr_mc_map(u32 addr, char *buf)
 }
 
 struct ip_reply_arg {
-       struct iovec iov[1];   
-       u32          csum; 
-       int          csumoffset; /* u16 offset of csum in iov[0].iov_base */
-                                /* -1 if not needed */ 
+       struct kvec iov[1];   
+       u32         csum; 
+       int         csumoffset; /* u16 offset of csum in iov[0].iov_base */
+                               /* -1 if not needed */ 
 }; 
 
 void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
@@ -298,7 +301,7 @@ extern int ipv4_proc_init(void);
  */
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
                         struct file* filp, void __user *buffer,
-                        size_t *lenp);
+                        size_t *lenp, loff_t *ppos);
 int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen,
                                  void __user *oldval, size_t __user *oldlenp,
                                  void __user *newval, size_t newlen, 
index 2911490..75d503d 100644 (file)
@@ -104,9 +104,7 @@ extern rwlock_t rt6_lock;
 
 /*
  *     Store a destination cache entry in a socket
- *     For UDP/RAW sockets this is done on udp_connect.
  */
-
 static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
                                     struct in6_addr *daddr)
 {
index 8f647ae..034cf30 100644 (file)
@@ -406,6 +406,9 @@ extern void                 ipv6_packet_init(void);
 
 extern void                    ipv6_packet_cleanup(void);
 
+extern int                     ip6_datagram_connect(struct sock *sk, 
+                                                    struct sockaddr *addr, int addr_len);
+
 extern int                     ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
 extern void                    ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, u16 port,
                                                u32 info, u8 *payload);
index 825e110..bce3aaf 100644 (file)
@@ -1,12 +1,6 @@
 #ifndef __NET_PKT_SCHED_H
 #define __NET_PKT_SCHED_H
 
-#define PSCHED_GETTIMEOFDAY    1
-#define PSCHED_JIFFIES                 2
-#define PSCHED_CPU             3
-
-#define PSCHED_CLOCK_SOURCE    PSCHED_JIFFIES
-
 #include <linux/config.h>
 #include <linux/netdevice.h>
 #include <linux/types.h>
 #include <linux/module.h>
 #include <linux/rtnetlink.h>
 
-#ifdef CONFIG_X86_TSC
-#include <asm/msr.h>
-#endif
-
-
 struct rtattr;
 struct Qdisc;
 
@@ -88,12 +77,13 @@ struct Qdisc
 #define TCQ_F_BUILTIN  1
 #define TCQ_F_THROTTLED        2
 #define TCQ_F_INGRES   4
+       int                     padded;
        struct Qdisc_ops        *ops;
-       struct Qdisc            *next;
        u32                     handle;
        atomic_t                refcnt;
        struct sk_buff_head     q;
        struct net_device       *dev;
+       struct list_head        list;
 
        struct tc_stats         stats;
        spinlock_t              *stats_lock;
@@ -104,10 +94,17 @@ struct Qdisc
         * and it will live until better solution will be invented.
         */
        struct Qdisc            *__parent;
-
-       char                    data[0];
 };
 
+#define        QDISC_ALIGN             32
+#define        QDISC_ALIGN_CONST       (QDISC_ALIGN - 1)
+
+static inline void *qdisc_priv(struct Qdisc *q)
+{
+       return (char *)q + ((sizeof(struct Qdisc) + QDISC_ALIGN_CONST)
+                             & ~QDISC_ALIGN_CONST);
+}
+
 struct qdisc_rate_table
 {
        struct tc_ratespec rate;
@@ -116,43 +113,15 @@ struct qdisc_rate_table
        int             refcnt;
 };
 
-static inline void sch_tree_lock(struct Qdisc *q)
-{
-       write_lock(&qdisc_tree_lock);
-       spin_lock_bh(&q->dev->queue_lock);
-}
-
-static inline void sch_tree_unlock(struct Qdisc *q)
-{
-       spin_unlock_bh(&q->dev->queue_lock);
-       write_unlock(&qdisc_tree_lock);
-}
-
-static inline void tcf_tree_lock(struct tcf_proto *tp)
-{
-       write_lock(&qdisc_tree_lock);
-       spin_lock_bh(&tp->q->dev->queue_lock);
-}
-
-static inline void tcf_tree_unlock(struct tcf_proto *tp)
-{
-       spin_unlock_bh(&tp->q->dev->queue_lock);
-       write_unlock(&qdisc_tree_lock);
-}
-
-
-static inline unsigned long
-cls_set_class(struct tcf_proto *tp, unsigned long *clp, unsigned long cl)
-{
-       unsigned long old_cl;
+extern void qdisc_lock_tree(struct net_device *dev);
+extern void qdisc_unlock_tree(struct net_device *dev);
 
-       tcf_tree_lock(tp);
-       old_cl = *clp;
-       *clp = cl;
-       tcf_tree_unlock(tp);
-       return old_cl;
-}
+#define sch_tree_lock(q)       qdisc_lock_tree((q)->dev)
+#define sch_tree_unlock(q)     qdisc_unlock_tree((q)->dev)
+#define tcf_tree_lock(tp)      qdisc_lock_tree((tp)->q->dev)
+#define tcf_tree_unlock(tp)    qdisc_unlock_tree((tp)->q->dev)
 
+#define cls_set_class(tp, clp, cl) tcf_set_class(tp, clp, cl)
 static inline unsigned long
 __cls_set_class(unsigned long *clp, unsigned long cl)
 {
@@ -184,25 +153,19 @@ __cls_set_class(unsigned long *clp, unsigned long cl)
    The reason is that, when it is not the same thing as
    gettimeofday, it returns invalid timestamp, which is
    not updated, when net_bh is active.
-
-   So, use PSCHED_CLOCK_SOURCE = PSCHED_CPU on alpha and pentiums
-   with rtdsc. And PSCHED_JIFFIES on all other architectures, including [34]86
-   and pentiums without rtdsc.
-   You can use PSCHED_GETTIMEOFDAY on another architectures,
-   which have fast and precise clock source, but it is too expensive.
  */
 
 /* General note about internal clock.
 
    Any clock source returns time intervals, measured in units
-   close to 1usec. With source PSCHED_GETTIMEOFDAY it is precisely
+   close to 1usec. With source CONFIG_NET_SCH_CLK_GETTIMEOFDAY it is precisely
    microseconds, otherwise something close but different chosen to minimize
    arithmetic cost. Ratio usec/internal untis in form nominator/denominator
    may be read from /proc/net/psched.
  */
 
 
-#if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
 
 typedef struct timeval psched_time_t;
 typedef long           psched_tdiff_t;
@@ -211,14 +174,12 @@ typedef long              psched_tdiff_t;
 #define PSCHED_US2JIFFIE(usecs) (((usecs)+(1000000/HZ-1))/(1000000/HZ))
 #define PSCHED_JIFFIE2US(delay) ((delay)*(1000000/HZ))
 
-#else /* PSCHED_CLOCK_SOURCE != PSCHED_GETTIMEOFDAY */
+#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
 
 typedef u64    psched_time_t;
 typedef long   psched_tdiff_t;
 
-extern psched_time_t   psched_time_base;
-
-#if PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
+#ifdef CONFIG_NET_SCH_CLK_JIFFIES
 
 #if HZ < 96
 #define PSCHED_JSCALE 14
@@ -236,47 +197,35 @@ extern psched_time_t      psched_time_base;
 #define PSCHED_US2JIFFIE(delay) (((delay)+(1<<PSCHED_JSCALE)-1)>>PSCHED_JSCALE)
 #define PSCHED_JIFFIE2US(delay) ((delay)<<PSCHED_JSCALE)
 
-#elif PSCHED_CLOCK_SOURCE == PSCHED_CPU
+#endif /* CONFIG_NET_SCH_CLK_JIFFIES */
+#ifdef CONFIG_NET_SCH_CLK_CPU
+#include <asm/timex.h>
 
 extern psched_tdiff_t psched_clock_per_hz;
 extern int psched_clock_scale;
-
+extern psched_time_t psched_time_base;
+extern cycles_t psched_time_mark;
+
+#define PSCHED_GET_TIME(stamp)                                         \
+do {                                                                   \
+       cycles_t cur = get_cycles();                                    \
+       if (sizeof(cycles_t) == sizeof(u32)) {                          \
+               if (cur <= psched_time_mark)                            \
+                       psched_time_base += 0x100000000ULL;             \
+               psched_time_mark = cur;                                 \
+               (stamp) = (psched_time_base + cur)>>psched_clock_scale; \
+       } else {                                                        \
+               (stamp) = cur>>psched_clock_scale;                      \
+       }                                                               \
+} while (0)
 #define PSCHED_US2JIFFIE(delay) (((delay)+psched_clock_per_hz-1)/psched_clock_per_hz)
 #define PSCHED_JIFFIE2US(delay) ((delay)*psched_clock_per_hz)
 
-#ifdef CONFIG_X86_TSC
-
-#define PSCHED_GET_TIME(stamp) \
-({ u64 __cur; \
-   rdtscll(__cur); \
-   (stamp) = __cur>>psched_clock_scale; \
-})
-
-#elif defined (__alpha__)
-
-#define PSCHED_WATCHER u32
+#endif /* CONFIG_NET_SCH_CLK_CPU */
 
-extern PSCHED_WATCHER psched_time_mark;
+#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
 
-#define PSCHED_GET_TIME(stamp) \
-({ u32 __res; \
-   __asm__ __volatile__ ("rpcc %0" : "r="(__res)); \
-   if (__res <= psched_time_mark) psched_time_base += 0x100000000UL; \
-   psched_time_mark = __res; \
-   (stamp) = (psched_time_base + __res)>>psched_clock_scale; \
-})
-
-#else
-
-#error PSCHED_CLOCK_SOURCE=PSCHED_CPU is not supported on this arch.
-
-#endif /* ARCH */
-
-#endif /* PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES */
-
-#endif /* PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY */
-
-#if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
 #define PSCHED_TDIFF(tv1, tv2) \
 ({ \
           int __delta_sec = (tv1).tv_sec - (tv2).tv_sec; \
@@ -340,7 +289,7 @@ extern int psched_tod_diff(int delta_sec, int bound);
 
 #define        PSCHED_AUDIT_TDIFF(t) ({ if ((t) > 2000000) (t) = 2000000; })
 
-#else
+#else /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
 
 #define PSCHED_TDIFF(tv1, tv2) (long)((tv1) - (tv2))
 #define PSCHED_TDIFF_SAFE(tv1, tv2, bound) \
@@ -354,7 +303,7 @@ extern int psched_tod_diff(int delta_sec, int bound);
 #define PSCHED_IS_PASTPERFECT(t)       ((t) == 0)
 #define        PSCHED_AUDIT_TDIFF(t)
 
-#endif
+#endif /* !CONFIG_NET_SCH_CLK_GETTIMEOFDAY */
 
 struct tcf_police
 {
@@ -438,6 +387,8 @@ extern int tcf_act_police_dump(struct sk_buff *, struct tc_action *, int, int);
 extern int tcf_act_police(struct sk_buff **skb, struct tc_action *a);
 #endif
 
+extern unsigned long tcf_set_class(struct tcf_proto *tp, unsigned long *clp, 
+                                  unsigned long cl);
 extern int tcf_police(struct sk_buff *skb, struct tcf_police *p);
 extern int qdisc_copy_stats(struct sk_buff *skb, struct tc_stats *st, spinlock_t *lock);
 extern void tcf_police_destroy(struct tcf_police *p);
@@ -489,13 +440,6 @@ void qdisc_put_rtab(struct qdisc_rate_table *tab);
 
 extern int qdisc_restart(struct net_device *dev);
 
-static inline void qdisc_run(struct net_device *dev)
-{
-       while (!netif_queue_stopped(dev) &&
-              qdisc_restart(dev)<0)
-               /* NOTHING */;
-}
-
 /* Calculate maximal size of packet seen by hard_start_xmit
    routine of this device.
  */
index c702dda..b706887 100644 (file)
 #define _SNMP_H
 
 #include <linux/cache.h>
-/*
- *     We use all unsigned longs. Linux will soon be so reliable that even these
- *     will rapidly get too small 8-). Seriously consider the IpInReceives count
- *     on the 20Gb/s + networks people expect in a few years time!
- */
-
-/* 
- * The rule for padding: 
- * Best is power of two because then the right structure can be found by a simple
- * shift. The structure should be always cache line aligned.
- * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add instructions
- * to emulate multiply in case it is not power-of-two. Currently n is always <=3 for
- * all sizes so simple cache line alignment is enough. 
- * 
- * The best solution would be a global CPU local area , especially on 64 and 128byte 
- * cacheline machine it makes a *lot* of sense -AK
- */ 
-
-struct snmp_item {
-       char *name;
-       int offset;
-};
-
-#define SNMP_ITEM(mib,entry,procname)  {       \
-       .name = procname,                       \
-       .offset = offsetof(mib, entry),         \
-}
-
-#define SNMP_ITEM_SENTINEL {                   \
-       .name = NULL,                           \
-       .offset = 0,                            \
-}
+#include <linux/snmp.h>
 
 /*
- * RFC 1213:  MIB-II
- * RFC 2011 (updates 1213):  SNMPv2-MIB-IP
- * RFC 2863:  Interfaces Group MIB
- * RFC 2465:  IPv6 MIB: General Group
- * draft-ietf-ipv6-rfc2011-update-10.txt: MIB for IP: IP Statistics Tables
+ * Mibs are stored in array of unsigned long.
  */
-struct ipstats_mib
-{
-       unsigned long   InReceives;
-       unsigned long   InHdrErrors;
-       unsigned long   InTooBigErrors;
-       unsigned long   InNoRoutes;
-       unsigned long   InAddrErrors;
-       unsigned long   InUnknownProtos;
-       unsigned long   InTruncatedPkts;
-       unsigned long   InDiscards;
-       unsigned long   InDelivers;
-       unsigned long   OutForwDatagrams;
-       unsigned long   OutRequests;
-       unsigned long   OutDiscards;
-       unsigned long   OutNoRoutes;
-       unsigned long   ReasmTimeout;
-       unsigned long   ReasmReqds;
-       unsigned long   ReasmOKs;
-       unsigned long   ReasmFails;
-       unsigned long   FragOKs;
-       unsigned long   FragFails;
-       unsigned long   FragCreates;
-       unsigned long   InMcastPkts;
-       unsigned long   OutMcastPkts;
-       unsigned long   __pad[0]; 
-};
 /*
- * RFC 1213:  MIB-II ICMP Group
- * RFC 2011 (updates 1213):  SNMPv2 MIB for IP: ICMP group
+ * struct snmp_mib{}
+ *  - list of entries for particular API (such as /proc/net/snmp)
+ *  - name of entries.
  */
-struct icmp_mib
-{
-       unsigned long   IcmpInMsgs;
-       unsigned long   IcmpInErrors;
-       unsigned long   IcmpInDestUnreachs;
-       unsigned long   IcmpInTimeExcds;
-       unsigned long   IcmpInParmProbs;
-       unsigned long   IcmpInSrcQuenchs;
-       unsigned long   IcmpInRedirects;
-       unsigned long   IcmpInEchos;
-       unsigned long   IcmpInEchoReps;
-       unsigned long   IcmpInTimestamps;
-       unsigned long   IcmpInTimestampReps;
-       unsigned long   IcmpInAddrMasks;
-       unsigned long   IcmpInAddrMaskReps;
-       unsigned long   IcmpOutMsgs;
-       unsigned long   IcmpOutErrors;
-       unsigned long   IcmpOutDestUnreachs;
-       unsigned long   IcmpOutTimeExcds;
-       unsigned long   IcmpOutParmProbs;
-       unsigned long   IcmpOutSrcQuenchs;
-       unsigned long   IcmpOutRedirects;
-       unsigned long   IcmpOutEchos;
-       unsigned long   IcmpOutEchoReps;
-       unsigned long   IcmpOutTimestamps;
-       unsigned long   IcmpOutTimestampReps;
-       unsigned long   IcmpOutAddrMasks;
-       unsigned long   IcmpOutAddrMaskReps;
-       unsigned long   dummy;
-       unsigned long   __pad[0]; 
+struct snmp_mib {
+       char *name;
+       int entry;
 };
 
-/*
- * RFC 2466:  ICMPv6-MIB
- */
-struct icmpv6_mib
-{
-       unsigned long   Icmp6InMsgs;
-       unsigned long   Icmp6InErrors;
-
-       unsigned long   Icmp6InDestUnreachs;
-       unsigned long   Icmp6InPktTooBigs;
-       unsigned long   Icmp6InTimeExcds;
-       unsigned long   Icmp6InParmProblems;
-
-       unsigned long   Icmp6InEchos;
-       unsigned long   Icmp6InEchoReplies;
-       unsigned long   Icmp6InGroupMembQueries;
-       unsigned long   Icmp6InGroupMembResponses;
-       unsigned long   Icmp6InGroupMembReductions;
-       unsigned long   Icmp6InRouterSolicits;
-       unsigned long   Icmp6InRouterAdvertisements;
-       unsigned long   Icmp6InNeighborSolicits;
-       unsigned long   Icmp6InNeighborAdvertisements;
-       unsigned long   Icmp6InRedirects;
-
-       unsigned long   Icmp6OutMsgs;
+#define SNMP_MIB_ITEM(_name,_entry)    {       \
+       .name = _name,                          \
+       .entry = _entry,                        \
+}
 
-       unsigned long   Icmp6OutDestUnreachs;
-       unsigned long   Icmp6OutPktTooBigs;
-       unsigned long   Icmp6OutTimeExcds;
-       unsigned long   Icmp6OutParmProblems;
+#define SNMP_MIB_SENTINEL {    \
+       .name = NULL,           \
+       .entry = 0,             \
+}
 
-       unsigned long   Icmp6OutEchoReplies;
-       unsigned long   Icmp6OutRouterSolicits;
-       unsigned long   Icmp6OutNeighborSolicits;
-       unsigned long   Icmp6OutNeighborAdvertisements;
-       unsigned long   Icmp6OutRedirects;
-       unsigned long   Icmp6OutGroupMembResponses;
-       unsigned long   Icmp6OutGroupMembReductions;
-       unsigned long   __pad[0]; 
-};
-/*
- * RFC 1213:  MIB-II TCP group
- * RFC 2012 (updates 1213):  SNMPv2-MIB-TCP
- */
-struct tcp_mib
-{
-       unsigned long   TcpRtoAlgorithm;
-       unsigned long   TcpRtoMin;
-       unsigned long   TcpRtoMax;
-       unsigned long   TcpMaxConn;
-       unsigned long   TcpActiveOpens;
-       unsigned long   TcpPassiveOpens;
-       unsigned long   TcpAttemptFails;
-       unsigned long   TcpEstabResets;
-       unsigned long   TcpCurrEstab;
-       unsigned long   TcpInSegs;
-       unsigned long   TcpOutSegs;
-       unsigned long   TcpRetransSegs;
-       unsigned long   TcpInErrs;
-       unsigned long   TcpOutRsts;
-       unsigned long   __pad[0]; 
-};
 /*
- * RFC 1213:  MIB-II UDP group
- * RFC 2013 (updates 1213):  SNMPv2-MIB-UDP
+ * We use all unsigned longs. Linux will soon be so reliable that even 
+ * these will rapidly get too small 8-). Seriously consider the IpInReceives 
+ * count on the 20Gb/s + networks people expect in a few years time!
  */
-struct udp_mib
-{
-       unsigned long   UdpInDatagrams;
-       unsigned long   UdpNoPorts;
-       unsigned long   UdpInErrors;
-       unsigned long   UdpOutDatagrams;
-       unsigned long   __pad[0];
-}; 
 
-/* draft-ietf-sigtran-sctp-mib-07.txt */
-struct sctp_mib
-{
-       unsigned long   SctpCurrEstab;
-       unsigned long   SctpActiveEstabs;
-       unsigned long   SctpPassiveEstabs;
-       unsigned long   SctpAborteds;
-       unsigned long   SctpShutdowns;
-       unsigned long   SctpOutOfBlues;
-       unsigned long   SctpChecksumErrors;
-       unsigned long   SctpOutCtrlChunks;
-       unsigned long   SctpOutOrderChunks;
-       unsigned long   SctpOutUnorderChunks;
-       unsigned long   SctpInCtrlChunks;
-       unsigned long   SctpInOrderChunks;
-       unsigned long   SctpInUnorderChunks;
-       unsigned long   SctpFragUsrMsgs;
-       unsigned long   SctpReasmUsrMsgs;
-       unsigned long   SctpOutSCTPPacks;
-       unsigned long   SctpInSCTPPacks;
-       unsigned long   SctpRtoAlgorithm;
-       unsigned long   SctpRtoMin;
-       unsigned long   SctpRtoMax;
-       unsigned long   SctpRtoInitial;
-       unsigned long   SctpValCookieLife;
-       unsigned long   SctpMaxInitRetr;
-       unsigned long   __pad[0];
-};
+/* 
+ * The rule for padding: 
+ * Best is power of two because then the right structure can be found by a 
+ * simple shift. The structure should be always cache line aligned.
+ * gcc needs n=alignto(cachelinesize, popcnt(sizeof(bla_mib))) shift/add 
+ * instructions to emulate multiply in case it is not power-of-two. 
+ * Currently n is always <=3 for all sizes so simple cache line alignment 
+ * is enough. 
+ * 
+ * The best solution would be a global CPU local area , especially on 64 
+ * and 128byte cacheline machine it makes a *lot* of sense -AK
+ */ 
 
-struct linux_mib 
-{
-       unsigned long   SyncookiesSent;
-       unsigned long   SyncookiesRecv;
-       unsigned long   SyncookiesFailed;
-       unsigned long   EmbryonicRsts;
-       unsigned long   PruneCalled; 
-       unsigned long   RcvPruned;
-       unsigned long   OfoPruned;
-       unsigned long   OutOfWindowIcmps; 
-       unsigned long   LockDroppedIcmps; 
-        unsigned long   ArpFilter;
-       unsigned long   TimeWaited; 
-       unsigned long   TimeWaitRecycled; 
-       unsigned long   TimeWaitKilled; 
-       unsigned long   PAWSPassiveRejected; 
-       unsigned long   PAWSActiveRejected; 
-       unsigned long   PAWSEstabRejected; 
-       unsigned long   DelayedACKs;
-       unsigned long   DelayedACKLocked;
-       unsigned long   DelayedACKLost;
-       unsigned long   ListenOverflows;
-       unsigned long   ListenDrops;
-       unsigned long   TCPPrequeued;
-       unsigned long   TCPDirectCopyFromBacklog;
-       unsigned long   TCPDirectCopyFromPrequeue;
-       unsigned long   TCPPrequeueDropped;
-       unsigned long   TCPHPHits;
-       unsigned long   TCPHPHitsToUser;
-       unsigned long   TCPPureAcks;
-       unsigned long   TCPHPAcks;
-       unsigned long   TCPRenoRecovery;
-       unsigned long   TCPSackRecovery;
-       unsigned long   TCPSACKReneging;
-       unsigned long   TCPFACKReorder;
-       unsigned long   TCPSACKReorder;
-       unsigned long   TCPRenoReorder;
-       unsigned long   TCPTSReorder;
-       unsigned long   TCPFullUndo;
-       unsigned long   TCPPartialUndo;
-       unsigned long   TCPDSACKUndo;
-       unsigned long   TCPLossUndo;
-       unsigned long   TCPLoss;
-       unsigned long   TCPLostRetransmit;
-       unsigned long   TCPRenoFailures;
-       unsigned long   TCPSackFailures;
-       unsigned long   TCPLossFailures;
-       unsigned long   TCPFastRetrans;
-       unsigned long   TCPForwardRetrans;
-       unsigned long   TCPSlowStartRetrans;
-       unsigned long   TCPTimeouts;
-       unsigned long   TCPRenoRecoveryFail;
-       unsigned long   TCPSackRecoveryFail;
-       unsigned long   TCPSchedulerFailed;
-       unsigned long   TCPRcvCollapsed;
-       unsigned long   TCPDSACKOldSent;
-       unsigned long   TCPDSACKOfoSent;
-       unsigned long   TCPDSACKRecv;
-       unsigned long   TCPDSACKOfoRecv;
-       unsigned long   TCPAbortOnSyn;
-       unsigned long   TCPAbortOnData;
-       unsigned long   TCPAbortOnClose;
-       unsigned long   TCPAbortOnMemory;
-       unsigned long   TCPAbortOnTimeout;
-       unsigned long   TCPAbortOnLinger;
-       unsigned long   TCPAbortFailed;
-       unsigned long   TCPMemoryPressures;
-       unsigned long   __pad[0];
+#define __SNMP_MIB_ALIGN__     ____cacheline_aligned
+
+/* IPstats */
+#define IPSTATS_MIB_MAX        __IPSTATS_MIB_MAX
+struct ipstats_mib {
+       unsigned long   mibs[IPSTATS_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* ICMP */
+#define ICMP_MIB_DUMMY __ICMP_MIB_MAX
+#define ICMP_MIB_MAX   (__ICMP_MIB_MAX + 1)
+
+struct icmp_mib {
+       unsigned long   mibs[ICMP_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* ICMP6 (IPv6-ICMP) */
+#define ICMP6_MIB_MAX  __ICMP6_MIB_MAX
+struct icmpv6_mib {
+       unsigned long   mibs[ICMP6_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* TCP */
+#define TCP_MIB_MAX    __TCP_MIB_MAX
+struct tcp_mib {
+       unsigned long   mibs[TCP_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* UDP */
+#define UDP_MIB_MAX    __UDP_MIB_MAX
+struct udp_mib {
+       unsigned long   mibs[UDP_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* SCTP */
+#define SCTP_MIB_MAX   __SCTP_MIB_MAX
+struct sctp_mib {
+       unsigned long   mibs[SCTP_MIB_MAX];
+} __SNMP_MIB_ALIGN__;
+
+/* Linux */
+#define LINUX_MIB_MAX  __LINUX_MIB_MAX
+struct linux_mib {
+       unsigned long   mibs[LINUX_MIB_MAX];
 };
 
 
 /* 
- * FIXME: On x86 and some other CPUs the split into user and softirq parts is not needed because 
- * addl $1,memory is atomic against interrupts (but atomic_inc would be overkill because of the lock 
- * cycles). Wants new nonlocked_atomic_inc() primitives -AK
+ * FIXME: On x86 and some other CPUs the split into user and softirq parts
+ * is not needed because addl $1,memory is atomic against interrupts (but 
+ * atomic_inc would be overkill because of the lock cycles). Wants new 
+ * nonlocked_atomic_inc() primitives -AK
  */ 
 #define DEFINE_SNMP_STAT(type, name)   \
        __typeof__(type) *name[2]
@@ -317,18 +128,18 @@ struct linux_mib
 #define SNMP_STAT_USRPTR(name) (name[1])
 
 #define SNMP_INC_STATS_BH(mib, field)  \
-       (per_cpu_ptr(mib[0], smp_processor_id())->field++)
+       (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field]++)
 #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset)   \
-       ((*((&per_cpu_ptr(mib[0], smp_processor_id())->field) + (offset)))++)
+       (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field + (offset)]++)
 #define SNMP_INC_STATS_USER(mib, field) \
-       (per_cpu_ptr(mib[1], smp_processor_id())->field++)
+       (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field]++)
 #define SNMP_INC_STATS(mib, field)     \
-       (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->field++)
+       (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]++)
 #define SNMP_DEC_STATS(mib, field)     \
-       (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->field--)
+       (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]--)
 #define SNMP_ADD_STATS_BH(mib, field, addend)  \
-       (per_cpu_ptr(mib[0], smp_processor_id())->field += addend)
+       (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field] += addend)
 #define SNMP_ADD_STATS_USER(mib, field, addend)        \
-       (per_cpu_ptr(mib[1], smp_processor_id())->field += addend)
-       
+       (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field] += addend)
+
 #endif
index f28b400..a2aba08 100644 (file)
@@ -62,7 +62,7 @@
  */
 
 /* Define this to get the sk->sk_debug debugging facility. */
-#define SOCK_DEBUGGING
+//#define SOCK_DEBUGGING
 #ifdef SOCK_DEBUGGING
 #define SOCK_DEBUG(sk, msg...) do { if ((sk) && ((sk)->sk_debug)) \
                                        printk(KERN_DEBUG msg); } while (0)
@@ -169,7 +169,7 @@ struct sock_common {
   *    @sk_timer - sock cleanup timer
   *    @sk_stamp - time stamp of last packet received
   *    @sk_socket - Identd and reporting IO signals
-  *    @sk_user_data - RPC layer private data
+  *    @sk_user_data - RPC and Tux layer private data
   *    @sk_owner - module that owns this socket
   *    @sk_sndmsg_page - cached page for sendmsg
   *    @sk_sndmsg_off - cached offset for sendmsg
@@ -180,6 +180,7 @@ struct sock_common {
   *    @sk_data_ready - callback to indicate there is data to be processed
   *    @sk_write_space - callback to indicate there is bf sending space available
   *    @sk_error_report - callback to indicate errors (e.g. %MSG_ERRQUEUE)
+  *    @sk_create_child - callback to get new socket events
   *    @sk_backlog_rcv - callback to process the backlog
   *    @sk_destruct - called at sock freeing time, i.e. when all refcnt == 0
  */
@@ -274,6 +275,7 @@ struct sock {
        void                    (*sk_error_report)(struct sock *sk);
        int                     (*sk_backlog_rcv)(struct sock *sk,
                                                  struct sk_buff *skb);  
+       void                    (*sk_create_child)(struct sock *sk, struct sock *newsk);
        void                    (*sk_destruct)(struct sock *sk);
 };
 
index 79b7e24..bbdd19e 100644 (file)
@@ -967,6 +967,7 @@ extern int  tcp_transmit_skb(struct sock *, struct sk_buff *);
 extern void tcp_push_one(struct sock *, unsigned mss_now);
 extern void tcp_send_ack(struct sock *sk);
 extern void tcp_send_delayed_ack(struct sock *sk);
+extern void cleanup_rbuf(struct sock *sk, int copied);
 
 /* tcp_timer.c */
 extern void tcp_init_xmit_timers(struct sock *);
@@ -1385,8 +1386,9 @@ static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct s
 /* Return 0, if packet can be sent now without violation Nagle's rules:
    1. It is full sized.
    2. Or it contains FIN.
-   3. Or TCP_NODELAY was set.
-   4. Or TCP_CORK is not set, and all sent packets are ACKed.
+   3. Or higher layers meant to force a packet boundary, hence the PSH bit.
+   4. Or TCP_NODELAY was set.
+   5. Or TCP_CORK is not set, and all sent packets are ACKed.
       With Minshall's modification: all sent small packets are ACKed.
  */
 
@@ -1551,7 +1553,7 @@ static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb)
 
                        while ((skb1 = __skb_dequeue(&tp->ucopy.prequeue)) != NULL) {
                                sk->sk_backlog_rcv(sk, skb1);
-                               NET_INC_STATS_BH(TCPPrequeueDropped);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPPREQUEUEDROPPED);
                        }
 
                        tp->ucopy.memory = 0;
@@ -1583,12 +1585,12 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
        switch (state) {
        case TCP_ESTABLISHED:
                if (oldstate != TCP_ESTABLISHED)
-                       TCP_INC_STATS(TcpCurrEstab);
+                       TCP_INC_STATS(TCP_MIB_CURRESTAB);
                break;
 
        case TCP_CLOSE:
                if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED)
-                       TCP_INC_STATS(TcpEstabResets);
+                       TCP_INC_STATS(TCP_MIB_ESTABRESETS);
 
                sk->sk_prot->unhash(sk);
                if (tcp_sk(sk)->bind_hash &&
@@ -1597,7 +1599,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state)
                /* fall through */
        default:
                if (oldstate==TCP_ESTABLISHED)
-                       TCP_DEC_STATS(TcpCurrEstab);
+                       TCP_DEC_STATS(TCP_MIB_CURRESTAB);
        }
 
        /* Change state AFTER socket is unhashed to avoid closed
@@ -2073,10 +2075,10 @@ static inline int tcp_use_frto(const struct sock *sk)
 static inline void tcp_mib_init(void)
 {
        /* See RFC 2012 */
-       TCP_ADD_STATS_USER(TcpRtoAlgorithm, 1);
-       TCP_ADD_STATS_USER(TcpRtoMin, TCP_RTO_MIN*1000/HZ);
-       TCP_ADD_STATS_USER(TcpRtoMax, TCP_RTO_MAX*1000/HZ);
-       TCP_ADD_STATS_USER(TcpMaxConn, -1);
+       TCP_ADD_STATS_USER(TCP_MIB_RTOALGORITHM, 1);
+       TCP_ADD_STATS_USER(TCP_MIB_RTOMIN, TCP_RTO_MIN*1000/HZ);
+       TCP_ADD_STATS_USER(TCP_MIB_RTOMAX, TCP_RTO_MAX*1000/HZ);
+       TCP_ADD_STATS_USER(TCP_MIB_MAXCONN, -1);
 }
 
 /* /proc */
diff --git a/include/net/tux.h b/include/net/tux.h
new file mode 100644 (file)
index 0000000..b6d35df
--- /dev/null
@@ -0,0 +1,800 @@
+#ifndef _NET_TUX_H
+#define _NET_TUX_H
+
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * tux.h: main structure definitions and function prototypes
+ */
+
+#define __KERNEL_SYSCALLS__
+
+#include <linux/mm.h>
+#include <linux/net.h>
+#include <linux/wait.h>
+#include <linux/namei.h>
+#include <linux/file.h>
+#include <linux/mman.h>
+#include <linux/swap.h>
+#include <linux/ctype.h>
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/unistd.h>
+#include <linux/sysctl.h>
+#include <linux/proc_fs.h>
+#include <linux/pagemap.h>
+#include <linux/vmalloc.h>
+#include <linux/utsname.h>
+#include <linux/smp_lock.h>
+#include <linux/kernel_stat.h>
+#include <linux/kernel_stat.h>
+#include <linux/time.h>
+#include <asm/div64.h>
+#include <asm/unaligned.h>
+#include <linux/compiler.h>
+#include <linux/mount.h>
+#include <linux/zlib.h>
+
+#include <net/tcp.h>
+#include <net/tux_u.h>
+
+/* Maximum number of threads: */
+#define CONFIG_TUX_NUMTHREADS 8
+
+/* Number of cachemiss/IO threads: */
+#define NR_IO_THREADS 32
+
+/* Maximum number of listen sockets per thread: */
+#define CONFIG_TUX_NUMSOCKETS 16
+
+extern spinlock_t tux_module_lock;
+extern struct module *tux_module;
+extern asmlinkage long (*sys_tux_ptr) (unsigned int action, user_req_t *u_info);
+
+#undef Dprintk
+
+extern int tux_TDprintk;
+extern int tux_Dprintk;
+
+#define TUX_DEBUG CONFIG_TUX_DEBUG
+#if CONFIG_TUX_DEBUG
+# define TUX_BUG() BUG()
+
+# define TUX_DPRINTK 1
+# define TDprintk(x...) do { if (tux_TDprintk) { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } } while (0)
+# define Dprintk(x...) do { if (tux_Dprintk == 1) TDprintk(x); } while (0)
+#else
+# define TUX_DPRINTK 0
+# define Dprintk(x...) do { } while (0)
+# define TDprintk(x...) do { } while (0)
+//# define TUX_BUG() BUG()
+# define TUX_BUG() do { } while (0)
+#endif
+
+#if 1
+# define INC_STAT(x) do { } while (0)
+# define DEC_STAT(x) do { } while (0)
+# define ADD_STAT(x,y) do { } while (0)
+# define SUB_STAT(x,y) do { } while (0)
+#else
+# define INC_STAT(x) atomic_inc((atomic_t *)&kstat.x)
+# define DEC_STAT(x) atomic_dec((atomic_t *)&kstat.x)
+# define ADD_STAT(y,x) atomic_add(y,(atomic_t *)&kstat.x)
+# define SUB_STAT(y,x) atomic_sub(y,(atomic_t *)&kstat.x)
+#endif
+
+// lru needs this:
+
+# define DEBUG_DEL_LIST(x...) do { INIT_LIST_HEAD((x)); } while (0)
+
+
+#define LOG_LEN (8*1024*1024UL)
+
+struct tux_req_struct;
+typedef struct tux_req_struct tux_req_t;
+typedef struct tux_threadinfo threadinfo_t;
+
+extern struct address_space_operations url_aops;
+
+typedef struct tcapi_template_s {
+       char *vfs_name;
+       struct list_head modules;
+       int (*query) (tux_req_t *req);
+       struct module *mod;
+       unsigned int userspace_id;
+} tcapi_template_t;
+
+typedef struct mimetype_s {
+       struct list_head list;
+
+       char *ext;
+       unsigned int ext_len;
+       char *type;
+       unsigned int type_len;
+       char *expire_str;
+       unsigned int expire_str_len;
+
+       unsigned int special;
+} mimetype_t;
+
+typedef struct tux_attribute_s {
+       mimetype_t *mime;
+       tcapi_template_t *tcapi;
+} tux_attribute_t;
+
+#define MAX_TUX_ATOMS 8
+
+typedef void (atom_func_t)(tux_req_t *req, int cachemiss);
+
+typedef struct tux_proto_s
+{
+       unsigned int defer_accept;
+       unsigned int can_redirect;
+       void (*got_request) (tux_req_t *req);
+       int (*parse_message) (tux_req_t *req, const int total_len);
+       atom_func_t *illegal_request;
+       atom_func_t *request_timeout;
+       void (*pre_log) (tux_req_t *req);
+       int (*check_req_err) (tux_req_t *req, int cachemiss);
+       char * (*print_dir_line) (tux_req_t *req, char *tmp, char *d_name, int d_len, int d_type, struct dentry *dentry, struct inode *inode);
+       const char *name;
+       struct nameidata main_docroot;
+} tux_proto_t;
+
+typedef struct tux_socket_s {
+       tux_proto_t *proto;
+       unsigned int ip;
+       unsigned short port;
+       struct proc_dir_entry *entry;
+} tux_socket_t;
+
+extern tux_socket_t tux_listen [CONFIG_TUX_NUMTHREADS][CONFIG_TUX_NUMSOCKETS];
+
+
+typedef struct abuf_s {
+       struct page *page;
+       char *buf;
+       unsigned int size;
+       unsigned int max_len;
+       unsigned int offset;
+       unsigned int left;
+       unsigned long flags;
+} abuf_t;
+
+struct linux_dirent64 {
+       u64             d_ino;
+       s64             d_off;
+       unsigned short  d_reclen;
+       unsigned char   d_type;
+       char            d_name[0];
+};
+
+struct getdents_callback64 {
+       struct linux_dirent64 * current_dir;
+       struct linux_dirent64 * previous;
+       int count;
+       int error;
+};
+
+#define TUX_MAGIC 0x12457801
+
+#define MAX_TUX_ATOMS 8
+
+struct tux_req_struct
+{
+       tux_proto_t *proto;
+
+       int atom_idx;
+       atom_func_t *atoms [MAX_TUX_ATOMS];
+       struct list_head work;
+
+       struct list_head all;
+       struct list_head free;
+       struct list_head lru;
+
+       unsigned long idle_input;
+       unsigned long wait_output_space;
+
+       struct socket *sock;
+       struct dentry *dentry;
+       struct vfsmount *mnt;
+       struct dentry *docroot_dentry;
+       struct vfsmount *docroot_mnt;
+       struct dentry *cwd_dentry;
+       struct vfsmount *cwd_mnt;
+
+       struct file in_file;
+       int fd;
+       read_descriptor_t desc;
+       u32 client_addr;
+       u32 client_port;
+       unsigned int virtual;
+
+       loff_t total_file_len;
+       unsigned int lendigits;
+       loff_t offset_start;
+       loff_t offset_end;
+       loff_t output_len;
+
+       loff_t ftp_offset_start;
+
+       time_t mtime;
+       unsigned int etaglen;
+       char etag [40];
+
+       char usermode;
+       unsigned int usermodule_idx;
+       struct dentry *module_dentry;
+       struct vfsmount *module_mnt;
+       char *userbuf;
+       unsigned int userlen;
+
+       tux_attribute_t *attr;
+
+       threadinfo_t *ti;
+       wait_queue_t sleep;
+       wait_queue_t ftp_sleep;
+
+       abuf_t abuf;
+       /*
+        * Parsed request fields. In-line strings are zero-delimited.
+        */
+       const char *headers;
+       unsigned int headers_len;
+
+       unsigned int parsed_len;
+
+       // FTP part
+       ftp_command_t ftp_command;
+       u32 ftp_user_addr;
+       u16 ftp_user_port;
+
+       struct socket *data_sock;
+       unsigned int prev_pos;
+
+       // ls handing:
+       struct linux_dirent64 *dirp0;
+       unsigned int curroff, total;
+
+#define MAX_USERNAME_LEN 16
+       char username[MAX_USERNAME_LEN];
+       unsigned int username_len;
+
+       // HTTP part
+       http_method_t method;
+       const char *method_str;
+       unsigned int method_len;
+
+       http_version_t version;
+       const char *version_str;
+       unsigned int version_len;
+
+       /* requested URI: */
+
+       const char *uri_str;
+       unsigned int uri_len;
+
+       /* Objectname (filename/scriptname) this URI refers to: */
+
+#define MAX_OBJECTNAME_LEN 256
+       char objectname[MAX_OBJECTNAME_LEN + 4]; // space for .gz as well
+       unsigned int objectname_len;
+
+       /* Query string within the URI: */
+
+       const char *query_str;
+       unsigned int query_len;
+
+       /* Cookies: */
+
+       const char *cookies_str;
+       unsigned int cookies_len;
+       unsigned int parse_cookies;
+
+       /* Content-TYpe */
+       const char *content_type_str;
+       unsigned int content_type_len;
+
+       /* Content-Length: */
+
+       const char *contentlen_str;
+       unsigned int contentlen_len;
+       unsigned int content_len;
+
+       /* User-Agent: */
+
+       const char *user_agent_str;
+       unsigned int user_agent_len;
+
+       /* Accept: */
+
+       const char *accept_str;
+       unsigned int accept_len;
+
+       /* Accept-Charset: */
+
+       const char *accept_charset_str;
+       unsigned int accept_charset_len;
+
+       /* Accept-Language: */
+
+       const char *accept_language_str;
+       unsigned int accept_language_len;
+
+       /* Cache-Control: */
+
+       const char *cache_control_str;
+       unsigned int cache_control_len;
+
+       /* If-Modified-Since: */
+
+       const char *if_modified_since_str;
+       unsigned int if_modified_since_len;
+
+       /* If-None-Match: */
+       const char *if_none_match_str;
+       unsigned int if_none_match_len;
+
+       /* If-Range: */
+
+       const char *if_range_str;
+       unsigned int if_range_len;
+
+       /* Negotiate: */
+
+       const char *negotiate_str;
+       unsigned int negotiate_len;
+
+       /* Pragma: */
+
+       const char *pragma_str;
+       unsigned int pragma_len;
+
+       /* Referer: */
+
+       const char *referer_str;
+       unsigned int referer_len;
+
+       /* Accept-Encoding: */
+
+       const char *accept_encoding_str;
+       unsigned int accept_encoding_len;
+       unsigned int may_send_gzip;
+       unsigned int content_gzipped;
+
+       /* Host */
+
+#define MAX_HOST_LEN 128
+       char host[MAX_HOST_LEN];
+       unsigned int host_len;
+
+       /* POSTed data: */
+
+       const char *post_data_str;
+       unsigned int post_data_len;
+
+       unsigned int status;
+
+       /* the file being sent */
+
+       unsigned int bytes_sent;
+#if CONFIG_TUX_DEBUG
+       unsigned int bytes_expected;
+#endif
+       unsigned long first_timestamp;
+       unsigned int body_len;
+
+       unsigned int user_error;
+
+       char error;
+       char postponed;
+
+       char had_cachemiss;
+       char lookup_dir;
+       char lookup_404;
+
+       char keep_alive;
+       struct timer_list keepalive_timer;
+       unsigned int total_bytes;
+       struct timer_list output_timer;
+
+       unsigned int nr_keepalives;
+
+       unsigned int event;
+       u64 private;
+
+       unsigned int magic;
+       void (*real_data_ready)(struct sock *sk, int space);
+       void (*real_state_change)(struct sock *sk);
+       void (*real_write_space)(struct sock *sk);
+       void (*real_error_report)(struct sock *sk);
+       void (*real_destruct)(struct sock *sk);
+
+       void (*ftp_real_data_ready)(struct sock *sk, int space);
+       void (*ftp_real_state_change)(struct sock *sk);
+       void (*ftp_real_write_space)(struct sock *sk);
+       void (*ftp_real_error_report)(struct sock *sk);
+       void (*ftp_real_create_child)(struct sock *sk, struct sock *newsk);
+       void (*ftp_real_destruct)(struct sock *sk);
+
+#if CONFIG_TUX_EXTENDED_LOG
+       unsigned long accept_timestamp;
+       unsigned long parse_timestamp;
+       unsigned long output_timestamp;
+       unsigned long flush_timestamp;
+# define SET_TIMESTAMP(x) do { (x) = jiffies; } while (0)
+#else
+# define SET_TIMESTAMP(x) do { } while (0)
+#endif
+
+};
+
+extern void add_tux_atom (tux_req_t *req, atom_func_t *event_done);
+extern void del_tux_atom (tux_req_t *req);
+extern void tux_schedule_atom (tux_req_t *req, int cachemiss);
+extern void add_req_to_workqueue (tux_req_t *req);
+
+
+typedef struct iothread_s
+{
+       spinlock_t async_lock;
+       threadinfo_t *ti;
+       struct list_head async_queue;
+       wait_queue_head_t async_sleep;
+       unsigned int nr_async_pending;
+       unsigned int threads;
+       unsigned int shutdown;
+       wait_queue_head_t wait_shutdown;
+} iothread_t;
+
+typedef struct tux_listen_s
+{
+       tux_proto_t *proto;
+       struct socket *sock;
+       unsigned int cloned;
+} tux_listen_t;
+
+struct tux_threadinfo
+{
+       tux_req_t *userspace_req;
+       unsigned int started;
+       struct task_struct *thread;
+       iothread_t *iot;
+       wait_queue_t wait_event [CONFIG_TUX_NUMSOCKETS];
+       wait_queue_t stop;
+       unsigned int pid;
+
+       struct page *header_cache;
+       unsigned int header_offset;
+
+       unsigned int nr_requests;
+       struct list_head all_requests;
+
+       unsigned int nr_free_requests;
+       spinlock_t free_requests_lock;
+       struct list_head free_requests;
+
+       spinlock_t work_lock;
+       struct list_head work_pending;
+       struct list_head lru;
+       unsigned int nr_lru;
+
+       unsigned int listen_error;
+       tux_listen_t listen[CONFIG_TUX_NUMSOCKETS];
+
+       struct semaphore gzip_sem;
+       z_stream gzip_state;
+
+       unsigned int cpu;
+       unsigned int __padding[16];
+};
+
+typedef enum special_mimetypes {
+       NORMAL_MIME_TYPE,
+       MIME_TYPE_REDIRECT,
+       MIME_TYPE_CGI,
+       MIME_TYPE_MODULE,
+} special_mimetypes_t;
+
+#if CONFIG_TUX_DEBUG
+#if 0
+extern inline void url_hist_hit (int size)
+{
+       unsigned int idx = size/1024;
+
+       if (idx >= URL_HIST_SIZE)
+               idx = URL_HIST_SIZE-1;
+       kstat.url_hist_hits[idx]++;
+}
+extern inline void url_hist_miss (int size)
+{
+       unsigned int idx = size/1024;
+       if (idx >= URL_HIST_SIZE)
+               idx = URL_HIST_SIZE-1;
+       kstat.url_hist_misses[idx]++;
+}
+#endif
+extern void __check_req_list (tux_req_t *req, struct list_head *list);
+# define check_req_list __check_req_list
+#else
+# define check_req_list(req, list) do { } while (0)
+#endif
+
+#define url_hist_hit(size) do { } while (0)
+#define url_hist_miss(size) do { } while (0)
+
+extern char tux_common_docroot[200];
+extern char tux_http_subdocroot[200];
+extern char tux_ftp_subdocroot[200];
+extern char tux_logfile[200];
+extern char tux_cgiroot[200];
+extern char tux_404_page[200];
+extern char tux_default_vhost[200];
+extern char tux_extra_html_header[600];
+extern unsigned int tux_extra_html_header_size;
+extern int tux_cgi_uid;
+extern int tux_cgi_gid;
+extern unsigned int tux_clientport;
+extern unsigned int tux_logging;
+extern unsigned int tux_threads;
+extern unsigned int tux_keepalive_timeout;
+extern unsigned int tux_max_output_bandwidth;
+extern unsigned int tux_max_backlog;
+extern unsigned int tux_max_connect;
+extern unsigned int tux_mode_forbidden;
+extern unsigned int tux_mode_allowed;
+extern unsigned int tux_logentry_align_order;
+extern unsigned int tux_nonagle;
+extern unsigned int tux_ack_pingpong;
+extern unsigned int tux_push_all;
+extern unsigned int tux_zerocopy_parse;
+extern unsigned int tux_generate_etags;
+extern unsigned int tux_generate_last_mod;
+extern unsigned int tux_generate_cache_control;
+extern unsigned int tux_ip_logging;
+extern unsigned int tux_ftp_wait_close;
+extern unsigned int tux_ftp_log_retr_only;
+extern unsigned int tux_hide_unreadable;
+
+typedef enum virtual_server {
+       TUX_VHOST_NONE,
+       TUX_VHOST_HOST,
+       TUX_VHOST_IP,
+       TUX_VHOST_IP_HOST,
+} virtual_server_t;
+
+extern unsigned int tux_virtual_server;
+extern unsigned int mass_hosting_hash;
+extern unsigned int strip_host_tail;
+extern unsigned int tux_ftp_virtual_server;
+
+extern unsigned int tux_max_object_size;
+extern unsigned int tux_max_free_requests;
+extern unsigned int tux_defer_accept;
+
+extern struct socket * start_listening(tux_socket_t *listen, int nr);
+extern void stop_listening(struct socket **sock);
+extern void start_sysctl(void);
+extern void end_sysctl(void);
+extern void flush_request (tux_req_t *req, int cachemiss);
+extern void unlink_tux_socket (tux_req_t *req);
+extern void unlink_tux_data_socket (tux_req_t *req);
+extern void unlink_tux_listen_socket (tux_req_t *req);
+extern void link_tux_ftp_accept_socket (tux_req_t *req, struct socket *sock);
+extern void link_tux_data_socket (tux_req_t *req, struct socket *sock);
+extern void tux_push_req (tux_req_t *req);
+extern int send_sync_buf (tux_req_t *req, struct socket *sock, const char *buf, const size_t length, unsigned long flags);
+extern void __send_async_message (tux_req_t *req, const char *message, int status, unsigned int size, int push);
+#define send_async_message(req,str,status,push) \
+               __send_async_message(req,str,status,strlen(str),push)
+
+extern void send_success (tux_req_t *req, struct socket *sock);
+extern void send_async_err_not_found (tux_req_t *req);
+extern void send_async_timed_out (tux_req_t *req);
+
+extern void kfree_req (tux_req_t *req);
+extern int accept_requests (threadinfo_t *ti);
+extern int process_requests (threadinfo_t *ti, tux_req_t **user_req);
+extern int flush_freequeue (threadinfo_t * ti);
+extern int tux_flush_workqueue (threadinfo_t *ti);
+extern tux_req_t * pick_userspace_req (threadinfo_t *ti);
+extern atom_func_t redirect_request;
+extern atom_func_t parse_request;
+extern void queue_cachemiss (tux_req_t *req);
+extern int start_cachemiss_threads (threadinfo_t *ti);
+extern void stop_cachemiss_threads (threadinfo_t *ti);
+struct file * tux_open_file(char *filename, int mode);
+extern void start_log_thread (void);
+extern void stop_log_thread (void);
+extern void add_mimetype (char *new_ext, char *new_type, char *new_expire);
+extern void free_mimetypes (void);
+extern int lookup_object (tux_req_t *req, const unsigned int flag);
+extern int handle_gzip_req (tux_req_t *req, unsigned int flags);
+extern struct dentry * tux_lookup (tux_req_t *req, const char *filename, const unsigned int flag, struct vfsmount **mnt);
+extern tcapi_template_t * lookup_tuxmodule (const char *filename);
+extern int register_tuxmodule (tcapi_template_t *tcapi);
+extern tcapi_template_t * unregister_tuxmodule (char *vfs_name);
+extern tcapi_template_t * get_first_usermodule (void);
+extern int user_register_module (user_req_t *u_info);
+extern int user_unregister_module (user_req_t *u_info);
+extern void unregister_all_tuxmodules (void);
+
+typedef struct exec_param_s {
+       char *command;
+       char **argv;
+       char **envp;
+       unsigned int pipe_fds;
+} exec_param_t;
+
+extern pid_t tux_exec_process (char *command, char **argv, char **envp, int pipe_fds, exec_param_t *param, int wait);
+
+extern void start_external_cgi (tux_req_t *req);
+extern tcapi_template_t extcgi_tcapi;
+
+extern void queue_output_req (tux_req_t *req, threadinfo_t *ti);
+extern void queue_userspace_req (tux_req_t *req, threadinfo_t *ti);
+
+
+extern void __log_request (tux_req_t *req);
+extern inline void log_request (tux_req_t *req)
+{
+       if (tux_logging)
+               __log_request(req);
+}
+
+extern int __connection_too_fast (tux_req_t *req);
+
+#define connection_too_fast(req)                               \
+       ({                                                      \
+               int __ret = 1;                                  \
+               if (unlikely(tux_max_output_bandwidth))         \
+                       __ret = __connection_too_fast(req);     \
+               __ret;                                          \
+       })
+
+extern void trunc_headers (tux_req_t *req);
+extern int generic_send_file (tux_req_t *req, struct socket *sock, int cachemiss);
+extern int tux_fetch_file (tux_req_t *req, int nonblock);
+
+extern void postpone_request (tux_req_t *req);
+extern int continue_request (int fd);
+extern void tux_push_pending (struct sock *sk);
+extern void zap_request (tux_req_t *req, int cachemiss);
+extern int add_output_space_event (tux_req_t *req, struct socket *sock);
+
+extern void reap_kids (void);
+extern void unuse_frag (struct sk_buff *skb, skb_frag_t *frag);
+extern skb_frag_t * build_dynbuf_frag (tux_req_t *req, unsigned int size);
+extern int tux_permission (struct inode *inode);
+extern void flush_all_signals (void);
+
+#define D() Dprintk("{%s:%d}\n", __FILE__, __LINE__)
+
+extern int nr_async_io_pending (void);
+
+extern void __add_keepalive_timer (tux_req_t *req);
+#define add_keepalive_timer(req)                                       \
+do {                                                                   \
+       if (tux_keepalive_timeout) {                                    \
+               Dprintk("add_keepalive_timer(%p).\n", (req));           \
+               __add_keepalive_timer(req);                             \
+       }                                                               \
+} while (0)
+extern void __del_keepalive_timer (tux_req_t *req);
+#define del_keepalive_timer(req)                                       \
+do {                                                                   \
+       if (tux_keepalive_timeout) {                                    \
+               Dprintk("del_keepalive_timer(%p).\n", (req));           \
+               __del_keepalive_timer(req);                             \
+       }                                                               \
+} while (0)
+
+extern void del_output_timer (tux_req_t *req);
+extern void output_timeout (tux_req_t *req);
+
+extern void print_req (tux_req_t *req);
+
+extern char tux_date [DATE_LEN];
+
+
+extern int nr_async_io_pending (void);
+extern void tux_exit (void);
+extern char * get_abuf (tux_req_t *req, unsigned int max_size);
+extern void send_abuf (tux_req_t *req, unsigned int size, unsigned long flags);
+
+
+extern int idle_event (tux_req_t *req);
+extern int output_space_event (tux_req_t *req);
+extern unsigned int log_cpu_mask;
+extern unsigned int tux_compression;
+extern unsigned int tux_noid;
+extern unsigned int tux_cgi_inherit_cpu;
+extern unsigned int tux_zerocopy_header;
+extern unsigned int tux_zerocopy_sendfile;
+extern unsigned int tux_cgi_cpu_mask;
+extern tux_proto_t tux_proto_http;
+extern tux_proto_t tux_proto_ftp;
+extern unsigned int tux_all_userspace;
+extern unsigned int tux_ignore_query;
+extern unsigned int tux_redirect_logging;
+extern unsigned int tux_referer_logging;
+extern unsigned int tux_log_incomplete;
+extern unsigned int tux_max_header_len;
+extern unsigned int tux_cpu_offset;
+extern unsigned int tux_ftp_login_message;
+
+extern void drop_permissions (void);
+extern int query_extcgi (tux_req_t *req);
+extern int tux_chroot (char *dir);
+
+extern void install_req_dentry (tux_req_t *req, struct dentry *dentry, struct vfsmount *mnt);
+extern void release_req_dentry (tux_req_t *req);
+extern void unidle_req (tux_req_t *req);
+extern int nr_requests_used (void);
+
+#define req_err(req) do { (req)->error = 1; Dprintk("request %p error at %s:%d.\n", req, __FILE__, __LINE__); } while (0)
+
+#define enough_wspace(sk) (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk))
+#define clear_keepalive(req) do { (req)->keep_alive = 0; Dprintk("keepalive cleared for req %p.\n", req); } while (0)
+
+extern int print_all_requests (threadinfo_t *ti);
+extern unsigned int tux_max_keepalives;
+extern int time_unix2ls (time_t zulu, char *buf);
+extern void last_mod_time(char * curr, const time_t t);
+extern int mdtm_time(char * curr, const time_t t);
+extern time_t parse_time(const char *str, const int str_len);
+
+extern unsigned int nr_tux_threads;
+extern threadinfo_t threadinfo[CONFIG_TUX_NUMTHREADS];
+
+#define switch_docroot(req) do { if (((req)->docroot_dentry != current->fs->root) || ((req)->docroot_mnt != current->fs->rootmnt)) __switch_docroot(req); } while (0)
+extern void __switch_docroot(tux_req_t *req);
+extern void list_directory (tux_req_t *req, int cachemiss);
+extern char * tux_print_path (tux_req_t *req, struct dentry *dentry, struct vfsmount *mnt, char *buf, unsigned int max_len);
+
+extern unsigned int tux_http_dir_indexing;
+
+int tux_gzip_compress (tux_req_t *req, unsigned char *data_in, unsigned char *data_out, __u32 *in_len, __u32 *out_len);
+
+struct dentry * __tux_lookup (tux_req_t *req, const char *filename,
+                         struct nameidata *base, struct vfsmount **mnt);
+
+/* error codes for req->error */
+#define TUX_ERROR_REDIRECT     1
+#define TUX_ERROR_UNUSED       2
+#define TUX_ERROR_CONN_CLOSE   3
+#define TUX_ERROR_CONN_TIMEOUT 4
+
+extern void __put_data_sock (tux_req_t *req);
+
+static inline void put_data_sock (tux_req_t *req)
+{
+       if (req->data_sock)
+               __put_data_sock(req);
+}
+
+#define socket_input(sock) \
+       (!skb_queue_empty(&(sock)->sk->sk_receive_queue) || \
+               !skb_queue_empty(&(sock)->sk->sk_error_queue))
+
+#define tux_kmalloc(size)                                              \
+({                                                                     \
+       void *__ptr;                                                    \
+                                                                       \
+       while (!(__ptr = kmalloc(size, GFP_KERNEL))) {                  \
+               if (net_ratelimit())                                    \
+                       printk(KERN_WARNING "tux: OOM at %s:%d (%d bytes).\n", \
+                               __FILE__, __LINE__, size);              \
+               current->state = TASK_UNINTERRUPTIBLE;                  \
+               schedule_timeout(1);                                    \
+       }                                                               \
+       __ptr;                                                          \
+})
+
+extern long tux_close(unsigned int fd);
+
+#endif
diff --git a/include/net/tux_u.h b/include/net/tux_u.h
new file mode 100644 (file)
index 0000000..24ba401
--- /dev/null
@@ -0,0 +1,163 @@
+#ifndef _NET_TUX_U_H
+#define _NET_TUX_U_H
+
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * tux_u.h: HTTP module API - HTTP interface to user-space
+ */
+
+/*
+ * Different major versions are not compatible.
+ * Different minor versions are only downward compatible.
+ * Different patchlevel versions are downward and upward compatible.
+ */
+#define TUX_MAJOR_VERSION              3
+#define TUX_MINOR_VERSION              0
+#define TUX_PATCHLEVEL_VERSION         0
+
+#define __KERNEL_SYSCALLS__
+
+typedef enum http_versions {
+        HTTP_1_0,
+        HTTP_1_1
+} http_version_t;
+
+/*
+ * Request methods known to HTTP:
+ */
+typedef enum http_methods {
+        METHOD_NONE,
+        METHOD_GET,
+        METHOD_HEAD,
+        METHOD_POST,
+        METHOD_PUT,
+       NR_METHODS
+} http_method_t;
+
+enum user_req {
+       TUX_ACTION_STARTUP = 1,
+       TUX_ACTION_SHUTDOWN = 2,
+       TUX_ACTION_STARTTHREAD = 3,
+       TUX_ACTION_STOPTHREAD = 4,
+       TUX_ACTION_EVENTLOOP = 5,
+       TUX_ACTION_GET_OBJECT = 6,
+       TUX_ACTION_SEND_OBJECT = 7,
+       TUX_ACTION_READ_OBJECT = 8,
+       TUX_ACTION_FINISH_REQ = 9,
+       TUX_ACTION_FINISH_CLOSE_REQ = 10,
+       TUX_ACTION_REGISTER_MODULE = 11,
+       TUX_ACTION_UNREGISTER_MODULE = 12,
+       TUX_ACTION_CURRENT_DATE = 13,
+       TUX_ACTION_REGISTER_MIMETYPE = 14,
+       TUX_ACTION_READ_HEADERS = 15,
+       TUX_ACTION_POSTPONE_REQ = 16,
+       TUX_ACTION_CONTINUE_REQ = 17,
+       TUX_ACTION_REDIRECT_REQ = 18,
+       TUX_ACTION_READ_POST_DATA = 19,
+       TUX_ACTION_SEND_BUFFER = 20,
+       TUX_ACTION_WATCH_PROXY_SOCKET = 21,
+       TUX_ACTION_WAIT_PROXY_SOCKET = 22,
+       TUX_ACTION_QUERY_VERSION = 23,
+       MAX_TUX_ACTION
+};
+
+enum tux_ret {
+       TUX_ERROR = -1,
+       TUX_RETURN_USERSPACE_REQUEST = 0,
+       TUX_RETURN_EXIT = 1,
+       TUX_RETURN_SIGNAL = 2,
+       TUX_CONTINUE_EVENTLOOP = 3,
+};
+
+#define MAX_URI_LEN 256
+#define MAX_COOKIE_LEN 128
+#define MAX_FIELD_LEN 64
+#define DATE_LEN 30
+
+typedef struct user_req_s {
+       u32 version_major;
+       u32 version_minor;
+       u32 version_patch;
+       u32 http_version;
+       u32 http_method;
+       u32 http_status;
+
+       u32 sock;
+       u32 event;
+       u32 error;
+       u32 thread_nr;
+       u32 bytes_sent;
+       u32 client_host;
+       u32 objectlen;
+       u32 module_index;
+       u32 keep_alive;
+       u32 cookies_len;
+
+       u64 id;
+       u64 priv;
+       u64 object_addr;
+
+       u8 query[MAX_URI_LEN];
+       u8 objectname[MAX_URI_LEN];
+       u8 cookies[MAX_COOKIE_LEN];
+       u8 content_type[MAX_FIELD_LEN];
+       u8 user_agent[MAX_FIELD_LEN];
+       u8 accept[MAX_FIELD_LEN];
+       u8 accept_charset[MAX_FIELD_LEN];
+       u8 accept_encoding[MAX_FIELD_LEN];
+       u8 accept_language[MAX_FIELD_LEN];
+       u8 cache_control[MAX_FIELD_LEN];
+       u8 if_modified_since[MAX_FIELD_LEN];
+       u8 negotiate[MAX_FIELD_LEN];
+       u8 pragma[MAX_FIELD_LEN];
+       u8 referer[MAX_FIELD_LEN];
+       u8 new_date[DATE_LEN];
+       u8 pad[2];
+
+} user_req_t;
+
+typedef enum ftp_commands {
+        FTP_COMM_NONE,
+        FTP_COMM_USER,
+        FTP_COMM_PASS,
+        FTP_COMM_ACCT,
+        FTP_COMM_CWD,
+        FTP_COMM_CDUP,
+        FTP_COMM_SMNT,
+        FTP_COMM_QUIT,
+        FTP_COMM_REIN,
+        FTP_COMM_PORT,
+        FTP_COMM_PASV,
+        FTP_COMM_TYPE,
+        FTP_COMM_STRU,
+        FTP_COMM_MODE,
+        FTP_COMM_RETR,
+        FTP_COMM_SIZE,
+        FTP_COMM_MDTM,
+        FTP_COMM_STOR,
+        FTP_COMM_STOU,
+        FTP_COMM_APPE,
+        FTP_COMM_ALLO,
+        FTP_COMM_REST,
+        FTP_COMM_RNFR,
+        FTP_COMM_RNTO,
+        FTP_COMM_ABOR,
+        FTP_COMM_DELE,
+        FTP_COMM_RMD,
+        FTP_COMM_MKD,
+        FTP_COMM_PWD,
+        FTP_COMM_LIST,
+        FTP_COMM_NLST,
+        FTP_COMM_SITE,
+        FTP_COMM_SYST,
+        FTP_COMM_STAT,
+        FTP_COMM_HELP,
+        FTP_COMM_NOOP,
+        FTP_COMM_FEAT,
+        FTP_COMM_CLNT,
+} ftp_command_t;
+
+#endif
index 6bb10bd..aaf7499 100644 (file)
@@ -821,14 +821,13 @@ extern int xfrm4_rcv(struct sk_buff *skb);
 extern int xfrm4_output(struct sk_buff **pskb);
 extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
 extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
-extern int xfrm4_tunnel_check_size(struct sk_buff *skb);
 extern int xfrm6_rcv(struct sk_buff **pskb, unsigned int *nhoffp);
 extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler);
 extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler);
-extern int xfrm6_tunnel_check_size(struct sk_buff *skb);
 extern u32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr);
 extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr);
 extern u32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr);
+extern int xfrm6_output(struct sk_buff **pskb);
 
 #ifdef CONFIG_XFRM
 extern int xfrm4_rcv_encap(struct sk_buff *skb, __u16 encap_type);
index ef5ef24..1c6d293 100644 (file)
@@ -214,25 +214,25 @@ static inline int scsi_status_is_good(int status)
  */
 
 struct ccs_modesel_head {
-       u8 _r1;                 /* reserved */
-       u8 medium;              /* device-specific medium type */
-       u8 _r2;                 /* reserved */
-       u8 block_desc_length;   /* block descriptor length */
-       u8 density;             /* device-specific density code */
-       u8 number_blocks_hi;    /* number of blocks in this block desc */
-       u8 number_blocks_med;
-       u8 number_blocks_lo;
-       u8 _r3;
-       u8 block_length_hi;     /* block length for blocks in this desc */
-       u8 block_length_med;
-       u8 block_length_lo;
+       __u8 _r1;                       /* reserved */
+       __u8 medium;            /* device-specific medium type */
+       __u8 _r2;                       /* reserved */
+       __u8 block_desc_length; /* block descriptor length */
+       __u8 density;           /* device-specific density code */
+       __u8 number_blocks_hi;  /* number of blocks in this block desc */
+       __u8 number_blocks_med;
+       __u8 number_blocks_lo;
+       __u8 _r3;
+       __u8 block_length_hi;   /* block length for blocks in this desc */
+       __u8 block_length_med;
+       __u8 block_length_lo;
 };
 
 /*
  * ScsiLun: 8 byte LUN.
  */
 struct scsi_lun {
-       u8 scsi_lun[8];
+       __u8 scsi_lun[8];
 };
 
 /*
index 2d3265c..bb1e2e5 100644 (file)
@@ -524,7 +524,7 @@ struct Scsi_Host {
        container_of(d, struct Scsi_Host, shost_classdev)
 
 extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
-extern int scsi_add_host(struct Scsi_Host *, struct device *);
+extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
 extern void scsi_scan_host(struct Scsi_Host *);
 extern void scsi_remove_host(struct Scsi_Host *);
 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
index 01bf5b5..0a487fe 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _SCSI_GENERIC_H
 #define _SCSI_GENERIC_H
 
+#include <linux/compiler.h>
+
 /*
    History:
     Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user
@@ -76,7 +78,7 @@ Major new features in SG 3.x driver (cf SG 2.x drivers)
        http://www.torque.net/sg/p/scsi-generic_long.txt
  A version of this document (potentially out of date) may also be found in
  the kernel source tree, probably at:
-        /usr/src/linux/Documentation/scsi/scsi-generic.txt .
+        Documentation/scsi/scsi-generic.txt .
 
  Utility and test programs are available at the sg web site. They are 
  bundled as sg_utils (for the lk 2.2 series) and sg3_utils (for the
index 69dc182..23b27b7 100644 (file)
 #include <linux/time.h>
 #include <asm/byteorder.h>
 
-#if  __LITTLE_ENDIAN == 1234
+#ifdef  __LITTLE_ENDIAN
 #define SNDRV_LITTLE_ENDIAN
-#elif __BIG_ENDIAN == 4321
+#else
+#ifdef __BIG_ENDIAN
 #define SNDRV_BIG_ENDIAN
 #else
 #error "Unsupported endian..."
 #endif
+#endif
 
 #else /* !__KERNEL__ */
 
index 7738741..89ec58c 100644 (file)
@@ -41,15 +41,6 @@ config CLEAN_COMPILE
 
          If unsure, say Y
 
-config STANDALONE
-       bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL
-       default y
-       help
-         Select this option if you don't have magic firmware for drivers that
-         need it.
-
-         If unsure, say Y.
-
 config BROKEN
        bool
        depends on !CLEAN_COMPILE
index 598f1c8..f763a02 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -117,6 +117,9 @@ static void shm_destroy (struct shmid_kernel *shp)
        shm_unlock(shp);
        if (!is_file_hugepages(shp->shm_file))
                shmem_lock(shp->shm_file, 0, shp->mlock_user);
+       else
+               user_shm_unlock(shp->shm_file->f_dentry->d_inode->i_size,
+                                               shp->mlock_user);
        fput (shp->shm_file);
        security_shm_free(shp);
        ipc_rcu_free(shp, sizeof(struct shmid_kernel));
@@ -193,6 +196,7 @@ static int newseg (key_t key, int shmflg, size_t size)
        shp->shm_perm.key = key;
        shp->shm_perm.xid = current->xid;
        shp->shm_flags = (shmflg & S_IRWXUGO);
+       shp->mlock_user = NULL;
 
        shp->shm_perm.security = NULL;
        error = security_shm_alloc(shp);
@@ -201,9 +205,11 @@ static int newseg (key_t key, int shmflg, size_t size)
                return error;
        }
 
-       if (shmflg & SHM_HUGETLB)
+       if (shmflg & SHM_HUGETLB) {
+               /* hugetlb_zero_setup takes care of mlock user accounting */
                file = hugetlb_zero_setup(size);
-       else {
+               shp->mlock_user = current->user;
+       } else {
                sprintf (name, "SYSV%08x", key);
                file = shmem_file_setup(name, size, VM_ACCOUNT);
        }
@@ -224,7 +230,6 @@ static int newseg (key_t key, int shmflg, size_t size)
        shp->shm_nattch = 0;
        shp->id = shm_buildid(id,shp->shm_perm.seq);
        shp->shm_file = file;
-       shp->mlock_user = NULL;
        file->f_dentry->d_inode->i_ino = shp->id;
        if (shmflg & SHM_HUGETLB)
                set_file_hugepages(file);
@@ -509,7 +514,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
        case SHM_UNLOCK:
        {
                /* Allow superuser to lock segment in memory */
-               if (!can_do_mlock()) {
+               if (!can_do_mlock() && cmd == SHM_LOCK) {
                        err = -EPERM;
                        goto out;
                }
@@ -527,15 +532,18 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
                        goto out_unlock;
                
                if(cmd==SHM_LOCK) {
+                       struct user_struct * user = current->user;
                        if (!is_file_hugepages(shp->shm_file)) {
-                               err = shmem_lock(shp->shm_file, 1, current->user);
-                               if (!err)
+                               err = shmem_lock(shp->shm_file, 1, user);
+                               if (!err) {
                                        shp->shm_flags |= SHM_LOCKED;
+                                       shp->mlock_user = user;
+                               }
                        }
-               } else {
-                       if (!is_file_hugepages(shp->shm_file))
-                               shmem_lock(shp->shm_file, 0, shp->mlock_user);
+               } else if (!is_file_hugepages(shp->shm_file)) {
+                       shmem_lock(shp->shm_file, 0, shp->mlock_user);
                        shp->shm_flags &= ~SHM_LOCKED;
+                       shp->mlock_user = NULL;
                }
                shm_unlock(shp);
                goto out;
index 964520e..dbaf6d5 100644 (file)
@@ -399,11 +399,8 @@ int ipcperms (struct kern_ipc_perm *ipcp, short flag)
                granted_mode >>= 3;
        /* is there some bit set in requested_mode but not in granted_mode? */
        if ((requested_mode & ~granted_mode & 0007) && 
-           !capable(CAP_IPC_OWNER)) {
-               if (!can_do_mlock())  {
-                       return -1;
-               }
-       }       
+           !capable(CAP_IPC_OWNER))
+               return -1;
 
        return security_ipc_permission(ipcp, flag);
 }
index e55e7bb..daf23c4 100644 (file)
@@ -398,7 +398,7 @@ static void do_acct_process(long exitcode, struct file *file)
         */
        memset((caddr_t)&ac, 0, sizeof(acct_t));
 
-       ac.ac_version = ACCT_VERSION;
+       ac.ac_version = ACCT_VERSION | ACCT_BYTEORDER;
        strlcpy(ac.ac_comm, current->comm, sizeof(ac.ac_comm));
 
        elapsed = jiffies_64_to_AHZ(get_jiffies_64() - current->start_time);
@@ -441,8 +441,7 @@ static void do_acct_process(long exitcode, struct file *file)
                old_encode_dev(tty_devnum(current->signal->tty)) : 0;
        read_unlock(&tasklist_lock);
 
-       /* ABYTESEX is always set to allow byte order detection */
-       ac.ac_flag = ABYTESEX;
+       ac.ac_flag = 0;
        if (current->flags & PF_FORKNOEXEC)
                ac.ac_flag |= AFORK;
        if (current->flags & PF_SUPERPRIV)
index 57cc48e..481ac0d 100644 (file)
@@ -531,7 +531,7 @@ long compat_clock_getres(clockid_t which_clock,
        err = sys_clock_getres(which_clock,
                               (struct timespec __user *) &ts);
        set_fs(oldfs);
-       if (!err && put_compat_timespec(&ts, tp))
+       if (!err && tp && put_compat_timespec(&ts, tp))
                return -EFAULT; 
        return err;
 } 
index 2b64888..ddc4154 100644 (file)
@@ -837,6 +837,13 @@ asmlinkage NORET_TYPE void do_exit(long code)
        }
 
        acct_process(code);
+       if (current->tux_info) {
+#ifdef CONFIG_TUX_DEBUG
+               printk("Possibly unexpected TUX-thread exit(%ld) at %p?\n",
+                       code, __builtin_return_address(0));
+#endif
+               current->tux_exit();
+       }
        __exit_mm(tsk);
 
        exit_sem(tsk);
@@ -1037,20 +1044,17 @@ static int wait_task_zombie(task_t *p, unsigned int __user *stat_addr, struct ru
                if (p->real_parent != p->parent) {
                        __ptrace_unlink(p);
                        p->state = TASK_ZOMBIE;
-                       /* If this is a detached thread, this is where it goes away.  */
-                       if (p->exit_signal == -1) {
-                               /* release_task takes the lock itself.  */
-                               write_unlock_irq(&tasklist_lock);
-                               release_task (p);
-                       }
-                       else {
+                       /*
+                        * If this is not a detached task, notify the parent.  If it's
+                        * still not detached after that, don't release it now.
+                        */
+                       if (p->exit_signal != -1) {
                                do_notify_parent(p, p->exit_signal);
-                               write_unlock_irq(&tasklist_lock);
+                               if (p->exit_signal != -1)
+                                       p = NULL;
                        }
-                       p = NULL;
                }
-               else
-                       write_unlock_irq(&tasklist_lock);
+               write_unlock_irq(&tasklist_lock);
        }
        if (p != NULL)
                release_task(p);
index 76b2c11..8e335d1 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/fs.h>
 #include <linux/cpu.h>
 #include <linux/security.h>
+#include <linux/swap.h>
 #include <linux/syscalls.h>
 #include <linux/jiffies.h>
 #include <linux/futex.h>
@@ -287,7 +288,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
        mm->locked_vm = 0;
        mm->mmap = NULL;
        mm->mmap_cache = NULL;
-       mm->free_area_cache = TASK_UNMAPPED_BASE;
+       mm->free_area_cache = oldmm->mmap_base;
        mm->map_count = 0;
        mm->rss = 0;
        cpus_clear(mm->cpu_vm_mask);
@@ -425,9 +426,6 @@ static struct mm_struct * mm_init(struct mm_struct * mm)
 
        if (likely(!mm_alloc_pgd(mm))) {
                mm->def_flags = 0;
-#ifdef __HAVE_ARCH_MMAP_TOP
-               mm->mmap_top = mmap_top();
-#endif
                set_vx_info(&mm->mm_vx_info, current->vx_info);
                return mm;
        }
@@ -475,6 +473,7 @@ void mmput(struct mm_struct *mm)
                spin_unlock(&mmlist_lock);
                exit_aio(mm);
                exit_mmap(mm);
+               put_swap_token(mm);
                mmdrop(mm);
        }
 }
@@ -916,6 +915,7 @@ struct task_struct *copy_process(unsigned long clone_flags,
        p = dup_task_struct(current);
        if (!p)
                goto fork_out;
+       p->tux_info = NULL;
 
        p->vx_info = NULL;
        set_vx_info(&p->vx_info, current->vx_info);
@@ -1011,7 +1011,6 @@ struct task_struct *copy_process(unsigned long clone_flags,
        }
 #endif
 
-       retval = -ENOMEM;
        if ((retval = security_task_alloc(p)))
                goto bad_fork_cleanup_policy;
        if ((retval = audit_alloc(p)))
index 300269d..1f94d35 100644 (file)
@@ -52,9 +52,6 @@
 /* If this is set, the section belongs in the init part of the module */
 #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
 
-#define symbol_is(literal, string)                             \
-       (strcmp(MODULE_SYMBOL_PREFIX literal, (string)) == 0)
-
 /* Protects module list */
 static spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED;
 
index d4c20e0..318bfb9 100644 (file)
@@ -953,7 +953,7 @@ static const char * __init sanity_check(void)
                return "machine";
        if(pmdisk_info.cpus != num_online_cpus())
                return "number of cpus";
-       return 0;
+       return NULL;
 }
 
 
index f35f944..b331fe3 100644 (file)
@@ -210,16 +210,18 @@ static void rcu_check_quiescent_state(void)
  * locking requirements, the list it's pulling from has to belong to a cpu
  * which is dead and hence not processing interrupts.
  */
-static void rcu_move_batch(struct list_head *list)
+static void rcu_move_batch(struct rcu_head *list)
 {
-       struct list_head *entry;
-       int cpu = smp_processor_id();
+       int cpu;
 
        local_irq_disable();
-       while (!list_empty(list)) {
-               entry = list->next;
-               list_del(entry);
-               list_add_tail(entry, &RCU_nxtlist(cpu));
+
+       cpu = smp_processor_id();
+
+       while (list != NULL) {
+               *RCU_nxttail(cpu) = list;
+               RCU_nxttail(cpu) = &list->next;
+               list = list->next;
        }
        local_irq_enable();
 }
@@ -233,11 +235,10 @@ static void rcu_offline_cpu(int cpu)
        spin_lock_bh(&rcu_state.mutex);
        if (rcu_ctrlblk.cur != rcu_ctrlblk.completed)
                cpu_quiet(cpu);
-unlock:
        spin_unlock_bh(&rcu_state.mutex);
 
-       rcu_move_batch(&RCU_curlist(cpu));
-       rcu_move_batch(&RCU_nxtlist(cpu));
+       rcu_move_batch(RCU_curlist(cpu));
+       rcu_move_batch(RCU_nxtlist(cpu));
 
        tasklet_kill_immediate(&RCU_tasklet(cpu), cpu);
 }
index 5771500..b4512b7 100644 (file)
@@ -1202,7 +1202,7 @@ unsigned long nr_uninterruptible(void)
 {
        unsigned long i, sum = 0;
 
-       for_each_online_cpu(i)
+       for_each_cpu(i)
                sum += cpu_rq(i)->nr_uninterruptible;
 
        return sum;
@@ -1212,7 +1212,7 @@ unsigned long long nr_context_switches(void)
 {
        unsigned long long i, sum = 0;
 
-       for_each_online_cpu(i)
+       for_each_cpu(i)
                sum += cpu_rq(i)->nr_switches;
 
        return sum;
@@ -1222,7 +1222,7 @@ unsigned long nr_iowait(void)
 {
        unsigned long i, sum = 0;
 
-       for_each_online_cpu(i)
+       for_each_cpu(i)
                sum += atomic_read(&cpu_rq(i)->nr_iowait);
 
        return sum;
@@ -4361,6 +4361,7 @@ void __init sched_init(void)
        sched_domain_init.groups = &sched_group_init;
        sched_domain_init.last_balance = jiffies;
        sched_domain_init.balance_interval = INT_MAX; /* Don't balance */
+       sched_domain_init.busy_factor = 1;
 
        memset(&sched_group_init, 0, sizeof(struct sched_group));
        sched_group_init.cpumask = CPU_MASK_ALL;
index e3c7eb4..5c6b9b0 100644 (file)
@@ -418,6 +418,7 @@ flush_signal_handlers(struct task_struct *t, int force_default)
        }
 }
 
+EXPORT_SYMBOL_GPL(flush_signal_handlers);
 
 /* Notify the system that a driver wants to block all signals for this
  * process, and wants to be notified if any signals at all were to be
index b77eb0a..d5c21ca 100644 (file)
@@ -137,7 +137,7 @@ extern int sysctl_hz_timer;
 #if defined(CONFIG_PPC32) && defined(CONFIG_6xx)
 extern unsigned long powersave_nap;
 int proc_dol2crvec(ctl_table *table, int write, struct file *filp,
-                 void *buffer, size_t *lenp);
+                 void __user *buffer, size_t *lenp, loff_t *ppos);
 #endif
 
 #ifdef CONFIG_BSD_PROCESS_ACCT
@@ -147,7 +147,7 @@ extern int acct_parm[];
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,
                       ctl_table *, void **);
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp);
+                 void __user *buffer, size_t *lenp, loff_t *ppos);
 
 static ctl_table root_table[];
 static struct ctl_table_header root_table_header =
@@ -167,6 +167,8 @@ extern ctl_table random_table[];
 extern ctl_table pty_table[];
 #endif
 
+int sysctl_legacy_va_layout;
+
 /* /proc declarations: */
 
 #ifdef CONFIG_PROC_FS
@@ -347,7 +349,7 @@ static ctl_table kern_table[] = {
                .procname       = "tainted",
                .data           = &tainted,
                .maxlen         = sizeof(int),
-               .mode           = 0644,
+               .mode           = 0444,
                .proc_handler   = &proc_dointvec,
        },
        {
@@ -848,6 +850,16 @@ static ctl_table vm_table[] = {
                .strategy       = &sysctl_intvec,
                .extra1         = &zero,
        },
+       {
+               .ctl_name       = VM_LEGACY_VA_LAYOUT,
+               .procname       = "legacy_va_layout",
+               .data           = &sysctl_legacy_va_layout,
+               .maxlen         = sizeof(sysctl_legacy_va_layout),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec,
+               .strategy       = &sysctl_intvec,
+               .extra1         = &zero,
+       },
        { .ctl_name = 0 }
 };
 
@@ -1346,11 +1358,7 @@ static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
        
        res = count;
 
-       /*
-        * FIXME: we need to pass on ppos to the handler.
-        */
-
-       error = (*table->proc_handler) (table, write, file, buf, &res);
+       error = (*table->proc_handler) (table, write, file, buf, &res, ppos);
        if (error)
                return error;
        return res;
@@ -1400,14 +1408,14 @@ static ssize_t proc_writesys(struct file * file, const char __user * buf,
  * Returns 0 on success.
  */
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        size_t len;
        char __user *p;
        char c;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (filp->f_pos && !write)) {
+           (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1427,7 +1435,7 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
                if(copy_from_user(table->data, buffer, len))
                        return -EFAULT;
                ((char *) table->data)[len] = 0;
-               filp->f_pos += *lenp;
+               *ppos += *lenp;
        } else {
                len = strlen(table->data);
                if (len > table->maxlen)
@@ -1443,7 +1451,7 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
                        len++;
                }
                *lenp = len;
-               filp->f_pos += len;
+               *ppos += len;
        }
        return 0;
 }
@@ -1454,17 +1462,17 @@ int proc_dostring(ctl_table *table, int write, struct file *filp,
  */
  
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int r;
 
        if (!write) {
                down_read(&uts_sem);
-               r=proc_dostring(table,0,filp,buffer,lenp);
+               r=proc_dostring(table,0,filp,buffer,lenp, ppos);
                up_read(&uts_sem);
        } else {
                down_write(&uts_sem);
-               r=proc_dostring(table,1,filp,buffer,lenp);
+               r=proc_dostring(table,1,filp,buffer,lenp, ppos);
                up_write(&uts_sem);
        }
        return r;
@@ -1490,12 +1498,12 @@ static int do_proc_dointvec_conv(int *negp, unsigned long *lvalp,
 }
 
 static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp, 
+                 void __user *buffer, size_t *lenp, loff_t *ppos,
                  int (*conv)(int *negp, unsigned long *lvalp, int *valp,
                              int write, void *data),
                  void *data)
 {
-#define TMPBUFLEN 20
+#define TMPBUFLEN 21
        int *i, vleft, first=1, neg, val;
        unsigned long lval;
        size_t left, len;
@@ -1504,7 +1512,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
        char __user *s = buffer;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (filp->f_pos && !write)) {
+           (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1593,7 +1601,7 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
        if (write && first)
                return -EINVAL;
        *lenp -= left;
-       filp->f_pos += *lenp;
+       *ppos += *lenp;
        return 0;
 #undef TMPBUFLEN
 }
@@ -1612,9 +1620,9 @@ static int do_proc_dointvec(ctl_table *table, int write, struct file *filp,
  * Returns 0 on success.
  */
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                    void __user *buffer, size_t *lenp)
+                    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
                            NULL,NULL);
 }
 
@@ -1660,7 +1668,7 @@ static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
  */
  
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp)
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int op;
 
@@ -1669,7 +1677,7 @@ int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
        }
 
        op = (current->pid == 1) ? OP_SET : OP_AND;
-       return do_proc_dointvec(table,write,filp,buffer,lenp,
+       return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
                                do_proc_dointvec_bset_conv,&op);
 }
 
@@ -1719,23 +1727,24 @@ static int do_proc_dointvec_minmax_conv(int *negp, unsigned long *lvalp,
  * Returns 0 on success.
  */
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        struct do_proc_dointvec_minmax_conv_param param = {
                .min = (int *) table->extra1,
                .max = (int *) table->extra2,
        };
-       return do_proc_dointvec(table, write, filp, buffer, lenp,
+       return do_proc_dointvec(table, write, filp, buffer, lenp, ppos,
                                do_proc_dointvec_minmax_conv, &param);
 }
 
 static int do_proc_doulongvec_minmax(ctl_table *table, int write,
                                     struct file *filp,
-                                    void __user *buffer, size_t *lenp,
+                                    void __user *buffer,
+                                    size_t *lenp, loff_t *ppos,
                                     unsigned long convmul,
                                     unsigned long convdiv)
 {
-#define TMPBUFLEN 20
+#define TMPBUFLEN 21
        unsigned long *i, *min, *max, val;
        int vleft, first=1, neg;
        size_t len, left;
@@ -1743,7 +1752,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
        char __user *s = buffer;
        
        if (!table->data || !table->maxlen || !*lenp ||
-           (filp->f_pos && !write)) {
+           (*ppos && !write)) {
                *lenp = 0;
                return 0;
        }
@@ -1828,7 +1837,7 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
        if (write && first)
                return -EINVAL;
        *lenp -= left;
-       filp->f_pos += *lenp;
+       *ppos += *lenp;
        return 0;
 #undef TMPBUFLEN
 }
@@ -1850,9 +1859,9 @@ static int do_proc_doulongvec_minmax(ctl_table *table, int write,
  * Returns 0 on success.
  */
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                          void __user *buffer, size_t *lenp)
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, 1l, 1l);
+    return do_proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos, 1l, 1l);
 }
 
 /**
@@ -1874,10 +1883,11 @@ int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
  */
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer, size_t *lenp)
+                                     void __user *buffer,
+                                     size_t *lenp, loff_t *ppos)
 {
     return do_proc_doulongvec_minmax(table, write, filp, buffer,
-                                    lenp, HZ, 1000l);
+                                    lenp, ppos, HZ, 1000l);
 }
 
 
@@ -1939,9 +1949,9 @@ static int do_proc_dointvec_userhz_jiffies_conv(int *negp, unsigned long *lvalp,
  * Returns 0 on success.
  */
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp)
+                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
                            do_proc_dointvec_jiffies_conv,NULL);
 }
 
@@ -1961,65 +1971,66 @@ int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
  * Returns 0 on success.
  */
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                                void __user *buffer, size_t *lenp)
+                                void __user *buffer, size_t *lenp, loff_t *ppos)
 {
-    return do_proc_dointvec(table,write,filp,buffer,lenp,
+    return do_proc_dointvec(table,write,filp,buffer,lenp,ppos,
                            do_proc_dointvec_userhz_jiffies_conv,NULL);
 }
 
 #else /* CONFIG_PROC_FS */
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
-                           void __user *buffer, size_t *lenp)
+                           void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp)
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer, size_t *lenp)
+                                     void __user *buffer,
+                                     size_t *lenp, loff_t *ppos)
 {
     return -ENOSYS;
 }
@@ -2170,50 +2181,51 @@ int sysctl_jiffies(ctl_table *table, int __user *name, int nlen,
 }
 
 int proc_dostring(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec(ctl_table *table, int write, struct file *filp,
-                 void __user *buffer, size_t *lenp)
+                 void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_bset(ctl_table *table, int write, struct file *filp,
-                       void __user *buffer, size_t *lenp)
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp)
+                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_dointvec_userhz_jiffies(ctl_table *table, int write, struct file *filp,
-                         void __user *buffer, size_t *lenp)
+                         void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_minmax(ctl_table *table, int write, struct file *filp,
-                   void __user *buffer, size_t *lenp)
+                   void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        return -ENOSYS;
 }
 
 int proc_doulongvec_ms_jiffies_minmax(ctl_table *table, int write,
                                      struct file *filp,
-                                     void __user *buffer, size_t *lenp)
+                                     void __user *buffer,
+                                     size_t *lenp, loff_t *ppos)
 {
     return -ENOSYS;
 }
index 40a9680..f7d42e8 100644 (file)
@@ -795,12 +795,12 @@ static inline void do_process_times(struct task_struct *p,
 
        psecs = (p->utime += user);
        psecs += (p->stime += system);
-       if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_cur) {
+       if (psecs / HZ >= p->rlim[RLIMIT_CPU].rlim_cur) {
                /* Send SIGXCPU every second.. */
                if (!(psecs % HZ))
                        send_sig(SIGXCPU, p, 1);
                /* and SIGKILL when we go over max.. */
-               if (psecs / HZ > p->rlim[RLIMIT_CPU].rlim_max)
+               if (psecs / HZ >= p->rlim[RLIMIT_CPU].rlim_max)
                        send_sig(SIGKILL, p, 1);
        }
 }
index d4dbd2c..c1b1b58 100644 (file)
@@ -75,6 +75,7 @@ char * strcpy(char * dest,const char *src)
                /* nothing */;
        return tmp;
 }
+EXPORT_SYMBOL(strcpy);
 #endif
 
 #ifndef __HAVE_ARCH_STRNCPY
@@ -98,6 +99,7 @@ char * strncpy(char * dest,const char *src,size_t count)
        }
        return dest;
 }
+EXPORT_SYMBOL(strncpy);
 #endif
 
 #ifndef __HAVE_ARCH_STRLCPY
@@ -143,6 +145,7 @@ char * strcat(char * dest, const char * src)
 
        return tmp;
 }
+EXPORT_SYMBOL(strcat);
 #endif
 
 #ifndef __HAVE_ARCH_STRNCAT
@@ -172,6 +175,7 @@ char * strncat(char *dest, const char *src, size_t count)
 
        return tmp;
 }
+EXPORT_SYMBOL(strncat);
 #endif
 
 #ifndef __HAVE_ARCH_STRLCAT
@@ -218,6 +222,7 @@ int strcmp(const char * cs,const char * ct)
 
        return __res;
 }
+EXPORT_SYMBOL(strcmp);
 #endif
 
 #ifndef __HAVE_ARCH_STRNCMP
@@ -239,6 +244,7 @@ int strncmp(const char * cs,const char * ct,size_t count)
 
        return __res;
 }
+EXPORT_SYMBOL(strncmp);
 #endif
 
 #ifndef __HAVE_ARCH_STRCHR
@@ -254,6 +260,7 @@ char * strchr(const char * s, int c)
                        return NULL;
        return (char *) s;
 }
+EXPORT_SYMBOL(strchr);
 #endif
 
 #ifndef __HAVE_ARCH_STRRCHR
@@ -271,6 +278,7 @@ char * strrchr(const char * s, int c)
        } while (--p >= s);
        return NULL;
 }
+EXPORT_SYMBOL(strrchr);
 #endif
 
 #ifndef __HAVE_ARCH_STRNCHR
@@ -287,6 +295,7 @@ char *strnchr(const char *s, size_t count, int c)
                        return (char *) s;
        return NULL;
 }
+EXPORT_SYMBOL(strnchr);
 #endif
 
 #ifndef __HAVE_ARCH_STRLEN
@@ -302,6 +311,7 @@ size_t strlen(const char * s)
                /* nothing */;
        return sc - s;
 }
+EXPORT_SYMBOL(strlen);
 #endif
 
 #ifndef __HAVE_ARCH_STRNLEN
@@ -318,6 +328,7 @@ size_t strnlen(const char * s, size_t count)
                /* nothing */;
        return sc - s;
 }
+EXPORT_SYMBOL(strnlen);
 #endif
 
 #ifndef __HAVE_ARCH_STRSPN
@@ -371,6 +382,7 @@ size_t strcspn(const char *s, const char *reject)
 
        return count;
 }      
+EXPORT_SYMBOL(strcspn);
 
 #ifndef __HAVE_ARCH_STRPBRK
 /**
@@ -390,6 +402,7 @@ char * strpbrk(const char * cs,const char * ct)
        }
        return NULL;
 }
+EXPORT_SYMBOL(strpbrk);
 #endif
 
 #ifndef __HAVE_ARCH_STRSEP
@@ -440,6 +453,7 @@ void * memset(void * s,int c,size_t count)
 
        return s;
 }
+EXPORT_SYMBOL(memset);
 #endif
 
 #ifndef __HAVE_ARCH_BCOPY
@@ -463,6 +477,7 @@ void bcopy(const void * srcp, void * destp, size_t count)
        while (count--)
                *dest++ = *src++;
 }
+EXPORT_SYMBOL(bcopy);
 #endif
 
 #ifndef __HAVE_ARCH_MEMCPY
@@ -484,6 +499,7 @@ void * memcpy(void * dest,const void *src,size_t count)
 
        return dest;
 }
+EXPORT_SYMBOL(memcpy);
 #endif
 
 #ifndef __HAVE_ARCH_MEMMOVE
@@ -514,6 +530,7 @@ void * memmove(void * dest,const void *src,size_t count)
 
        return dest;
 }
+EXPORT_SYMBOL(memmove);
 #endif
 
 #ifndef __HAVE_ARCH_MEMCMP
@@ -533,6 +550,7 @@ int memcmp(const void * cs,const void * ct,size_t count)
                        break;
        return res;
 }
+EXPORT_SYMBOL(memcmp);
 #endif
 
 #ifndef __HAVE_ARCH_MEMSCAN
@@ -557,6 +575,7 @@ void * memscan(void * addr, int c, size_t size)
        }
        return (void *) p;
 }
+EXPORT_SYMBOL(memscan);
 #endif
 
 #ifndef __HAVE_ARCH_STRSTR
@@ -581,6 +600,7 @@ char * strstr(const char * s1,const char * s2)
        }
        return NULL;
 }
+EXPORT_SYMBOL(strstr);
 #endif
 
 #ifndef __HAVE_ARCH_MEMCHR
@@ -603,5 +623,5 @@ void *memchr(const void *s, int c, size_t n)
        }
        return NULL;
 }
-
+EXPORT_SYMBOL(memchr);
 #endif
index b1f5c9d..0b09359 100644 (file)
@@ -668,8 +668,16 @@ int vsscanf(const char * buf, const char * fmt, va_list args)
                qualifier = -1;
                if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' ||
                    *fmt == 'Z' || *fmt == 'z') {
-                       qualifier = *fmt;
-                       fmt++;
+                       qualifier = *fmt++;
+                       if (unlikely(qualifier == *fmt)) {
+                               if (qualifier == 'h') {
+                                       qualifier = 'H';
+                                       fmt++;
+                               } else if (qualifier == 'l') {
+                                       qualifier = 'L';
+                                       fmt++;
+                               }
+                       }
                }
                base = 10;
                is_sign = 0;
@@ -754,6 +762,15 @@ int vsscanf(const char * buf, const char * fmt, va_list args)
                                break;
 
                switch(qualifier) {
+               case 'H':       /* that's 'hh' in format */
+                       if (is_sign) {
+                               signed char *s = (signed char *) va_arg(args,signed char *);
+                               *s = (signed char) simple_strtol(str,&next,base);
+                       } else {
+                               unsigned char *s = (unsigned char *) va_arg(args, unsigned char *);
+                               *s = (unsigned char) simple_strtoul(str, &next, base);
+                       }
+                       break;
                case 'h':
                        if (is_sign) {
                                short *s = (short *) va_arg(args,short *);
index 776b00d..b7866b1 100644 (file)
@@ -12,7 +12,7 @@ obj-y                 := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
                           readahead.o slab.o swap.o truncate.o vmscan.o \
                           $(mmu-y)
 
-obj-$(CONFIG_SWAP)     += page_io.o swap_state.o swapfile.o
+obj-$(CONFIG_SWAP)     += page_io.o swap_state.o swapfile.o thrash.o
 obj-$(CONFIG_X86_4G)   += usercopy.o
 obj-$(CONFIG_HUGETLBFS)        += hugetlb.o
 obj-$(CONFIG_PROC_MM)  += proc_mm.o
index d2290f1..a1d56de 100644 (file)
@@ -440,10 +440,6 @@ struct page * find_get_page(struct address_space *mapping, unsigned long offset)
 {
        struct page *page;
 
-       /*
-        * We scan the hash list read-only. Addition to and removal from
-        * the hash-list needs a held write-lock.
-        */
        spin_lock_irq(&mapping->tree_lock);
        page = radix_tree_lookup(&mapping->page_tree, offset);
        if (page)
@@ -655,7 +651,8 @@ void do_generic_mapping_read(struct address_space *mapping,
                             struct file * filp,
                             loff_t *ppos,
                             read_descriptor_t * desc,
-                            read_actor_t actor)
+                            read_actor_t actor,
+                            int nonblock)
 {
        struct inode *inode = mapping->host;
        unsigned long index, end_index, offset;
@@ -683,11 +680,21 @@ void do_generic_mapping_read(struct address_space *mapping,
 find_page:
                page = find_get_page(mapping, index);
                if (unlikely(page == NULL)) {
+                       if (nonblock) {
+                               desc->error = -EWOULDBLOCKIO;
+                               break;
+                       }
                        handle_ra_miss(mapping, &ra, index);
                        goto no_cached_page;
                }
-               if (!PageUptodate(page))
+               if (!PageUptodate(page)) {
+                       if (nonblock) {
+                               page_cache_release(page);
+                               desc->error = -EWOULDBLOCKIO;
+                               break;
+                       }
                        goto page_not_up_to_date;
+               }
 page_ok:
                /* nr is the maximum number of bytes to copy from this page */
                nr = PAGE_CACHE_SIZE;
@@ -928,7 +935,7 @@ __generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
                        if (desc.count == 0)
                                continue;
                        desc.error = 0;
-                       do_generic_file_read(filp,ppos,&desc,file_read_actor);
+                       do_generic_file_read(filp,ppos,&desc,file_read_actor,0);
                        retval += desc.written;
                        if (!retval) {
                                retval = desc.error;
@@ -1002,7 +1009,7 @@ ssize_t generic_file_sendfile(struct file *in_file, loff_t *ppos,
        desc.arg.data = target;
        desc.error = 0;
 
-       do_generic_file_read(in_file, ppos, &desc, actor);
+       do_generic_file_read(in_file, ppos, &desc, actor, 0);
        if (desc.written)
                return desc.written;
        return desc.error;
@@ -1199,6 +1206,7 @@ no_cached_page:
         * effect.
         */
        error = page_cache_read(file, pgoff);
+       grab_swap_token();
 
        /*
         * The page we want has now been added to the page cache.
@@ -1421,15 +1429,9 @@ repeat:
                        return err;
                }
        } else {
-               /*
-                * If a nonlinear mapping then store the file page offset
-                * in the pte.
-                */
-               if (pgoff != linear_page_index(vma, addr)) {
-                       err = install_file_pte(mm, vma, addr, pgoff, prot);
-                       if (err)
-                               return err;
-               }
+               err = install_file_pte(mm, vma, addr, pgoff, prot);
+               if (err)
+                       return err;
        }
 
        len -= PAGE_SIZE;
index 0babe11..2f211f5 100644 (file)
@@ -57,6 +57,8 @@ static inline void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma,
 int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
                unsigned long addr, struct page *page, pgprot_t prot)
 {
+       struct inode *inode;
+       pgoff_t size;
        int err = -ENOMEM;
        pte_t *pte;
        pgd_t *pgd;
@@ -77,6 +79,16 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
        if (!pte)
                goto err_unlock;
 
+       /*
+        * This page may have been truncated. Tell the
+        * caller about it.
+        */
+       err = -EINVAL;
+       inode = vma->vm_file->f_mapping->host;
+       size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+       if (!page->mapping || page->index >= size)
+               goto err_unlock;
+
        zap_pte(mm, vma, addr, pte);
 
        // mm->rss++;
index 09eac06..432da5b 100644 (file)
@@ -308,12 +308,10 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool)
 {
        struct bio *bio_orig = bio->bi_private;
        struct bio_vec *bvec, *org_vec;
-       int i;
+       int i, err = 0;
 
        if (!test_bit(BIO_UPTODATE, &bio->bi_flags))
-               goto out_eio;
-
-       set_bit(BIO_UPTODATE, &bio_orig->bi_flags);
+               err = -EIO;
 
        /*
         * free up bounce indirect pages used
@@ -326,8 +324,7 @@ static void bounce_end_io(struct bio *bio, mempool_t *pool)
                mempool_free(bvec->bv_page, pool);      
        }
 
-out_eio:
-       bio_endio(bio_orig, bio_orig->bi_size, 0);
+       bio_endio(bio_orig, bio_orig->bi_size, err);
        bio_put(bio);
 }
 
index 1c1cf7d..6c522e1 100644 (file)
@@ -191,9 +191,9 @@ static unsigned long set_max_huge_pages(unsigned long count)
 #ifdef CONFIG_SYSCTL
 int hugetlb_sysctl_handler(struct ctl_table *table, int write,
                           struct file *file, void __user *buffer,
-                          size_t *length)
+                          size_t *length, loff_t *ppos)
 {
-       proc_doulongvec_minmax(table, write, file, buffer, length);
+       proc_doulongvec_minmax(table, write, file, buffer, length, ppos);
        max_huge_pages = set_max_huge_pages(max_huge_pages);
        return 0;
 }
index 6bd9581..6c44ecc 100644 (file)
@@ -805,7 +805,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
                        pte_t *pte;
                        if (write) /* user gate pages are read-only */
                                return i ? : -EFAULT;
-                       pgd = pgd_offset(mm, pg);
+                       pgd = pgd_offset_gate(mm, pg);
                        if (!pgd)
                                return i ? : -EFAULT;
                        pmd = pmd_offset(pgd, pg);
@@ -1439,6 +1439,7 @@ static int do_swap_page(struct mm_struct * mm,
                /* Had to read the page from swap area: Major fault */
                ret = VM_FAULT_MAJOR;
                inc_page_state(pgmajfault);
+               grab_swap_token();
        }
 
        if (!vx_rsspages_avail(mm, 1)) {
index 2124d30..aa3f047 100644 (file)
@@ -200,3 +200,36 @@ asmlinkage long sys_munlockall(void)
        up_write(&current->mm->mmap_sem);
        return ret;
 }
+
+/*
+ * Objects with different lifetime than processes (SHM_LOCK and SHM_HUGETLB
+ * shm segments) get accounted against the user_struct instead.
+ */
+static spinlock_t shmlock_user_lock = SPIN_LOCK_UNLOCKED;
+
+int user_shm_lock(size_t size, struct user_struct *user)
+{
+       unsigned long lock_limit, locked;
+       int allowed = 0;
+
+       spin_lock(&shmlock_user_lock);
+       locked = size >> PAGE_SHIFT;
+       lock_limit = current->rlim[RLIMIT_MEMLOCK].rlim_cur;
+       lock_limit >>= PAGE_SHIFT;
+       if (locked + user->locked_shm > lock_limit && !capable(CAP_IPC_LOCK))
+               goto out;
+       get_uid(user);
+       user->locked_shm += locked;
+       allowed = 1;
+out:
+       spin_unlock(&shmlock_user_lock);
+       return allowed;
+}
+
+void user_shm_unlock(size_t size, struct user_struct *user)
+{
+       spin_lock(&shmlock_user_lock);
+       user->locked_shm -= (size >> PAGE_SHIFT);
+       spin_unlock(&shmlock_user_lock);
+       free_uid(user);
+}
index 5ab8fc4..3e11800 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -23,6 +23,7 @@
 #include <linux/mount.h>
 #include <linux/mempolicy.h>
 #include <linux/rmap.h>
+#include <linux/random.h>
 
 #include <asm/uaccess.h>
 #include <asm/cacheflush.h>
@@ -757,6 +758,13 @@ unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
        int accountable = 1;
        unsigned long charged = 0;
 
+       /*
+        * Does the application expect PROT_READ to imply PROT_EXEC:
+        */
+       if (unlikely((prot & PROT_READ) &&
+                       (current->personality & READ_IMPLIES_EXEC)))
+               prot |= PROT_EXEC;
+
        if (file) {
                if (is_file_hugepages(file))
                        accountable = 0;
@@ -788,7 +796,7 @@ unsigned long do_mmap_pgoff(struct mm_struct *mm, struct file * file,
        /* Obtain the address to map to. we verify (or select) it and ensure
         * that it represents a valid section of the address space.
         */
-       addr = get_unmapped_area(file, addr, len, pgoff, flags, prot & PROT_EXEC);
+       addr = get_unmapped_area_prot(file, addr, len, pgoff, flags, prot & PROT_EXEC);
        if (addr & ~PAGE_MASK)
                return addr;
 
@@ -1028,9 +1036,9 @@ EXPORT_SYMBOL(do_mmap_pgoff);
  * This function "knows" that -ENOMEM has the bits set.
  */
 #ifndef HAVE_ARCH_UNMAPPED_AREA
-static inline unsigned long
+unsigned long
 arch_get_unmapped_area(struct file *filp, unsigned long addr,
-               unsigned long len, unsigned long pgoff, unsigned long flags, unsigned long exec)
+               unsigned long len, unsigned long pgoff, unsigned long flags)
 {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
@@ -1072,15 +1080,120 @@ full_search:
                addr = vma->vm_end;
        }
 }
-#else
-extern unsigned long
-arch_get_unmapped_area(struct file *, unsigned long, unsigned long,
-                       unsigned long, unsigned long, unsigned long);
 #endif 
 
+void arch_unmap_area(struct vm_area_struct *area)
+{
+       /*
+        * Is this a new hole at the lowest possible address?
+        */
+       if (area->vm_start >= TASK_UNMAPPED_BASE &&
+                       area->vm_start < area->vm_mm->free_area_cache)
+               area->vm_mm->free_area_cache = area->vm_start;
+}
+
+/*
+ * This mmap-allocator allocates new areas top-down from below the
+ * stack's low limit (the base):
+ */
 unsigned long
-get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
-               unsigned long pgoff, unsigned long flags, unsigned long exec)
+arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+                         const unsigned long len, const unsigned long pgoff,
+                         const unsigned long flags)
+{
+       struct vm_area_struct *vma, *prev_vma;
+       struct mm_struct *mm = current->mm;
+       unsigned long base = mm->mmap_base, addr = addr0;
+       int first_time = 1;
+
+       /* requested length too big for entire address space */
+       if (len > TASK_SIZE)
+               return -ENOMEM;
+
+       /* dont allow allocations above current base */
+       if (mm->free_area_cache > base)
+               mm->free_area_cache = base;
+
+       /* requesting a specific address */
+       if (addr) {
+               addr = PAGE_ALIGN(addr);
+               vma = find_vma(mm, addr);
+               if (TASK_SIZE - len >= addr &&
+                               (!vma || addr + len <= vma->vm_start))
+                       return addr;
+       }
+
+try_again:
+       /* make sure it can fit in the remaining address space */
+       if (mm->free_area_cache < len)
+               goto fail;
+
+       /* either no address requested or cant fit in requested address hole */
+       addr = (mm->free_area_cache - len) & PAGE_MASK;
+       do {
+               /*
+                * Lookup failure means no vma is above this address,
+                * i.e. return with success:
+                */
+               if (!(vma = find_vma_prev(mm, addr, &prev_vma)))
+                       return addr;
+
+               /*
+                * new region fits between prev_vma->vm_end and
+                * vma->vm_start, use it:
+                */
+               if (addr+len <= vma->vm_start &&
+                               (!prev_vma || (addr >= prev_vma->vm_end)))
+                       /* remember the address as a hint for next time */
+                       return (mm->free_area_cache = addr);
+               else
+                       /* pull free_area_cache down to the first hole */
+                       if (mm->free_area_cache == vma->vm_end)
+                               mm->free_area_cache = vma->vm_start;
+
+               /* try just below the current vma->vm_start */
+               addr = vma->vm_start-len;
+       } while (len <= vma->vm_start);
+
+fail:
+       /*
+        * if hint left us with no space for the requested
+        * mapping then try again:
+        */
+       if (first_time) {
+               mm->free_area_cache = base;
+               first_time = 0;
+               goto try_again;
+       }
+       /*
+        * A failed mmap() very likely causes application failure,
+        * so fall back to the bottom-up function here. This scenario
+        * can happen with large stack limits and large mmap()
+        * allocations.
+        */
+       mm->free_area_cache = TASK_UNMAPPED_BASE;
+       addr = arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
+       /*
+        * Restore the topdown base:
+        */
+       mm->free_area_cache = base;
+
+       return addr;
+}
+
+void arch_unmap_area_topdown(struct vm_area_struct *area)
+{
+       /*
+        * Is this a new hole at the highest possible address?
+        */
+       if (area->vm_end > area->vm_mm->free_area_cache)
+               area->vm_mm->free_area_cache = area->vm_end;
+}
+
+
+unsigned long
+get_unmapped_area_prot(struct file *file, unsigned long addr, unsigned long len,
+               unsigned long pgoff, unsigned long flags, int exec)
 {
        if (flags & MAP_FIXED) {
                unsigned long ret;
@@ -1112,10 +1225,80 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
                return file->f_op->get_unmapped_area(file, addr, len,
                                                pgoff, flags);
 
-       return arch_get_unmapped_area(file, addr, len, pgoff, flags, exec);
+       if (exec && current->mm->get_unmapped_exec_area)
+               return current->mm->get_unmapped_exec_area(file, addr, len, pgoff, flags);
+       else
+               return current->mm->get_unmapped_area(file, addr, len, pgoff, flags);
 }
 
-EXPORT_SYMBOL(get_unmapped_area);
+EXPORT_SYMBOL(get_unmapped_area_prot);
+
+
+#define SHLIB_BASE             0x00111000
+
+unsigned long arch_get_unmapped_exec_area(struct file *filp, unsigned long addr0,
+               unsigned long len0, unsigned long pgoff, unsigned long flags)
+{
+       unsigned long addr = addr0, len = len0;
+       struct mm_struct *mm = current->mm;
+       struct vm_area_struct *vma;
+       unsigned long tmp;
+
+       if (len > TASK_SIZE)
+               return -ENOMEM;
+               
+       if (!addr && !(flags & MAP_FIXED))
+               addr = randomize_range(SHLIB_BASE, 0x01000000, len);
+
+       if (addr) {
+               addr = PAGE_ALIGN(addr);
+               vma = find_vma(mm, addr);
+               if (TASK_SIZE - len >= addr &&
+                   (!vma || addr + len <= vma->vm_start)) {
+                       return addr;
+               }
+       }
+
+       addr = SHLIB_BASE;
+
+       for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
+               /* At this point:  (!vma || addr < vma->vm_end). */
+               if (TASK_SIZE - len < addr) {
+                       return -ENOMEM;
+               }
+               if (!vma || addr + len <= vma->vm_start) {
+                       /*
+                        * Must not let a PROT_EXEC mapping get into the
+                        * brk area:
+                        */
+                       if (addr + len > mm->brk)
+                               goto failed;
+                       
+                       /*
+                        * Up until the brk area we randomize addresses
+                        * as much as possible:
+                        */
+                       if (addr >= 0x01000000) {
+                               tmp = randomize_range(0x01000000, mm->brk, len);
+                               vma = find_vma(mm, tmp);
+                               if (TASK_SIZE - len >= tmp &&
+                                   (!vma || tmp + len <= vma->vm_start))
+                                       return tmp;
+                       }
+                       /*
+                        * Ok, randomization didnt work out - return
+                        * the result of the linear search:
+                        */
+                       return addr;
+               }
+               addr = vma->vm_end;
+       }
+       
+failed:
+       return current->mm->get_unmapped_area(filp, addr0, len0, pgoff, flags);
+}
+
+
 
 /* Look up the first VMA which satisfies  addr < vm_end,  NULL if none. */
 struct vm_area_struct * find_vma(struct mm_struct * mm, unsigned long addr)
@@ -1412,7 +1595,6 @@ no_mmaps:
 static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *area)
 {
        size_t len = area->vm_end - area->vm_start;
-       unsigned long old_end = area->vm_end;
 
        // area->vm_mm->total_vm -= len >> PAGE_SHIFT;
        vx_vmpages_sub(area->vm_mm, len >> PAGE_SHIFT);
@@ -1420,20 +1602,8 @@ static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *area)
        if (area->vm_flags & VM_LOCKED)
                // area->vm_mm->locked_vm -= len >> PAGE_SHIFT;
                vx_vmlocked_sub(area->vm_mm, len >> PAGE_SHIFT);
-       /*
-        * Is this a new hole at the lowest possible address?
-        */
-       if (area->vm_start >= TASK_UNMAPPED_BASE &&
-                               area->vm_start < area->vm_mm->free_area_cache)
-             area->vm_mm->free_area_cache = area->vm_start;
-       /*
-        * Is this a new hole at the highest possible address?
-        */
-       if (area->vm_start > area->vm_mm->non_executable_cache)
-               area->vm_mm->non_executable_cache = area->vm_start;
+       area->vm_mm->unmap_area(area);
        remove_vm_struct(area);
-       if (unlikely(area->vm_flags & VM_EXEC))
-               arch_remove_exec_range(mm, old_end);
 }
 
 /*
index 4122bdd..e978ff3 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/highmem.h>
 #include <linux/security.h>
 #include <linux/mempolicy.h>
+#include <linux/personality.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -211,6 +212,12 @@ do_mprotect(struct mm_struct *mm, unsigned long start, size_t len,
                return -EINVAL;
        if (end == start)
                return 0;
+       /*
+        * Does the application expect PROT_READ to imply PROT_EXEC:
+        */
+       if (unlikely((prot & PROT_READ) &&
+                       (current->personality & READ_IMPLIES_EXEC)))
+               prot |= PROT_EXEC;
 
        vm_flags = calc_vm_prot_bits(prot);
 
index a47554b..cb6429e 100644 (file)
@@ -392,9 +392,8 @@ unsigned long do_mremap(unsigned long addr,
                        if (vma->vm_flags & VM_MAYSHARE)
                                map_flags |= MAP_SHARED;
 
-                       new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
-                                       vma->vm_pgoff, map_flags,
-                                               vma->vm_flags & VM_EXEC);
+                       new_addr = get_unmapped_area_prot(vma->vm_file, 0, new_len, 
+                               vma->vm_pgoff, map_flags, vma->vm_flags & VM_EXEC);
                        ret = new_addr;
                        if (new_addr & ~PAGE_MASK)
                                goto out;
index 873b6db..3de04b6 100644 (file)
@@ -221,7 +221,7 @@ retry:
 /**
  * out_of_memory - is the system out of memory?
  */
-void out_of_memory(void)
+void out_of_memory(int gfp_mask)
 {
        /*
         * oom_lock protects out_of_memory()'s static variables.
@@ -272,6 +272,9 @@ void out_of_memory(void)
         */
        lastkill = now;
 
+       printk("oom-killer: gfp_mask=0x%x\n", gfp_mask);
+       show_free_areas();
+
        /* oom_kill() sleeps */
        spin_unlock(&oom_lock);
        oom_kill();
index a2aa511..343998d 100644 (file)
@@ -399,9 +399,9 @@ static void wb_kupdate(unsigned long arg)
  * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs
  */
 int dirty_writeback_centisecs_handler(ctl_table *table, int write,
-               struct file *file, void __user *buffer, size_t *length)
+               struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-       proc_dointvec(table, write, file, buffer, length);
+       proc_dointvec(table, write, file, buffer, length, ppos);
        if (dirty_writeback_centisecs) {
                mod_timer(&wb_timer,
                        jiffies + (dirty_writeback_centisecs * HZ) / 100);
index 072d138..152299c 100644 (file)
@@ -837,17 +837,6 @@ unsigned int nr_free_pages(void)
 
 EXPORT_SYMBOL(nr_free_pages);
 
-unsigned int nr_used_zone_pages(void)
-{
-       unsigned int pages = 0;
-       struct zone *zone;
-
-       for_each_zone(zone)
-               pages += zone->nr_active + zone->nr_inactive;
-
-       return pages;
-}
-
 #ifdef CONFIG_NUMA
 unsigned int nr_free_pages_pgdat(pg_data_t *pgdat)
 {
@@ -1395,7 +1384,7 @@ static void __init calculate_zone_totalpages(struct pglist_data *pgdat,
                for (i = 0; i < MAX_NR_ZONES; i++)
                        realtotalpages -= zholes_size[i];
        pgdat->node_present_pages = realtotalpages;
-       printk("On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages);
+       printk(KERN_DEBUG "On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages);
 }
 
 
@@ -1416,7 +1405,7 @@ void __init memmap_init_zone(struct page *start, unsigned long size, int nid,
                INIT_LIST_HEAD(&page->lru);
 #ifdef WANT_PAGE_VIRTUAL
                /* The shift won't overflow because ZONE_NORMAL is below 4G. */
-               if (!is_highmem(zone))
+               if (!is_highmem_idx(zone))
                        set_page_address(page, __va(start_pfn << PAGE_SHIFT));
 #endif
                start_pfn++;
@@ -1501,7 +1490,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat,
                        pcp->batch = 1 * batch;
                        INIT_LIST_HEAD(&pcp->list);
                }
-               printk("  %s zone: %lu pages, LIFO batch:%lu\n",
+               printk(KERN_DEBUG "  %s zone: %lu pages, LIFO batch:%lu\n",
                                zone_names[j], realsize, batch);
                INIT_LIST_HEAD(&zone->active_list);
                INIT_LIST_HEAD(&zone->inactive_list);
@@ -1980,9 +1969,9 @@ module_init(init_per_zone_pages_min)
  *     changes.
  */
 int min_free_kbytes_sysctl_handler(ctl_table *table, int write, 
-               struct file *file, void __user *buffer, size_t *length)
+               struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-       proc_dointvec(table, write, file, buffer, length);
+       proc_dointvec(table, write, file, buffer, length, ppos);
        setup_per_zone_pages_min();
        setup_per_zone_protection();
        return 0;
@@ -1994,9 +1983,9 @@ int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
  *     whenever sysctl_lower_zone_protection changes.
  */
 int lower_zone_protection_sysctl_handler(ctl_table *table, int write,
-                struct file *file, void __user *buffer, size_t *length)
+                struct file *file, void __user *buffer, size_t *length, loff_t *ppos)
 {
-       proc_dointvec_minmax(table, write, file, buffer, length);
+       proc_dointvec_minmax(table, write, file, buffer, length, ppos);
        setup_per_zone_protection();
        return 0;
 }
index 9723956..7073392 100644 (file)
@@ -349,7 +349,6 @@ page_cache_readahead(struct address_space *mapping, struct file_ra_state *ra,
                        struct file *filp, unsigned long offset)
 {
        unsigned max;
-       unsigned min;
        unsigned orig_next_size;
        unsigned actual;
        int first_access=0;
@@ -374,7 +373,6 @@ page_cache_readahead(struct address_space *mapping, struct file_ra_state *ra,
        if (max == 0)
                goto out;       /* No readahead */
 
-       min = get_min_readahead(ra);
        orig_next_size = ra->next_size;
 
        if (ra->next_size == 0) {
@@ -470,7 +468,11 @@ do_io:
                          * pages shall be accessed in the next
                          * current window.
                          */
-                       ra->next_size = min(ra->average , (unsigned long)max);
+                       average = ra->average;
+                       if (ra->serial_cnt > average)
+                               average = (ra->serial_cnt + ra->average + 1) / 2;
+
+                       ra->next_size = min(average , (unsigned long)max);
                }
                ra->start = offset;
                ra->size = ra->next_size;
@@ -552,6 +554,7 @@ void handle_ra_miss(struct address_space *mapping,
                                ra->size = max;
                                ra->ahead_start = 0;
                                ra->ahead_size = 0;
+                               ra->average = max / 2;
                        }
                }
                ra->prev_page = offset;
index 74fa3d7..6d77b76 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -231,6 +231,9 @@ static int page_referenced_one(struct page *page,
        if (ptep_clear_flush_young(vma, address, pte))
                referenced++;
 
+       if (mm != current->mm && has_swap_token(mm))
+               referenced++;
+
        (*mapcount)--;
 
 out_unmap:
@@ -482,6 +485,10 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma)
         * an exclusive swap page, do_wp_page will replace it by a copy
         * page, and the user never get to see the data GUP was holding
         * the original page for.
+        *
+        * This test is also useful for when swapoff (unuse_process) has
+        * to drop page lock: its reference to the page stops existing
+        * ptes from being unmapped, so swapoff can make progress.
         */
        if (PageSwapCache(page) &&
            page_count(page) != page->mapcount + 2) {
index f0e5fc7..c3b4cc5 100644 (file)
@@ -1121,15 +1121,9 @@ static int shmem_populate(struct vm_area_struct *vma,
                                return err;
                        }
                } else if (nonblock) {
-                       /*
-                        * If a nonlinear mapping then store the file page
-                        * offset in the pte.
-                        */
-                       if (pgoff != linear_page_index(vma, addr)) {
-                               err = install_file_pte(mm, vma, addr, pgoff, prot);
-                               if (err)
-                                       return err;
-                       }
+                       err = install_file_pte(mm, vma, addr, pgoff, prot);
+                       if (err)
+                               return err;
                }
 
                len -= PAGE_SIZE;
@@ -1157,41 +1151,24 @@ shmem_get_policy(struct vm_area_struct *vma, unsigned long addr)
 }
 #endif
 
-/* Protects current->user->locked_shm from concurrent access */
-static spinlock_t shmem_lock_user = SPIN_LOCK_UNLOCKED;
-
-int shmem_lock(struct file *file, int lock, struct user_struct * user)
+int shmem_lock(struct file *file, int lock, struct user_struct *user)
 {
        struct inode *inode = file->f_dentry->d_inode;
        struct shmem_inode_info *info = SHMEM_I(inode);
-       unsigned long lock_limit, locked;
        int retval = -ENOMEM;
 
        spin_lock(&info->lock);
-       spin_lock(&shmem_lock_user);
        if (lock && !(info->flags & VM_LOCKED)) {
-               locked = inode->i_size >> PAGE_SHIFT;
-               locked += user->locked_shm;
-               lock_limit = current->rlim[RLIMIT_MEMLOCK].rlim_cur;
-               lock_limit >>= PAGE_SHIFT;
-               if ((locked > lock_limit) && !capable(CAP_IPC_LOCK))
+               if (!user_shm_lock(inode->i_size, user))
                        goto out_nomem;
-               /* for this branch user == current->user so it won't go away under us */
-               atomic_inc(&user->__count);
-               user->locked_shm = locked;
+               info->flags |= VM_LOCKED;
        }
        if (!lock && (info->flags & VM_LOCKED) && user) {
-               locked = inode->i_size >> PAGE_SHIFT;
-               user->locked_shm -= locked;
-               free_uid(user);
-       }
-       if (lock)
-               info->flags |= VM_LOCKED;
-       else
+               user_shm_unlock(inode->i_size, user);
                info->flags &= ~VM_LOCKED;
+       }
        retval = 0;
 out_nomem:
-       spin_unlock(&shmem_lock_user);
        spin_unlock(&info->lock);
        return retval;
 }
index 6eca35a..b886b94 100644 (file)
@@ -111,7 +111,7 @@ static inline int scan_swap_map(struct swap_info_struct *si)
  check_next_cluster:
        if (offset+SWAPFILE_CLUSTER-1 <= si->highest_bit)
        {
-               int nr;
+               unsigned long nr;
                for (nr = offset; nr < offset+SWAPFILE_CLUSTER; nr++)
                        if (si->swap_map[nr])
                        {
@@ -550,7 +550,15 @@ static int unuse_process(struct mm_struct * mm,
        /*
         * Go through process' page directory.
         */
-       down_read(&mm->mmap_sem);
+       if (!down_read_trylock(&mm->mmap_sem)) {
+               /*
+                * Our reference to the page stops try_to_unmap_one from
+                * unmapping its ptes, so swapoff can make progress.
+                */
+               unlock_page(page);
+               down_read(&mm->mmap_sem);
+               lock_page(page);
+       }
        spin_lock(&mm->page_table_lock);
        for (vma = mm->mmap; vma; vma = vma->vm_next) {
                if (!is_vm_hugetlb_page(vma)) {
index 6570a66..95e0270 100644 (file)
@@ -174,22 +174,25 @@ EXPORT_SYMBOL(remove_shrinker);
  * slab to avoid swapping.
  *
  * We do weird things to avoid (scanned*seeks*entries) overflowing 32 bits.
+ *
+ * `lru_pages' represents the number of on-LRU pages in all the zones which
+ * are eligible for the caller's allocation attempt.  It is used for balancing
+ * slab reclaim versus page reclaim.
  */
-static int shrink_slab(unsigned long scanned, unsigned int gfp_mask)
+static int shrink_slab(unsigned long scanned, unsigned int gfp_mask,
+                       unsigned long lru_pages)
 {
        struct shrinker *shrinker;
-       long pages;
 
        if (down_trylock(&shrinker_sem))
                return 0;
 
-       pages = nr_used_zone_pages();
        list_for_each_entry(shrinker, &shrinker_list, list) {
                unsigned long long delta;
 
                delta = (4 * scanned) / shrinker->seeks;
                delta *= (*shrinker->shrinker)(0, gfp_mask);
-               do_div(delta, pages + 1);
+               do_div(delta, lru_pages + 1);
                shrinker->nr += delta;
                if (shrinker->nr < 0)
                        shrinker->nr = LONG_MAX;        /* It wrapped! */
@@ -904,6 +907,7 @@ int try_to_free_pages(struct zone **zones,
        int total_scanned = 0, total_reclaimed = 0;
        struct reclaim_state *reclaim_state = current->reclaim_state;
        struct scan_control sc;
+       unsigned long lru_pages = 0;
        int i;
 
        sc.gfp_mask = gfp_mask;
@@ -911,8 +915,12 @@ int try_to_free_pages(struct zone **zones,
 
        inc_page_state(allocstall);
 
-       for (i = 0; zones[i] != 0; i++)
-               zones[i]->temp_priority = DEF_PRIORITY;
+       for (i = 0; zones[i] != NULL; i++) {
+               struct zone *zone = zones[i];
+
+               zone->temp_priority = DEF_PRIORITY;
+               lru_pages += zone->nr_active + zone->nr_inactive;
+       }
 
        for (priority = DEF_PRIORITY; priority >= 0; priority--) {
                sc.nr_mapped = read_page_state(nr_mapped);
@@ -920,7 +928,7 @@ int try_to_free_pages(struct zone **zones,
                sc.nr_reclaimed = 0;
                sc.priority = priority;
                shrink_caches(zones, &sc);
-               shrink_slab(sc.nr_scanned, gfp_mask);
+               shrink_slab(sc.nr_scanned, gfp_mask, lru_pages);
                if (reclaim_state) {
                        sc.nr_reclaimed += reclaim_state->reclaimed_slab;
                        reclaim_state->reclaimed_slab = 0;
@@ -949,7 +957,7 @@ int try_to_free_pages(struct zone **zones,
                        blk_congestion_wait(WRITE, HZ/10);
        }
        if ((gfp_mask & __GFP_FS) && !(gfp_mask & __GFP_NORETRY))
-               out_of_memory();
+               out_of_memory(gfp_mask);
 out:
        for (i = 0; zones[i] != 0; i++)
                zones[i]->prev_priority = zones[i]->temp_priority;
@@ -1005,7 +1013,7 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
        for (priority = DEF_PRIORITY; priority >= 0; priority--) {
                int all_zones_ok = 1;
                int end_zone = 0;       /* Inclusive.  0 = ZONE_DMA */
-
+               unsigned long lru_pages = 0;
 
                if (nr_pages == 0) {
                        /*
@@ -1029,6 +1037,12 @@ static int balance_pgdat(pg_data_t *pgdat, int nr_pages)
                        end_zone = pgdat->nr_zones - 1;
                }
 scan:
+               for (i = 0; i <= end_zone; i++) {
+                       struct zone *zone = pgdat->node_zones + i;
+
+                       lru_pages += zone->nr_active + zone->nr_inactive;
+               }
+
                /*
                 * Now scan the zone in the dma->highmem direction, stopping
                 * at the last zone which needs scanning.
@@ -1056,7 +1070,7 @@ scan:
                        sc.priority = priority;
                        shrink_zone(zone, &sc);
                        reclaim_state->reclaimed_slab = 0;
-                       shrink_slab(sc.nr_scanned, GFP_KERNEL);
+                       shrink_slab(sc.nr_scanned, GFP_KERNEL, lru_pages);
                        sc.nr_reclaimed += reclaim_state->reclaimed_slab;
                        total_reclaimed += sc.nr_reclaimed;
                        if (zone->all_unreclaimable)
index 3a5ae43..830282e 100644 (file)
@@ -33,8 +33,7 @@ extern unsigned short vlan_name_type;
 #define VLAN_GRP_HASH_SHIFT    5
 #define VLAN_GRP_HASH_SIZE     (1 << VLAN_GRP_HASH_SHIFT)
 #define VLAN_GRP_HASH_MASK     (VLAN_GRP_HASH_SIZE - 1)
-extern struct vlan_group *vlan_group_hash[VLAN_GRP_HASH_SIZE];
-extern spinlock_t vlan_group_lock;
+extern struct  hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE];
 
 /*  Find a VLAN device by the MAC address of its Ethernet device, and
  *  it's VLAN ID.  The default configuration is to have VLAN's scope
@@ -44,10 +43,8 @@ extern spinlock_t vlan_group_lock;
  *  NOT follow the spec for VLANs, but may be useful for doing very
  *  large quantities of VLAN MUX/DEMUX onto FrameRelay or ATM PVCs.
  *
- *  Must be invoked with vlan_group_lock held and that lock MUST NOT
- *  be dropped until a reference is obtained on the returned device.
- *  You may drop the lock earlier if you are running under the RTNL
- *  semaphore, however.
+ *  Must be invoked with rcu_read_lock (ie preempt disabled)
+ *  or with RTNL.
  */
 struct net_device *__find_vlan_dev(struct net_device* real_dev,
                                   unsigned short VID); /* vlan.c */
@@ -65,6 +62,7 @@ int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
 int vlan_dev_set_mac_address(struct net_device *dev, void* addr);
 int vlan_dev_open(struct net_device* dev);
 int vlan_dev_stop(struct net_device* dev);
+int vlan_dev_ioctl(struct net_device* dev, struct ifreq *ifr, int cmd);
 int vlan_dev_set_ingress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
 int vlan_dev_set_egress_priority(char* dev_name, __u32 skb_prio, short vlan_prio);
 int vlan_dev_set_vlan_flag(char* dev_name, __u32 flag, short flag_val);
index bea6963..460aabc 100644 (file)
@@ -138,15 +138,15 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
 
        /* We have 12 bits of vlan ID.
         *
-        * We must not drop the vlan_group_lock until we hold a
+        * We must not drop allow preempt until we hold a
         * reference to the device (netif_rx does that) or we
         * fail.
         */
 
-       spin_lock_bh(&vlan_group_lock);
+       rcu_read_lock();
        skb->dev = __find_vlan_dev(dev, vid);
        if (!skb->dev) {
-               spin_unlock_bh(&vlan_group_lock);
+               rcu_read_unlock();
 
 #ifdef VLAN_DEBUG
                printk(VLAN_DBG "%s: ERROR: No net_device for VID: %i on dev: %s [%i]\n",
@@ -170,7 +170,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
         */
 
        if (dev != VLAN_DEV_INFO(skb->dev)->real_dev) {
-               spin_unlock_bh(&vlan_group_lock);
+               rcu_read_unlock();
 
 #ifdef VLAN_DEBUG
                printk(VLAN_DBG "%s: dropping skb: %p because came in on wrong device, dev: %s  real_dev: %s, skb_dev: %s\n",
@@ -244,7 +244,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
                        /* TODO:  Add a more specific counter here. */
                        stats->rx_errors++;
                }
-               spin_unlock_bh(&vlan_group_lock);
+               rcu_read_lock();
                return 0;
        }
 
@@ -273,7 +273,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
                        /* TODO:  Add a more specific counter here. */
                        stats->rx_errors++;
                }
-               spin_unlock_bh(&vlan_group_lock);
+               rcu_read_unlock();
                return 0;
        }
 
@@ -296,7 +296,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
                /* TODO:  Add a more specific counter here. */
                stats->rx_errors++;
        }
-       spin_unlock_bh(&vlan_group_lock);
+       rcu_read_unlock();
        return 0;
 }
 
@@ -757,6 +757,34 @@ int vlan_dev_stop(struct net_device *dev)
        vlan_flush_mc_list(dev);
        return 0;
 }
+
+int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+{
+       struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev;
+       struct ifreq ifrr;
+       int err = -EOPNOTSUPP;
+
+       strncpy(ifrr.ifr_name, real_dev->name, IFNAMSIZ);
+       ifrr.ifr_ifru = ifr->ifr_ifru;
+
+       switch(cmd) {
+       case SIOCGMIIPHY:
+       case SIOCGMIIREG:
+       case SIOCSMIIREG:
+               if (real_dev->do_ioctl && netif_device_present(real_dev)) 
+                       err = real_dev->do_ioctl(dev, &ifrr, cmd);
+               break;
+
+       case SIOCETHTOOL:
+               err = dev_ethtool(&ifrr);
+       }
+
+       if (!err) 
+               ifr->ifr_ifru = ifrr.ifr_ifru;
+
+       return err;
+}
+
 /** Taken from Gleb + Lennert's VLAN code, and modified... */
 void vlan_dev_set_multicast_list(struct net_device *vlan_dev)
 {
index 6b03321..e2334b3 100644 (file)
@@ -109,6 +109,8 @@ source "net/ipv4/Kconfig"
 config IPV6
        tristate "The IPv6 protocol (EXPERIMENTAL)"
        depends on INET && EXPERIMENTAL
+       select CRYPTO if IPV6_PRIVACY
+       select CRYPTO_MD5 if IPV6_PRIVACY
        ---help---
          This is experimental support for the IP version 6 (formerly called
          IPng "IP next generation").  You will still be able to do
@@ -549,26 +551,6 @@ config WAN_ROUTER
 
          If unsure, say N.
 
-config NET_FASTROUTE
-       bool "Fast switching (read help!)"
-       depends on EXPERIMENTAL
-       ---help---
-         Saying Y here enables direct NIC-to-NIC (NIC = Network Interface
-         Card) data transfers on the local network, which is fast.
-
-         IMPORTANT NOTE: This option is NOT COMPATIBLE with "Network packet
-         filtering" (CONFIG_NETFILTER). Say N here if you say Y there.
-
-         However, it will work with all options in the "Advanced router"
-         section (except for "Use TOS value as routing key" and
-         "Use FWMARK value as routing key").
-
-         At the moment, few devices support fast switching (tulip is one of
-         them, a modified 8390 driver can be found at
-         <ftp://ftp.tux.org/pub/net/ip-routing/fastroute/fastroute-8390.tar.gz>).
-
-         If unsure, say N.
-
 config NET_HW_FLOWCONTROL
        bool "Forwarding between high speed interfaces"
        depends on EXPERIMENTAL
@@ -672,6 +654,8 @@ source "net/irda/Kconfig"
 
 source "net/bluetooth/Kconfig"
 
+source "net/tux/Kconfig"
+
 source "drivers/net/Kconfig"
 
 endmenu
index 61740b4..7e7a957 100644 (file)
@@ -19,6 +19,7 @@ obj-$(CONFIG_UNIX)            += unix/
 ifneq ($(CONFIG_IPV6),)
 obj-y                          += ipv6/
 endif
+obj-$(CONFIG_TUX)              += tux/
 obj-$(CONFIG_PACKET)           += packet/
 obj-$(CONFIG_NET_KEY)          += key/
 obj-$(CONFIG_NET_SCHED)                += sched/
index 4170de1..4185d7b 100644 (file)
@@ -908,12 +908,12 @@ static int atrtr_ioctl(unsigned int cmd, void __user *arg)
 
                case SIOCADDRT: {
                        struct net_device *dev = NULL;
-                       /*
-                        * FIXME: the name of the device is still in user
-                        * space, isn't it?
-                        */
                        if (rt.rt_dev) {
-                               dev = __dev_get_by_name(rt.rt_dev);
+                               char name[IFNAMSIZ];
+                               if (copy_from_user(name, rt.rt_dev, IFNAMSIZ-1))
+                                       return -EFAULT;
+                               name[IFNAMSIZ-1] = '\0';
+                               dev = __dev_get_by_name(name);
                                if (!dev)
                                        return -ENODEV;
                        }                       
index 36fad58..66778f4 100644 (file)
@@ -563,7 +563,7 @@ Note: we do not have explicit unassign, but look at _push()
                BRPRIV(skb->dev)->stats.rx_packets--;
                br2684_push(atmvcc, skb);
        }
-       (void) try_module_get(THIS_MODULE);
+       __module_get(THIS_MODULE);
        return 0;
     error:
        write_unlock_irq(&devs_lock);
index 3a85899..a920b92 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * lec.c: Lan Emulation driver 
- * Marko Kiiskila carnil@cs.tut.fi
+ * Marko Kiiskila mkiiskila@yahoo.com
  *
  */
 
@@ -71,9 +71,9 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int lec_close(struct net_device *dev);
 static struct net_device_stats *lec_get_stats(struct net_device *dev);
 static void lec_init(struct net_device *dev);
-static inline struct lec_arp_table* lec_arp_find(struct lec_priv *priv,
+static struct lec_arp_table* lec_arp_find(struct lec_priv *priv,
                                                      unsigned char *mac_addr);
-static inline int lec_arp_remove(struct lec_priv *priv,
+static int lec_arp_remove(struct lec_priv *priv,
                                     struct lec_arp_table *to_remove);
 /* LANE2 functions */
 static void lane2_associate_ind (struct net_device *dev, u8 *mac_address,
@@ -1468,7 +1468,7 @@ lec_arp_add(struct lec_priv *priv, struct lec_arp_table *to_add)
 /*
  * Remove entry from lec_arp_table
  */
-static inline in
+static int 
 lec_arp_remove(struct lec_priv *priv,
                struct lec_arp_table *to_remove)
 {
@@ -1755,7 +1755,7 @@ lec_arp_destroy(struct lec_priv *priv)
 /* 
  * Find entry by mac_address
  */
-static inline struct lec_arp_table*
+static struct lec_arp_table*
 lec_arp_find(struct lec_priv *priv,
              unsigned char *mac_addr)
 {
index 714fe71..4f1849f 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/proc_fs.h>
 #include <linux/time.h>
+#include <linux/seq_file.h>
 #include <asm/uaccess.h>
 #include <linux/atmmpc.h>
 #include <linux/atm.h>
 extern struct mpoa_client *mpcs;
 extern struct proc_dir_entry *atm_proc_root;  /* from proc.c. */
 
-static ssize_t proc_mpc_read(struct file *file, char __user *buff,
-                            size_t count, loff_t *pos);
-
+static int proc_mpc_open(struct inode *inode, struct file *file);
 static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos);
 
-static int parse_qos(const char *buff, int len);
+static int parse_qos(const char *buff);
 
 /*
  *   Define allowed FILE OPERATIONS
  */
 static struct file_operations mpc_file_operations = {
        .owner =        THIS_MODULE,
-       .read =         proc_mpc_read,
+       .open =         proc_mpc_open,
+       .read =         seq_read,
+       .llseek =       seq_lseek,
        .write =        proc_mpc_write,
+       .release =      seq_release,
 };
 
-static int print_header(char *buff,struct mpoa_client *mpc){
-        if(mpc != NULL){
-               return sprintf(buff,"\nInterface %d:\n\n",mpc->dev_num);  
-         
-       }
-       return 0;
-}
-
 /*
  * Returns the state of an ingress cache entry as a string
  */
@@ -96,211 +90,174 @@ static const char *egress_state_string(int state){
        }
 }
 
+/*
+ * FIXME: mpcs (and per-mpc lists) have no locking whatsoever.
+ */
+
+static void *mpc_start(struct seq_file *m, loff_t *pos)
+{
+       loff_t l = *pos;
+       struct mpoa_client *mpc;
+
+       if (!l--)
+               return SEQ_START_TOKEN;
+       for (mpc = mpcs; mpc; mpc = mpc->next)
+               if (!l--)
+                       return mpc;
+       return NULL;
+}
+
+static void *mpc_next(struct seq_file *m, void *v, loff_t *pos)
+{
+       struct mpoa_client *p = v;
+       (*pos)++;
+       return v == SEQ_START_TOKEN ? mpcs : p->next;
+}
+
+static void mpc_stop(struct seq_file *m, void *v)
+{
+}
+
 /*
  * READING function - called when the /proc/atm/mpoa file is read from.
  */
-static ssize_t proc_mpc_read(struct file *file, char __user *buff,
-                            size_t count, loff_t *pos){
-        unsigned long page = 0;
+static ssize_t mpc_show(struct seq_file *m, void *v)
+{
+       struct mpoa_client *mpc = v;
        unsigned char *temp;
-        ssize_t length = 0;
-       int i = 0;
-       struct mpoa_client *mpc = mpcs;
+       int i;
        in_cache_entry *in_entry;
        eg_cache_entry *eg_entry;
        struct timeval now;
        unsigned char ip_string[16];
-       if(count == 0)
-               return 0;
-       page = get_zeroed_page(GFP_KERNEL);
-       if(!page)
-               return -ENOMEM;
-       atm_mpoa_disp_qos((char *)page, &length);
-       while(mpc != NULL){
-               length += print_header((char *)page + length, mpc);
-               length += sprintf((char *)page + length,"Ingress Entries:\nIP address      State      Holding time  Packets fwded  VPI  VCI\n");
-               in_entry = mpc->in_cache;
-               do_gettimeofday(&now);
-               while(in_entry != NULL){
-                       temp = (unsigned char *)&in_entry->ctrl_info.in_dst_ip;                        sprintf(ip_string,"%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
-                       length += sprintf((char *)page + length,"%-16s%s%-14lu%-12u", ip_string, ingress_state_string(in_entry->entry_state), (in_entry->ctrl_info.holding_time-(now.tv_sec-in_entry->tv.tv_sec)), in_entry->packets_fwded);
-                       if(in_entry->shortcut)
-                               length += sprintf((char *)page + length,"   %-3d  %-3d",in_entry->shortcut->vpi,in_entry->shortcut->vci);
-                       length += sprintf((char *)page + length,"\n");
-                       in_entry = in_entry->next;
-               }
-               length += sprintf((char *)page + length,"\n");
-               eg_entry = mpc->eg_cache;
-               length += sprintf((char *)page + length,"Egress Entries:\nIngress MPC ATM addr\nCache-id        State      Holding time  Packets recvd  Latest IP addr   VPI VCI\n");
-               while(eg_entry != NULL){
-                 for(i=0;i<ATM_ESA_LEN;i++){
-                         length += sprintf((char *)page + length,"%02x",eg_entry->ctrl_info.in_MPC_data_ATM_addr[i]);}  
-                       length += sprintf((char *)page + length,"\n%-16lu%s%-14lu%-15u",(unsigned long) ntohl(eg_entry->ctrl_info.cache_id), egress_state_string(eg_entry->entry_state), (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), eg_entry->packets_rcvd);
-                       
-                       /* latest IP address */
-                       temp = (unsigned char *)&eg_entry->latest_ip_addr;
-                       sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
-                       length += sprintf((char *)page + length, "%-16s", ip_string);
-
-                       if(eg_entry->shortcut)
-                               length += sprintf((char *)page + length," %-3d %-3d",eg_entry->shortcut->vpi,eg_entry->shortcut->vci);
-                       length += sprintf((char *)page + length,"\n");
-                       eg_entry = eg_entry->next;
-               }
-               length += sprintf((char *)page + length,"\n");
-               mpc = mpc->next;
+
+       if (v == SEQ_START_TOKEN) {
+               atm_mpoa_disp_qos(m);
+               return 0;
        }
 
-       if (*pos >= length) length = 0;
-       else {
-         if ((count + *pos) > length) count = length - *pos;
-         if (copy_to_user(buff, (char *)page , count)) {
-                 free_page(page);
-                 return -EFAULT;
-          }
-         *pos += count;
+       seq_printf(m, "\nInterface %d:\n\n", mpc->dev_num);  
+       seq_printf(m, "Ingress Entries:\nIP address      State      Holding time  Packets fwded  VPI  VCI\n");
+       do_gettimeofday(&now);
+
+       for (in_entry = mpc->in_cache; in_entry; in_entry = in_entry->next) {
+               temp = (unsigned char *)&in_entry->ctrl_info.in_dst_ip;
+               sprintf(ip_string,"%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
+               seq_printf(m, "%-16s%s%-14lu%-12u",
+                             ip_string,
+                             ingress_state_string(in_entry->entry_state),
+                             in_entry->ctrl_info.holding_time-(now.tv_sec-in_entry->tv.tv_sec),
+                             in_entry->packets_fwded);
+               if (in_entry->shortcut)
+                       seq_printf(m, "   %-3d  %-3d",in_entry->shortcut->vpi,in_entry->shortcut->vci);
+               seq_printf(m, "\n");
        }
 
-       free_page(page);
-        return length;
+       seq_printf(m, "\n");
+       seq_printf(m, "Egress Entries:\nIngress MPC ATM addr\nCache-id        State      Holding time  Packets recvd  Latest IP addr   VPI VCI\n");
+       for (eg_entry = mpc->eg_cache; eg_entry; eg_entry = eg_entry->next) {
+               unsigned char *p = eg_entry->ctrl_info.in_MPC_data_ATM_addr;
+               for(i = 0; i < ATM_ESA_LEN; i++)
+                       seq_printf(m, "%02x", p[i]);
+               seq_printf(m, "\n%-16lu%s%-14lu%-15u",
+                          (unsigned long)ntohl(eg_entry->ctrl_info.cache_id),
+                          egress_state_string(eg_entry->entry_state),
+                          (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)),
+                          eg_entry->packets_rcvd);
+               
+               /* latest IP address */
+               temp = (unsigned char *)&eg_entry->latest_ip_addr;
+               sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
+               seq_printf(m, "%-16s", ip_string);
+
+               if (eg_entry->shortcut)
+                       seq_printf(m, " %-3d %-3d",eg_entry->shortcut->vpi,eg_entry->shortcut->vci);
+               seq_printf(m, "\n");
+       }
+       seq_printf(m, "\n");
+       return 0;
+}
+
+static struct seq_operations mpc_op = {
+       .start =        mpc_start,
+       .next =         mpc_next,
+       .stop =         mpc_stop,
+       .show =         mpc_show
+};
+
+static int proc_mpc_open(struct inode *inode, struct file *file)
+{
+       return seq_open(file, &mpc_op);
 }
 
 static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
                               size_t nbytes, loff_t *ppos)
 {
-        int incoming, error, retval;
-        char *page, c;
-        const char __user *tmp;
+        char *page, *p;
+       unsigned len;
 
-        if (nbytes == 0) return 0;
-        if (nbytes >= PAGE_SIZE) nbytes = PAGE_SIZE-1;
+        if (nbytes == 0)
+               return 0;
 
-        error = verify_area(VERIFY_READ, buff, nbytes);
-        if (error) return error;
+        if (nbytes >= PAGE_SIZE)
+               nbytes = PAGE_SIZE-1;
 
         page = (char *)__get_free_page(GFP_KERNEL);
-        if (page == NULL) return -ENOMEM;
-
-        incoming = 0;
-        tmp = buff;
-        while(incoming < nbytes){
-                if (get_user(c, tmp++)) return -EFAULT;
-                incoming++;
-                if (c == '\0' || c == '\n')
-                        break;
-        }
+        if (!page)
+               return -ENOMEM;
 
-        retval = copy_from_user(page, buff, incoming);
-        if (retval != 0) {
-                printk("mpoa: proc_mpc_write: copy_from_user() failed\n");
-                return -EFAULT;
+        for (p = page, len = 0; len < nbytes; p++, len++) {
+                if (get_user(*p, buff++)) {
+                       free_page((unsigned long)page);
+                       return -EFAULT;
+               }
+                if (*p == '\0' || *p == '\n')
+                        break;
         }
 
-        *ppos += incoming;
+        *p = '\0';
 
-        page[incoming] = '\0';
-       retval = parse_qos(page, incoming);
-        if (retval == 0)
+       if (!parse_qos(page))
                 printk("mpoa: proc_mpc_write: could not parse '%s'\n", page);
 
         free_page((unsigned long)page);
         
-        return nbytes;
+        return len;
 }
 
-static int parse_qos(const char *buff, int len)
+static int parse_qos(const char *buff)
 {
         /* possible lines look like this
          * add 130.230.54.142 tx=max_pcr,max_sdu rx=max_pcr,max_sdu
          */
-        
-        int pos, i;
-        uint32_t ipaddr;
         unsigned char ip[4]; 
-        char cmd[4], temp[256];
-        const char *tmp, *prev;
+       int tx_pcr, tx_sdu, rx_pcr, rx_sdu;
+        uint32_t ipaddr;
        struct atm_qos qos; 
-       int value[5];
         
         memset(&qos, 0, sizeof(struct atm_qos));
-        strlcpy(cmd, buff, sizeof(cmd));
-        if( strncmp(cmd,"add", 3) &&  strncmp(cmd,"del", 3))
-               return 0;  /* not add or del */
-
-       pos = 4;
-        /* next parse ip */
-        prev = buff + pos;
-        for (i = 0; i < 3; i++) {
-                tmp = strchr(prev, '.');
-                if (tmp == NULL) return 0;
-                memset(temp, '\0', 256);
-                memcpy(temp, prev, tmp-prev);
-                ip[i] = (char)simple_strtoul(temp, NULL, 0);
-               tmp ++; 
-               prev = tmp;
-        }
-       tmp = strchr(prev, ' ');
-        if (tmp == NULL) return 0;
-        memset(temp, '\0', 256);
-        memcpy(temp, prev, tmp-prev);
-        ip[i] = (char)simple_strtoul(temp, NULL, 0);
-        ipaddr = *(uint32_t *)ip;
-                
-       if(!strncmp(cmd, "del", 3))
-                return atm_mpoa_delete_qos(atm_mpoa_search_qos(ipaddr));
-
-        /* next transmit values */
-       tmp = strstr(buff, "tx=");
-       if(tmp == NULL) return 0;
-       tmp += 3;
-       prev = tmp;
-       for( i = 0; i < 1; i++){
-                tmp = strchr(prev, ',');
-                if (tmp == NULL) return 0;
-                memset(temp, '\0', 256);
-                memcpy(temp, prev, tmp-prev);
-                value[i] = (int)simple_strtoul(temp, NULL, 0);
-                tmp ++; 
-                prev = tmp;
+
+       if (sscanf(buff, "del %hhu.%hhu.%hhu.%hhu",
+                       ip, ip+1, ip+2, ip+3) == 4) {
+               ipaddr = *(uint32_t *)ip;
+               return atm_mpoa_delete_qos(atm_mpoa_search_qos(ipaddr));
        }
-       tmp = strchr(prev, ' ');
-        if (tmp == NULL) return 0;
-       memset(temp, '\0', 256);
-        memcpy(temp, prev, tmp-prev);
-        value[i] = (int)simple_strtoul(temp, NULL, 0);
+
+       if (sscanf(buff, "add %hhu.%hhu.%hhu.%hhu tx=%d,%d rx=tx",
+                       ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu) == 6) {
+               rx_pcr = tx_pcr;
+               rx_sdu = tx_sdu;
+       } else if (sscanf(buff, "add %hhu.%hhu.%hhu.%hhu tx=%d,%d rx=%d,%d",
+               ip, ip+1, ip+2, ip+3, &tx_pcr, &tx_sdu, &rx_pcr, &rx_sdu) != 8)
+               return 0;
+
+        ipaddr = *(uint32_t *)ip;
        qos.txtp.traffic_class = ATM_CBR;
-       qos.txtp.max_pcr = value[0];
-       qos.txtp.max_sdu = value[1];
-
-        /* next receive values */
-       tmp = strstr(buff, "rx=");
-       if(tmp == NULL) return 0;
-        if (strstr(buff, "rx=tx")) { /* rx == tx */
-                qos.rxtp.traffic_class = qos.txtp.traffic_class;
-                qos.rxtp.max_pcr = qos.txtp.max_pcr;
-                qos.rxtp.max_cdv = qos.txtp.max_cdv;
-                qos.rxtp.max_sdu = qos.txtp.max_sdu;
-        } else {
-                tmp += 3;
-                prev = tmp;
-                for( i = 0; i < 1; i++){
-                        tmp = strchr(prev, ',');
-                        if (tmp == NULL) return 0;
-                        memset(temp, '\0', 256);
-                        memcpy(temp, prev, tmp-prev);
-                        value[i] = (int)simple_strtoul(temp, NULL, 0);
-                        tmp ++; 
-                        prev = tmp;
-                }
-                tmp = strchr(prev, '\0');
-                if (tmp == NULL) return 0;
-                memset(temp, '\0', 256);
-                memcpy(temp, prev, tmp-prev);
-                value[i] = (int)simple_strtoul(temp, NULL, 0);
-                qos.rxtp.traffic_class = ATM_CBR;
-                qos.rxtp.max_pcr = value[0];
-                qos.rxtp.max_sdu = value[1];
-        }
+       qos.txtp.max_pcr = tx_pcr;
+       qos.txtp.max_sdu = tx_sdu;
+       qos.rxtp.traffic_class = ATM_CBR;
+       qos.rxtp.max_pcr = rx_pcr;
+       qos.rxtp.max_sdu = rx_sdu;
         qos.aal = ATM_AAL5;
        dprintk("mpoa: mpoa_proc.c: parse_qos(): setting qos paramameters to tx=%d,%d rx=%d,%d\n",
                qos.txtp.max_pcr,
index 6bc3a43..6929490 100644 (file)
@@ -20,6 +20,7 @@ menuconfig BT
             RFCOMM Module (RFCOMM Protocol)  
             BNEP Module (Bluetooth Network Encapsulation Protocol)
             CMTP Module (CAPI Message Transport Protocol)
+            HIDP Module (Human Interface Device Protocol)
 
          Say Y here to compile Bluetooth support into the kernel or say M to
          compile it as module (bluetooth).
index a2912da..f53a8b0 100644 (file)
@@ -323,14 +323,11 @@ static int __rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst,
 
 int rfcomm_dlc_open(struct rfcomm_dlc *d, bdaddr_t *src, bdaddr_t *dst, u8 channel)
 {
-       mm_segment_t fs;
        int r;
 
        rfcomm_lock();
 
-       fs = get_fs(); set_fs(KERNEL_DS);
        r = __rfcomm_dlc_open(d, src, dst, channel);
-       set_fs(fs);
 
        rfcomm_unlock();
        return r;
@@ -376,14 +373,11 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
 
 int rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
 {
-       mm_segment_t fs;
        int r;
 
        rfcomm_lock();
 
-       fs = get_fs(); set_fs(KERNEL_DS);
        r = __rfcomm_dlc_close(d, err);
-       set_fs(fs);
 
        rfcomm_unlock();
        return r;
@@ -552,9 +546,8 @@ struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *
 {
        struct rfcomm_session *s = NULL;
        struct sockaddr_l2 addr;
-       struct l2cap_options opts;
        struct socket *sock;
-       int    size;
+       struct sock *sk;
 
        BT_DBG("%s %s", batostr(src), batostr(dst));
 
@@ -570,11 +563,10 @@ struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst, int *
                goto failed;
 
        /* Set L2CAP options */
-       size = sizeof(opts);
-       sock->ops->getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, &size);
-       
-       opts.imtu = RFCOMM_MAX_L2CAP_MTU;
-       sock->ops->setsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, size);
+       sk = sock->sk;
+       lock_sock(sk);
+       l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
+       release_sock(sk);
 
        s = rfcomm_session_add(sock, BT_BOUND);
        if (!s) {
@@ -612,16 +604,14 @@ void rfcomm_session_getaddr(struct rfcomm_session *s, bdaddr_t *src, bdaddr_t *d
 static int rfcomm_send_frame(struct rfcomm_session *s, u8 *data, int len)
 {
        struct socket *sock = s->sock;
-       struct iovec iv = { data, len };
+       struct kvec iv = { data, len };
        struct msghdr msg;
 
        BT_DBG("session %p len %d", s, len);
 
        memset(&msg, 0, sizeof(msg));
-       msg.msg_iovlen = 1;
-       msg.msg_iov = &iv;
 
-       return sock_sendmsg(sock, &msg, len);
+       return kernel_sendmsg(sock, &msg, &iv, 1, len);
 }
 
 static int rfcomm_send_sabm(struct rfcomm_session *s, u8 dlci)
@@ -905,7 +895,7 @@ static int rfcomm_send_fcon(struct rfcomm_session *s, int cr)
 static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int len)
 {
        struct socket *sock = s->sock;
-       struct iovec iv[3];
+       struct kvec iv[3];
        struct msghdr msg;
        unsigned char hdr[5], crc[1];
 
@@ -930,10 +920,8 @@ static int rfcomm_send_test(struct rfcomm_session *s, int cr, u8 *pattern, int l
        iv[2].iov_len  = 1;
 
        memset(&msg, 0, sizeof(msg));
-       msg.msg_iovlen = 3;
-       msg.msg_iov = iv;
 
-       return sock_sendmsg(sock, &msg, 6 + len);
+       return kernel_sendmsg(sock, &msg, iv, 3, 6 + len);
 }
 
 static int rfcomm_send_credits(struct rfcomm_session *s, u8 addr, u8 credits)
@@ -1749,10 +1737,10 @@ static void rfcomm_worker(void)
 static int rfcomm_add_listener(bdaddr_t *ba)
 {
        struct sockaddr_l2 addr;
-       struct l2cap_options opts;
        struct socket *sock;
+       struct sock *sk;
        struct rfcomm_session *s;
-       int    size, err = 0;
+       int    err = 0;
 
        /* Create socket */
        err = rfcomm_l2sock_create(&sock);
@@ -1772,11 +1760,10 @@ static int rfcomm_add_listener(bdaddr_t *ba)
        }
 
        /* Set L2CAP options */
-       size = sizeof(opts);
-       sock->ops->getsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, &size);
-
-       opts.imtu = RFCOMM_MAX_L2CAP_MTU;
-       sock->ops->setsockopt(sock, SOL_L2CAP, L2CAP_OPTIONS, (void *)&opts, size);
+       sk = sock->sk;
+       lock_sock(sk);
+       l2cap_pi(sk)->imtu = RFCOMM_MAX_L2CAP_MTU;
+       release_sock(sk);
 
        /* Start listening on the socket */
        err = sock->ops->listen(sock, 10);
@@ -1820,8 +1807,6 @@ static int rfcomm_run(void *unused)
        set_user_nice(current, -10);
        current->flags |= PF_NOFREEZE;
 
-       set_fs(KERNEL_DS);
-
        BT_DBG("");
 
        rfcomm_add_listener(BDADDR_ANY);
index e91f80f..44a9762 100644 (file)
@@ -28,43 +28,28 @@ static struct net_device_stats *br_dev_get_stats(struct net_device *dev)
        return &br->statistics;
 }
 
-static int __br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
+int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       struct net_bridge *br;
-       unsigned char *dest;
+       struct net_bridge *br = netdev_priv(dev);
+       const unsigned char *dest = skb->data;
        struct net_bridge_fdb_entry *dst;
 
-       br = dev->priv;
        br->statistics.tx_packets++;
        br->statistics.tx_bytes += skb->len;
 
-       dest = skb->mac.raw = skb->data;
+       skb->mac.raw = skb->data;
        skb_pull(skb, ETH_HLEN);
 
-       if (dest[0] & 1) {
+       rcu_read_lock();
+       if (dest[0] & 1) 
                br_flood_deliver(br, skb, 0);
-               return 0;
-       }
-
-       if ((dst = br_fdb_get(br, dest)) != NULL) {
+       else if ((dst = __br_fdb_get(br, dest)) != NULL)
                br_deliver(dst->dst, skb);
-               br_fdb_put(dst);
-               return 0;
-       }
-
-       br_flood_deliver(br, skb, 0);
-       return 0;
-}
-
-int br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-       int ret;
+       else
+               br_flood_deliver(br, skb, 0);
 
-       rcu_read_lock();
-       ret = __br_dev_xmit(skb, dev);
        rcu_read_unlock();
-
-       return ret;
+       return 0;
 }
 
 static int br_dev_open(struct net_device *dev)
index 324489d..9406999 100644 (file)
@@ -73,9 +73,9 @@ static __inline__ int br_mac_hash(const unsigned char *mac)
 
 static __inline__ void fdb_delete(struct net_bridge_fdb_entry *f)
 {
-       hlist_del(&f->hlist);
+       hlist_del_rcu(&f->hlist);
        if (!f->is_static)
-               list_del(&f->age_list);
+               list_del(&f->u.age_list);
 
        br_fdb_put(f);
 }
@@ -85,7 +85,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
        struct net_bridge *br = p->br;
        int i;
        
-       write_lock_bh(&br->hash_lock);
+       spin_lock_bh(&br->hash_lock);
 
        /* Search all chains since old address/hash is unknown */
        for (i = 0; i < BR_HASH_SIZE; i++) {
@@ -117,7 +117,7 @@ void br_fdb_changeaddr(struct net_bridge_port *p, const unsigned char *newaddr)
        fdb_insert(br, p, newaddr, 1);
 
 
-       write_unlock_bh(&br->hash_lock);
+       spin_unlock_bh(&br->hash_lock);
 }
 
 void br_fdb_cleanup(unsigned long _data)
@@ -126,13 +126,15 @@ void br_fdb_cleanup(unsigned long _data)
        struct list_head *l, *n;
        unsigned long delay;
 
-       write_lock_bh(&br->hash_lock);
+       spin_lock_bh(&br->hash_lock);
        delay = hold_time(br);
 
        list_for_each_safe(l, n, &br->age_list) {
-               struct net_bridge_fdb_entry *f
-                       = list_entry(l, struct net_bridge_fdb_entry, age_list);
-               unsigned long expires = f->ageing_timer + delay;
+               struct net_bridge_fdb_entry *f;
+               unsigned long expires;
+
+               f = list_entry(l, struct net_bridge_fdb_entry, u.age_list);
+               expires = f->ageing_timer + delay;
 
                if (time_before_eq(expires, jiffies)) {
                        WARN_ON(f->is_static);
@@ -144,14 +146,14 @@ void br_fdb_cleanup(unsigned long _data)
                        break;
                }
        }
-       write_unlock_bh(&br->hash_lock);
+       spin_unlock_bh(&br->hash_lock);
 }
 
 void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
 {
        int i;
 
-       write_lock_bh(&br->hash_lock);
+       spin_lock_bh(&br->hash_lock);
        for (i = 0; i < BR_HASH_SIZE; i++) {
                struct hlist_node *h, *g;
                
@@ -182,37 +184,53 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
                skip_delete: ;
                }
        }
-       write_unlock_bh(&br->hash_lock);
+       spin_unlock_bh(&br->hash_lock);
 }
 
-struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, unsigned char *addr)
+/* No locking or refcounting, assumes caller has no preempt (rcu_read_lock) */
+struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
+                                         const unsigned char *addr)
 {
        struct hlist_node *h;
+       struct net_bridge_fdb_entry *fdb;
 
-       read_lock_bh(&br->hash_lock);
-               
-       hlist_for_each(h, &br->hash[br_mac_hash(addr)]) {
-               struct net_bridge_fdb_entry *fdb
-                       = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
-
+       hlist_for_each_entry_rcu(fdb, h, &br->hash[br_mac_hash(addr)], hlist) {
                if (!memcmp(fdb->addr.addr, addr, ETH_ALEN)) {
-                       if (has_expired(br, fdb))
-                               goto ret_null;
-
-                       atomic_inc(&fdb->use_count);
-                       read_unlock_bh(&br->hash_lock);
+                       if (unlikely(has_expired(br, fdb)))
+                               break;
                        return fdb;
                }
        }
- ret_null:
-       read_unlock_bh(&br->hash_lock);
+
        return NULL;
 }
 
+/* Interface used by ATM hook that keeps a ref count */
+struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br, 
+                                       unsigned char *addr)
+{
+       struct net_bridge_fdb_entry *fdb;
+
+       rcu_read_lock();
+       fdb = __br_fdb_get(br, addr);
+       if (fdb) 
+               atomic_inc(&fdb->use_count);
+       rcu_read_unlock();
+       return fdb;
+}
+
+static void fdb_rcu_free(struct rcu_head *head)
+{
+       struct net_bridge_fdb_entry *ent
+               = container_of(head, struct net_bridge_fdb_entry, u.rcu);
+       kmem_cache_free(br_fdb_cache, ent);
+}
+
+/* Set entry up for deletion with RCU  */
 void br_fdb_put(struct net_bridge_fdb_entry *ent)
 {
        if (atomic_dec_and_test(&ent->use_count))
-               kmem_cache_free(br_fdb_cache, ent);
+               call_rcu(&ent->u.rcu, fdb_rcu_free);
 }
 
 /*
@@ -229,9 +247,9 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
 
        memset(buf, 0, maxnum*sizeof(struct __fdb_entry));
 
-       read_lock_bh(&br->hash_lock);
+       rcu_read_lock();
        for (i = 0; i < BR_HASH_SIZE; i++) {
-               hlist_for_each_entry(f, h, &br->hash[i], hlist) {
+               hlist_for_each_entry_rcu(f, h, &br->hash[i], hlist) {
                        if (num >= maxnum)
                                goto out;
 
@@ -255,7 +273,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
        }
 
  out:
-       read_unlock_bh(&br->hash_lock);
+       rcu_read_unlock();
 
        return num;
 }
@@ -298,7 +316,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
                                return 0;
 
                        /* move to end of age list */
-                       list_del(&fdb->age_list);
+                       list_del(&fdb->u.age_list);
                        goto update;
                }
        }
@@ -309,7 +327,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 
        memcpy(fdb->addr.addr, addr, ETH_ALEN);
        atomic_set(&fdb->use_count, 1);
-       hlist_add_head(&fdb->hlist, &br->hash[hash]);
+       hlist_add_head_rcu(&fdb->hlist, &br->hash[hash]);
 
        if (!timer_pending(&br->gc_timer)) {
                br->gc_timer.expires = jiffies + hold_time(br);
@@ -322,7 +340,7 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
        fdb->is_static = is_local;
        fdb->ageing_timer = jiffies;
        if (!is_local) 
-               list_add_tail(&fdb->age_list, &br->age_list);
+               list_add_tail(&fdb->u.age_list, &br->age_list);
 
        return 0;
 }
@@ -332,8 +350,8 @@ int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 {
        int ret;
 
-       write_lock_bh(&br->hash_lock);
+       spin_lock_bh(&br->hash_lock);
        ret = fdb_insert(br, source, addr, is_local);
-       write_unlock_bh(&br->hash_lock);
+       spin_unlock_bh(&br->hash_lock);
        return ret;
 }
index fd5fa75..ef9f209 100644 (file)
@@ -23,7 +23,6 @@ static inline int should_deliver(const struct net_bridge_port *p,
                                 const struct sk_buff *skb)
 {
        if (skb->dev == p->dev ||
-           skb->len > p->dev->mtu ||
            p->state != BR_STATE_FORWARDING)
                return 0;
 
@@ -32,13 +31,17 @@ static inline int should_deliver(const struct net_bridge_port *p,
 
 int br_dev_queue_push_xmit(struct sk_buff *skb)
 {
+       if (skb->len > skb->dev->mtu) 
+               kfree_skb(skb);
+       else {
 #ifdef CONFIG_BRIDGE_NETFILTER
-       /* ip_refrag calls ip_fragment, which doesn't copy the MAC header. */
-       nf_bridge_maybe_copy_header(skb);
+               /* ip_refrag calls ip_fragment, doesn't copy the MAC header. */
+               nf_bridge_maybe_copy_header(skb);
 #endif
-       skb_push(skb, ETH_HLEN);
+               skb_push(skb, ETH_HLEN);
 
-       dev_queue_xmit(skb);
+               dev_queue_xmit(skb);
+       }
 
        return 0;
 }
index 092d451..43d0373 100644 (file)
@@ -149,7 +149,7 @@ static struct net_device *new_bridge_dev(const char *name)
 
        br->lock = SPIN_LOCK_UNLOCKED;
        INIT_LIST_HEAD(&br->port_list);
-       br->hash_lock = RW_LOCK_UNLOCKED;
+       br->hash_lock = SPIN_LOCK_UNLOCKED;
 
        br->bridge_id.prio[0] = 0x80;
        br->bridge_id.prio[1] = 0x00;
@@ -295,6 +295,7 @@ int br_del_bridge(const char *name)
        return ret;
 }
 
+/* Mtu of the bridge pseudo-device 1500 or the minimum of the ports */
 int br_min_mtu(const struct net_bridge *br)
 {
        const struct net_bridge_port *p;
@@ -343,11 +344,12 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
                spin_lock_bh(&br->lock);
                br_stp_recalculate_bridge_id(br);
-               if ((br->dev->flags & IFF_UP) && (dev->flags & IFF_UP))
+               if ((br->dev->flags & IFF_UP) 
+                   && (dev->flags & IFF_UP) && netif_carrier_ok(dev))
                        br_stp_enable_port(p);
                spin_unlock_bh(&br->lock);
 
-               br->dev->mtu = br_min_mtu(br);
+               dev_set_mtu(br->dev, br_min_mtu(br));
        }
 
        return err;
index 5c88a71..d0702fb 100644 (file)
 
 static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr);
 
-struct notifier_block br_device_notifier =
-{
+struct notifier_block br_device_notifier = {
        .notifier_call = br_device_event
 };
 
+/*
+ * Handle changes in state of network devices enslaved to a bridge.
+ * 
+ * Note: don't care about up/down if bridge itself is down, because
+ *     port state is checked when bridge is brought up.
+ */
 static int br_device_event(struct notifier_block *unused, unsigned long event, void *ptr)
 {
-       struct net_device *dev;
-       struct net_bridge_port *p;
+       struct net_device *dev = ptr;
+       struct net_bridge_port *p = dev->br_port;
        struct net_bridge *br;
 
-       dev = ptr;
-       p = dev->br_port;
-
+       /* not a port of a bridge */
        if (p == NULL)
                return NOTIFY_DONE;
 
        br = p->br;
 
+       spin_lock_bh(&br->lock);
        switch (event) {
+       case NETDEV_CHANGEMTU:
+               dev_set_mtu(br->dev, br_min_mtu(br));
+               break;
+
        case NETDEV_CHANGEADDR:
-               spin_lock_bh(&br->lock);
                br_fdb_changeaddr(p, dev->dev_addr);
-               if (br->dev->flags & IFF_UP)
-                       br_stp_recalculate_bridge_id(br);
-               spin_unlock_bh(&br->lock);
+               br_stp_recalculate_bridge_id(br);
                break;
 
-       case NETDEV_CHANGEMTU:
-               br->dev->mtu = br_min_mtu(br);
+       case NETDEV_CHANGE:     /* device is up but carrier changed */
+               if (!(br->dev->flags & IFF_UP))
+                       break;
+
+               if (netif_carrier_ok(dev)) {
+                       if (p->state == BR_STATE_DISABLED)
+                               br_stp_enable_port(p);
+               } else {
+                       if (p->state != BR_STATE_DISABLED)
+                               br_stp_disable_port(p);
+               }
                break;
 
        case NETDEV_DOWN:
-               if (br->dev->flags & IFF_UP) {
-                       spin_lock_bh(&br->lock);
+               if (br->dev->flags & IFF_UP)
                        br_stp_disable_port(p);
-                       spin_unlock_bh(&br->lock);
-               }
                break;
 
        case NETDEV_UP:
-               if (br->dev->flags & IFF_UP) {
-                       spin_lock_bh(&br->lock);
+               if (netif_carrier_ok(dev) && (br->dev->flags & IFF_UP)) 
                        br_stp_enable_port(p);
-                       spin_unlock_bh(&br->lock);
-               }
                break;
 
        case NETDEV_UNREGISTER:
                br_del_if(br, dev);
                break;
-       }
+       } 
+       spin_unlock_bh(&br->lock);
 
        return NOTIFY_DONE;
 }
index 1064d4c..d2b2fb2 100644 (file)
@@ -46,7 +46,10 @@ struct net_bridge_fdb_entry
 {
        struct hlist_node               hlist;
        struct net_bridge_port          *dst;
-       struct list_head                age_list;
+       union {
+               struct list_head        age_list;
+               struct rcu_head         rcu;
+       } u;
        atomic_t                        use_count;
        unsigned long                   ageing_timer;
        mac_addr                        addr;
@@ -86,7 +89,7 @@ struct net_bridge
        struct list_head                port_list;
        struct net_device               *dev;
        struct net_device_stats         statistics;
-       rwlock_t                        hash_lock;
+       spinlock_t                      hash_lock;
        struct hlist_head               hash[BR_HASH_SIZE];
        struct list_head                age_list;
 
@@ -136,8 +139,10 @@ extern void br_fdb_changeaddr(struct net_bridge_port *p,
 extern void br_fdb_cleanup(unsigned long arg);
 extern void br_fdb_delete_by_port(struct net_bridge *br,
                           struct net_bridge_port *p);
+extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
+                                                const unsigned char *addr);
 extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
-                                       unsigned char *addr);
+                                              unsigned char *addr);
 extern void br_fdb_put(struct net_bridge_fdb_entry *ent);
 extern int br_fdb_fillbuf(struct net_bridge *br, void *buf, 
                          unsigned long count, unsigned long off);
index d9d6a95..04ca063 100644 (file)
@@ -299,7 +299,7 @@ void br_topology_change_detection(struct net_bridge *br)
        int isroot = br_is_root_bridge(br);
 
        pr_info("%s: topology change detected, %s\n", br->dev->name,
-               isroot ? "propgating" : "sending tcn bpdu");
+               isroot ? "propagating" : "sending tcn bpdu");
 
        if (isroot) {
                br->topology_change = 1;
index 9e1d296..6c08fef 100644 (file)
@@ -52,7 +52,7 @@ void br_stp_enable_bridge(struct net_bridge *br)
        br_config_bpdu_generation(br);
 
        list_for_each_entry(p, &br->port_list, list) {
-               if (p->dev->flags & IFF_UP)
+               if ((p->dev->flags & IFF_UP) && netif_carrier_ok(p->dev))
                        br_stp_enable_port(p);
 
        }
index 1e21cd9..90ac1a1 100644 (file)
@@ -216,11 +216,6 @@ static struct notifier_block *netdev_chain;
  */
 DEFINE_PER_CPU(struct softnet_data, softnet_data) = { 0, };
 
-#ifdef CONFIG_NET_FASTROUTE
-int netdev_fastroute;
-int netdev_fastroute_obstacles;
-#endif
-
 #ifdef CONFIG_SYSFS
 extern int netdev_sysfs_init(void);
 extern int netdev_register_sysfs(struct net_device *);
@@ -280,12 +275,6 @@ void dev_add_pack(struct packet_type *pt)
        int hash;
 
        spin_lock_bh(&ptype_lock);
-#ifdef CONFIG_NET_FASTROUTE
-       if (pt->af_packet_priv) {
-               netdev_fastroute_obstacles++;
-               dev_clear_fastroute(pt->dev);
-       }
-#endif
        if (pt->type == htons(ETH_P_ALL)) {
                netdev_nit++;
                list_add_rcu(&pt->list, &ptype_all);
@@ -328,10 +317,6 @@ void __dev_remove_pack(struct packet_type *pt)
 
        list_for_each_entry(pt1, head, list) {
                if (pt == pt1) {
-#ifdef CONFIG_NET_FASTROUTE
-                       if (pt->af_packet_priv)
-                               netdev_fastroute_obstacles--;
-#endif
                        list_del_rcu(&pt->list);
                        goto out;
                }
@@ -973,39 +958,6 @@ int dev_open(struct net_device *dev)
        return ret;
 }
 
-#ifdef CONFIG_NET_FASTROUTE
-
-static void dev_do_clear_fastroute(struct net_device *dev)
-{
-       if (dev->accept_fastpath) {
-               int i;
-
-               for (i = 0; i <= NETDEV_FASTROUTE_HMASK; i++) {
-                       struct dst_entry *dst;
-
-                       write_lock_irq(&dev->fastpath_lock);
-                       dst = dev->fastpath[i];
-                       dev->fastpath[i] = NULL;
-                       write_unlock_irq(&dev->fastpath_lock);
-
-                       dst_release(dst);
-               }
-       }
-}
-
-void dev_clear_fastroute(struct net_device *dev)
-{
-       if (dev) {
-               dev_do_clear_fastroute(dev);
-       } else {
-               read_lock(&dev_base_lock);
-               for (dev = dev_base; dev; dev = dev->next)
-                       dev_do_clear_fastroute(dev);
-               read_unlock(&dev_base_lock);
-       }
-}
-#endif
-
 /**
  *     dev_close - shutdown an interface.
  *     @dev: device to shutdown
@@ -1058,9 +1010,6 @@ int dev_close(struct net_device *dev)
         */
 
        dev->flags &= ~IFF_UP;
-#ifdef CONFIG_NET_FASTROUTE
-       dev_clear_fastroute(dev);
-#endif
 
        /*
         * Tell people we are down
@@ -1322,6 +1271,13 @@ int __skb_linearize(struct sk_buff *skb, int gfp_mask)
        }                                               \
 }
 
+static inline void qdisc_run(struct net_device *dev)
+{
+       while (!netif_queue_stopped(dev) &&
+              qdisc_restart(dev)<0)
+               /* NOTHING */;
+}
+
 /**
  *     dev_queue_xmit - transmit a buffer
  *     @skb: buffer to transmit
@@ -1822,13 +1778,6 @@ int netif_receive_skb(struct sk_buff *skb)
 
        __get_cpu_var(netdev_rx_stat).total++;
 
-#ifdef CONFIG_NET_FASTROUTE
-       if (skb->pkt_type == PACKET_FASTROUTE) {
-               __get_cpu_var(netdev_rx_stat).fastroute_deferred_out++;
-               return dev_queue_xmit(skb);
-       }
-#endif
-
        skb->h.raw = skb->nh.raw = skb->data;
        skb->mac_len = skb->nh.raw - skb->mac.raw;
 
@@ -2368,13 +2317,6 @@ void dev_set_promiscuity(struct net_device *dev, int inc)
        if ((dev->promiscuity += inc) == 0)
                dev->flags &= ~IFF_PROMISC;
        if (dev->flags ^ old_flags) {
-#ifdef CONFIG_NET_FASTROUTE
-               if (dev->flags & IFF_PROMISC) {
-                       netdev_fastroute_obstacles++;
-                       dev_clear_fastroute(dev);
-               } else
-                       netdev_fastroute_obstacles--;
-#endif
                dev_mc_upload(dev);
                printk(KERN_INFO "device %s %s promiscuous mode\n",
                       dev->name, (dev->flags & IFF_PROMISC) ? "entered" :
@@ -2927,10 +2869,6 @@ int register_netdevice(struct net_device *dev)
        spin_lock_init(&dev->ingress_lock);
 #endif
 
-#ifdef CONFIG_NET_FASTROUTE
-       dev->fastpath_lock = RW_LOCK_UNLOCKED;
-#endif
-
        ret = alloc_divert_blk(dev);
        if (ret)
                goto out;
@@ -3036,7 +2974,6 @@ static void netdev_wait_allrefs(struct net_device *dev)
        while (atomic_read(&dev->refcnt) != 0) {
                if (time_after(jiffies, rebroadcast_time + 1 * HZ)) {
                        rtnl_shlock();
-                       rtnl_exlock();
 
                        /* Rebroadcast unregister notification */
                        notifier_call_chain(&netdev_chain,
@@ -3053,7 +2990,6 @@ static void netdev_wait_allrefs(struct net_device *dev)
                                linkwatch_run_queue();
                        }
 
-                       rtnl_exunlock();
                        rtnl_shunlock();
 
                        rebroadcast_time = jiffies;
@@ -3251,10 +3187,6 @@ int unregister_netdevice(struct net_device *dev)
 
        synchronize_net();
 
-#ifdef CONFIG_NET_FASTROUTE
-       dev_clear_fastroute(dev);
-#endif
-
        /* Shutdown queueing discipline. */
        dev_shutdown(dev);
 
@@ -3428,6 +3360,8 @@ EXPORT_SYMBOL(dev_queue_xmit_nit);
 EXPORT_SYMBOL(dev_remove_pack);
 EXPORT_SYMBOL(dev_set_allmulti);
 EXPORT_SYMBOL(dev_set_promiscuity);
+EXPORT_SYMBOL(dev_change_flags);
+EXPORT_SYMBOL(dev_set_mtu);
 EXPORT_SYMBOL(free_netdev);
 EXPORT_SYMBOL(netdev_boot_setup_check);
 EXPORT_SYMBOL(netdev_set_master);
@@ -3445,10 +3379,7 @@ EXPORT_SYMBOL(unregister_netdevice_notifier);
 #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
 EXPORT_SYMBOL(br_handle_frame_hook);
 #endif
-/* for 801q VLAN support */
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
-EXPORT_SYMBOL(dev_change_flags);
-#endif
+
 #ifdef CONFIG_KMOD
 EXPORT_SYMBOL(dev_load);
 #endif
@@ -3458,10 +3389,6 @@ EXPORT_SYMBOL(netdev_fc_xoff);
 EXPORT_SYMBOL(netdev_register_fc);
 EXPORT_SYMBOL(netdev_unregister_fc);
 #endif
-#ifdef CONFIG_NET_FASTROUTE
-EXPORT_SYMBOL(netdev_fastroute);
-EXPORT_SYMBOL(netdev_fastroute_obstacles);
-#endif
 
 #ifdef CONFIG_NET_CLS_ACT
 EXPORT_SYMBOL(ing_filter);
index b385cc8..d1a62cd 100644 (file)
@@ -56,6 +56,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -1409,7 +1410,7 @@ module_exit(cleanup);
 MODULE_AUTHOR("Robert Olsson <robert.olsson@its.uu.se");
 MODULE_DESCRIPTION("Packet Generator tool");
 MODULE_LICENSE("GPL");
-MODULE_PARM(count_d, "i");
-MODULE_PARM(ipg_d, "i");
-MODULE_PARM(cpu_speed, "i");
-MODULE_PARM(clone_skb_d, "i");
+module_param(count_d, int, 0);
+module_param(ipg_d, int, 0);
+module_param(cpu_speed, int, 0);
+module_param(clone_skb_d, int, 0);
index e652d8f..e0b5e89 100644 (file)
@@ -56,12 +56,10 @@ DECLARE_MUTEX(rtnl_sem);
 void rtnl_lock(void)
 {
        rtnl_shlock();
-       rtnl_exlock();
 }
  
 void rtnl_unlock(void)
 {
-       rtnl_exunlock();
        rtnl_shunlock();
 
        netdev_run_todo();
@@ -337,7 +335,6 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
        struct rtnetlink_link *link_tab;
        struct rtattr   *rta[RTATTR_MAX];
 
-       int exclusive = 0;
        int sz_idx, kind;
        int min_len;
        int family;
@@ -404,14 +401,6 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
                return -1;
        }
 
-       if (kind != 2) {
-               if (rtnl_exlock_nowait()) {
-                       *errp = 0;
-                       return -1;
-               }
-               exclusive = 1;
-       }
-
        memset(&rta, 0, sizeof(rta));
 
        min_len = rtm_min[sz_idx];
@@ -439,14 +428,10 @@ rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, int *errp)
                goto err_inval;
        err = link->doit(skb, nlh, (void *)&rta);
 
-       if (exclusive)
-               rtnl_exunlock();
        *errp = err;
        return err;
 
 err_inval:
-       if (exclusive)
-               rtnl_exunlock();
        *errp = -EINVAL;
        return -1;
 }
index 2df876a..b797886 100644 (file)
@@ -931,6 +931,70 @@ fault:
        return -EFAULT;
 }
 
+/* Keep iterating until skb_iter_next returns false. */
+void skb_iter_first(const struct sk_buff *skb, struct skb_iter *i)
+{
+       i->len = skb_headlen(skb);
+       i->data = (unsigned char *)skb->data;
+       i->nextfrag = 0;
+       i->fraglist = NULL;
+}
+
+int skb_iter_next(const struct sk_buff *skb, struct skb_iter *i)
+{
+       /* Unmap previous, if not head fragment. */
+       if (i->nextfrag)
+               kunmap_skb_frag(i->data);
+
+       if (i->fraglist) {
+       fraglist:
+               /* We're iterating through fraglist. */
+               if (i->nextfrag < skb_shinfo(i->fraglist)->nr_frags) {
+                       i->data = kmap_skb_frag(&skb_shinfo(i->fraglist)
+                                               ->frags[i->nextfrag]);
+                       i->len = skb_shinfo(i->fraglist)->frags[i->nextfrag]
+                               .size;
+                       i->nextfrag++;
+                       return 1;
+               }
+               /* Fragments with fragments?  Too hard! */
+               BUG_ON(skb_shinfo(i->fraglist)->frag_list);
+               i->fraglist = i->fraglist->next;
+               if (!i->fraglist)
+                       goto end;
+
+               i->len = skb_headlen(i->fraglist);
+               i->data = i->fraglist->data;
+               i->nextfrag = 0;
+               return 1;
+       }
+
+       if (i->nextfrag < skb_shinfo(skb)->nr_frags) {
+               i->data = kmap_skb_frag(&skb_shinfo(skb)->frags[i->nextfrag]);
+               i->len = skb_shinfo(skb)->frags[i->nextfrag].size;
+               i->nextfrag++;
+               return 1;
+       }
+
+       i->fraglist = skb_shinfo(skb)->frag_list;
+       if (i->fraglist)
+               goto fraglist;
+
+end:
+       /* Bug trap for callers */
+       i->data = NULL;
+       return 0;
+}
+
+void skb_iter_abort(const struct sk_buff *skb, struct skb_iter *i)
+{
+       /* Unmap previous, if not head fragment. */
+       if (i->data && i->nextfrag)
+               kunmap_skb_frag(i->data);
+       /* Bug trap for callers */
+       i->data = NULL;
+}
+
 /* Checksum skb data. */
 
 unsigned int skb_checksum(const struct sk_buff *skb, int offset,
@@ -1401,3 +1465,6 @@ EXPORT_SYMBOL(skb_queue_tail);
 EXPORT_SYMBOL(skb_unlink);
 EXPORT_SYMBOL(skb_append);
 EXPORT_SYMBOL(skb_split);
+EXPORT_SYMBOL(skb_iter_first);
+EXPORT_SYMBOL(skb_iter_next);
+EXPORT_SYMBOL(skb_iter_abort);
index 36e0a9e..d5b2d91 100644 (file)
@@ -658,14 +658,6 @@ void sk_free(struct sock *sk)
                printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n",
                       __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
 
-       /*
-        * If sendmsg cached page exists, toss it.
-        */
-       if (sk->sk_sndmsg_page) {
-               __free_page(sk->sk_sndmsg_page);
-               sk->sk_sndmsg_page = NULL;
-       }
-
        security_sk_free(sk);
        BUG_ON(sk->sk_vx_info);
        BUG_ON(sk->sk_nx_info);
@@ -1073,30 +1065,12 @@ int sock_no_mmap(struct file *file, struct socket *sock, struct vm_area_struct *
 ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags)
 {
        ssize_t res;
-       struct msghdr msg;
-       struct iovec iov;
-       mm_segment_t old_fs;
-       char *kaddr;
-
-       kaddr = kmap(page);
-
-       msg.msg_name = NULL;
-       msg.msg_namelen = 0;
-       msg.msg_iov = &iov;
-       msg.msg_iovlen = 1;
-       msg.msg_control = NULL;
-       msg.msg_controllen = 0;
-       msg.msg_flags = flags;
-
-       /* This cast is ok because of the "set_fs(KERNEL_DS)" */
-       iov.iov_base = (void __user *) (kaddr + offset);
+       struct msghdr msg = {.msg_flags = flags};
+       struct kvec iov;
+       char *kaddr = kmap(page);
+       iov.iov_base = kaddr + offset;
        iov.iov_len = size;
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       res = sock_sendmsg(sock, &msg, size);
-       set_fs(old_fs);
-
+       res = kernel_sendmsg(sock, &msg, &iov, 1, size);
        kunmap(page);
        return res;
 }
index 6b6e49a..11b0f0c 100644 (file)
@@ -161,7 +161,7 @@ static int min_priority[1];
 static int max_priority[] = { 127 }; /* From DECnet spec */
 
 static int dn_forwarding_proc(ctl_table *, int, struct file *,
-                       void __user *, size_t *);
+                       void __user *, size_t *, loff_t *);
 static int dn_forwarding_sysctl(ctl_table *table, int __user *name, int nlen,
                        void __user *oldval, size_t __user *oldlenp,
                        void __user *newval, size_t newlen,
@@ -362,7 +362,8 @@ static void dn_dev_check_default(struct net_device *dev)
 
 static int dn_forwarding_proc(ctl_table *table, int write, 
                                struct file *filep,
-                               void __user *buffer, size_t *lenp)
+                               void __user *buffer,
+                               size_t *lenp, loff_t *ppos)
 {
 #ifdef CONFIG_DECNET_ROUTER
        struct net_device *dev = table->extra1;
@@ -376,7 +377,7 @@ static int dn_forwarding_proc(ctl_table *table, int write,
        dn_db = dev->dn_ptr;
        old = dn_db->parms.forwarding;
 
-       err = proc_dointvec(table, write, filep, buffer, lenp);
+       err = proc_dointvec(table, write, filep, buffer, lenp, ppos);
 
        if ((err >= 0) && write) {
                if (dn_db->parms.forwarding < 0)
index 4c9d71f..07b4cff 100644 (file)
@@ -774,38 +774,22 @@ static int ec_queue_packet(struct sock *sk, struct sk_buff *skb,
 
 static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb)
 {
-       struct sockaddr_in sin;
-       struct iovec iov;
-       struct aunhdr ah;
+       struct sockaddr_in sin = {
+               .sin_family = AF_INET,
+               .sin_port = htons(AUN_PORT),
+               .sin_addr = {.s_addr = addr}
+       };
+       struct aunhdr ah = {.code = code, .cb = cb, .handle = seq};
+       struct kvec iov = {.iov_base = (void *)&ah, .iov_len = sizeof(ah)};
        struct msghdr udpmsg;
-       int err;
-       mm_segment_t oldfs;
        
-       memset(&sin, 0, sizeof(sin));
-       sin.sin_family = AF_INET;
-       sin.sin_port = htons(AUN_PORT);
-       sin.sin_addr.s_addr = addr;
-
-       ah.code = code;
-       ah.pad = 0;
-       ah.port = 0;
-       ah.cb = cb;
-       ah.handle = seq;
-
-       iov.iov_base = (void *)&ah;
-       iov.iov_len = sizeof(ah);
-
        udpmsg.msg_name = (void *)&sin;
        udpmsg.msg_namelen = sizeof(sin);
-       udpmsg.msg_iov = &iov;
-       udpmsg.msg_iovlen = 1;
        udpmsg.msg_control = NULL;
        udpmsg.msg_controllen = 0;
        udpmsg.msg_flags=0;
 
-       oldfs = get_fs(); set_fs(KERNEL_DS);
-       err = sock_sendmsg(udpsock, &udpmsg, sizeof(ah));
-       set_fs(oldfs);
+       kernel_sendmsg(udpsock, &udpmsg, &iov, 1, sizeof(ah));
 }
 
 
index 8289a1d..0fe409a 100644 (file)
@@ -6,7 +6,7 @@ obj-y     := utils.o route.o inetpeer.o protocol.o \
             ip_input.o ip_fragment.o ip_forward.o ip_options.o \
             ip_output.o ip_sockglue.o \
             tcp.o tcp_input.o tcp_output.o tcp_timer.o tcp_ipv4.o tcp_minisocks.o \
-            tcp_diag.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
+            tcp_diag.o datagram.o raw.o udp.o arp.o icmp.o devinet.o af_inet.o igmp.o \
             sysctl_net_ipv4.o fib_frontend.o fib_semantics.o fib_hash.o
 
 obj-$(CONFIG_PROC_FS) += proc.o
index 8c16b71..9784f03 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/config.h>
 #include <linux/module.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/ah.h>
@@ -73,9 +72,9 @@ static int ah_output(struct sk_buff **pskb)
        iph->tos = top_iph->tos;
        iph->ttl = top_iph->ttl;
        iph->frag_off = top_iph->frag_off;
-       iph->daddr = top_iph->daddr;
 
        if (top_iph->ihl != 5) {
+               iph->daddr = top_iph->daddr;
                memcpy(iph+1, top_iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
                err = ip_clear_mutable_options(top_iph, &top_iph->daddr);
                if (err)
@@ -104,9 +103,10 @@ static int ah_output(struct sk_buff **pskb)
        top_iph->tos = iph->tos;
        top_iph->ttl = iph->ttl;
        top_iph->frag_off = iph->frag_off;
-       top_iph->daddr = iph->daddr;
-       if (top_iph->ihl != 5)
+       if (top_iph->ihl != 5) {
+               top_iph->daddr = iph->daddr;
                memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
+       }
 
        ip_send_check(top_iph);
 
index b6f3840..c472a66 100644 (file)
@@ -426,7 +426,7 @@ static int arp_filter(__u32 sip, __u32 tip, struct net_device *dev)
        if (ip_route_output_key(&rt, &fl) < 0) 
                return 1;
        if (rt->u.dst.dev != dev) { 
-               NET_INC_STATS_BH(ArpFilter);
+               NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
                flag = 1;
        } 
        ip_rt_put(rt); 
index 2dc4e7a..4781dea 100644 (file)
@@ -1151,11 +1151,11 @@ void inet_forward_change(void)
 
 static int devinet_sysctl_forward(ctl_table *ctl, int write,
                                  struct file* filp, void __user *buffer,
-                                 size_t *lenp)
+                                 size_t *lenp, loff_t *ppos)
 {
        int *valp = ctl->data;
        int val = *valp;
-       int ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+       int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && *valp != val) {
                if (valp == &ipv4_devconf.forwarding)
@@ -1169,11 +1169,11 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
 
 int ipv4_doint_and_flush(ctl_table *ctl, int write,
                         struct file* filp, void __user *buffer,
-                        size_t *lenp)
+                        size_t *lenp, loff_t *ppos)
 {
        int *valp = ctl->data;
        int val = *valp;
-       int ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+       int ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && *valp != val)
                rt_cache_flush(0);
index 5dd38d2..07a594b 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/config.h>
 #include <linux/module.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/esp.h>
index 75c7952..1481f4a 100644 (file)
@@ -213,8 +213,8 @@ int sysctl_icmp_ratemask = 0x1818;
  */
 
 struct icmp_control {
-       int output_off;         /* Field offset for increment on output */
-       int input_off;          /* Field offset for increment on input */
+       int output_entry;       /* Field for increment on output */
+       int input_entry;        /* Field for increment on input */
        void (*handler)(struct sk_buff *skb);
        short   error;          /* This ICMP is classed as an error message */
 };
@@ -318,8 +318,8 @@ out:
 static void icmp_out_count(int type)
 {
        if (type <= NR_ICMP_TYPES) {
-               ICMP_INC_STATS_FIELD(icmp_pointers[type].output_off);
-               ICMP_INC_STATS(IcmpOutMsgs);
+               ICMP_INC_STATS(icmp_pointers[type].output_entry);
+               ICMP_INC_STATS(ICMP_MIB_OUTMSGS);
        }
 }
 
@@ -715,7 +715,7 @@ static void icmp_unreach(struct sk_buff *skb)
 out:
        return;
 out_err:
-       ICMP_INC_STATS_BH(IcmpInErrors);
+       ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
        goto out;
 }
 
@@ -756,7 +756,7 @@ static void icmp_redirect(struct sk_buff *skb)
 out:
        return;
 out_err:
-       ICMP_INC_STATS_BH(IcmpInErrors);
+       ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
        goto out;
 }
 
@@ -824,7 +824,7 @@ static void icmp_timestamp(struct sk_buff *skb)
 out:
        return;
 out_err:
-       ICMP_INC_STATS_BH(IcmpInErrors);
+       ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
        goto out;
 }
 
@@ -984,7 +984,7 @@ int icmp_rcv(struct sk_buff *skb)
        struct icmphdr *icmph;
        struct rtable *rt = (struct rtable *)skb->dst;
 
-       ICMP_INC_STATS_BH(IcmpInMsgs);
+       ICMP_INC_STATS_BH(ICMP_MIB_INMSGS);
 
        switch (skb->ip_summed) {
        case CHECKSUM_HW:
@@ -1036,14 +1036,14 @@ int icmp_rcv(struct sk_buff *skb)
                }
        }
 
-       ICMP_INC_STATS_BH_FIELD(icmp_pointers[icmph->type].input_off);
+       ICMP_INC_STATS_BH(icmp_pointers[icmph->type].input_entry);
        icmp_pointers[icmph->type].handler(skb);
 
 drop:
        kfree_skb(skb);
        return 0;
 error:
-       ICMP_INC_STATS_BH(IcmpInErrors);
+       ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
        goto drop;
 }
 
@@ -1052,118 +1052,118 @@ error:
  */
 static struct icmp_control icmp_pointers[NR_ICMP_TYPES + 1] = {
        [ICMP_ECHOREPLY] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutEchoReps),
-               .input_off = offsetof(struct icmp_mib, IcmpInEchoReps),
+               .output_entry = ICMP_MIB_OUTECHOREPS,
+               .input_entry = ICMP_MIB_INECHOREPS,
                .handler = icmp_discard,
        },
        [1] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib,IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [2] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib,IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_DEST_UNREACH] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutDestUnreachs),
-               .input_off = offsetof(struct icmp_mib, IcmpInDestUnreachs),
+               .output_entry = ICMP_MIB_OUTDESTUNREACHS,
+               .input_entry = ICMP_MIB_INDESTUNREACHS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_SOURCE_QUENCH] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutSrcQuenchs),
-               .input_off = offsetof(struct icmp_mib, IcmpInSrcQuenchs),
+               .output_entry = ICMP_MIB_OUTSRCQUENCHS,
+               .input_entry = ICMP_MIB_INSRCQUENCHS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_REDIRECT] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutRedirects),
-               .input_off = offsetof(struct icmp_mib, IcmpInRedirects),
+               .output_entry = ICMP_MIB_OUTREDIRECTS,
+               .input_entry = ICMP_MIB_INREDIRECTS,
                .handler = icmp_redirect,
                .error = 1,
        },
 #ifdef CONFIG_ICMP_IPOD
        [6] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, dummy),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_DUMMY,
                .handler = icmp_ping_of_death,
                .error = 1,
        },
 #else
        [6] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
 #endif
        [7] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_ECHO] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutEchos),
-               .input_off = offsetof(struct icmp_mib, IcmpInEchos),
+               .output_entry = ICMP_MIB_OUTECHOS,
+               .input_entry = ICMP_MIB_INECHOS,
                .handler = icmp_echo,
        },
        [9] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [10] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, IcmpInErrors),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_INERRORS,
                .handler = icmp_discard,
                .error = 1,
        },
        [ICMP_TIME_EXCEEDED] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutTimeExcds),
-               .input_off = offsetof(struct icmp_mib,IcmpInTimeExcds),
+               .output_entry = ICMP_MIB_OUTTIMEEXCDS,
+               .input_entry = ICMP_MIB_INTIMEEXCDS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_PARAMETERPROB] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutParmProbs),
-               .input_off = offsetof(struct icmp_mib, IcmpInParmProbs),
+               .output_entry = ICMP_MIB_OUTPARMPROBS,
+               .input_entry = ICMP_MIB_INPARMPROBS,
                .handler = icmp_unreach,
                .error = 1,
        },
        [ICMP_TIMESTAMP] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutTimestamps),
-               .input_off = offsetof(struct icmp_mib, IcmpInTimestamps),
+               .output_entry = ICMP_MIB_OUTTIMESTAMPS,
+               .input_entry = ICMP_MIB_INTIMESTAMPS,
                .handler = icmp_timestamp,
        },
        [ICMP_TIMESTAMPREPLY] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutTimestampReps),
-               .input_off = offsetof(struct icmp_mib, IcmpInTimestampReps),
+               .output_entry = ICMP_MIB_OUTTIMESTAMPREPS,
+               .input_entry = ICMP_MIB_INTIMESTAMPREPS,
                .handler = icmp_discard,
        },
        [ICMP_INFO_REQUEST] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, dummy),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_DUMMY,
                .handler = icmp_discard,
        },
        [ICMP_INFO_REPLY] = {
-               .output_off = offsetof(struct icmp_mib, dummy),
-               .input_off = offsetof(struct icmp_mib, dummy),
+               .output_entry = ICMP_MIB_DUMMY,
+               .input_entry = ICMP_MIB_DUMMY,
                .handler = icmp_discard,
        },
        [ICMP_ADDRESS] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutAddrMasks),
-               .input_off = offsetof(struct icmp_mib, IcmpInAddrMasks),
+               .output_entry = ICMP_MIB_OUTADDRMASKS,
+               .input_entry = ICMP_MIB_INADDRMASKS,
                .handler = icmp_address,
        },
        [ICMP_ADDRESSREPLY] = {
-               .output_off = offsetof(struct icmp_mib, IcmpOutAddrMaskReps),
-               .input_off = offsetof(struct icmp_mib, IcmpInAddrMaskReps),
+               .output_entry = ICMP_MIB_OUTADDRMASKREPS,
+               .input_entry = ICMP_MIB_INADDRMASKREPS,
                .handler = icmp_address_reply,
        },
 };
index d980386..01db761 100644 (file)
@@ -2217,8 +2217,8 @@ static void igmp_mc_seq_stop(struct seq_file *seq, void *v)
 static int igmp_mc_seq_show(struct seq_file *seq, void *v)
 {
        if (v == SEQ_START_TOKEN)
-               seq_printf(seq, 
-                          "Idx\tDevice    : Count Querier\tGroup    Users Timer\tReporter\n");
+               seq_puts(seq, 
+                        "Idx\tDevice    : Count Querier\tGroup    Users Timer\tReporter\n");
        else {
                struct ip_mc_list *im = (struct ip_mc_list *)v;
                struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
index be1e87c..77094aa 100644 (file)
@@ -46,7 +46,7 @@ static inline int ip_forward_finish(struct sk_buff *skb)
 {
        struct ip_options * opt = &(IPCB(skb)->opt);
 
-       IP_INC_STATS_BH(OutForwDatagrams);
+       IP_INC_STATS_BH(IPSTATS_MIB_OUTFORWDATAGRAMS);
 
        if (unlikely(opt->optlen))
                ip_forward_options(skb);
index 1f007c6..6fd69fe 100644 (file)
@@ -263,7 +263,7 @@ static void ip_evictor(void)
                spin_unlock(&qp->lock);
 
                ipq_put(qp);
-               IP_INC_STATS_BH(ReasmFails);
+               IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        }
 }
 
@@ -281,8 +281,8 @@ static void ip_expire(unsigned long arg)
 
        ipq_kill(qp);
 
-       IP_INC_STATS_BH(ReasmTimeout);
-       IP_INC_STATS_BH(ReasmFails);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMTIMEOUT);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
 
        if ((qp->last_in&FIRST_IN) && qp->fragments != NULL) {
                struct sk_buff *head = qp->fragments;
@@ -609,7 +609,7 @@ static struct sk_buff *ip_frag_reasm(struct ipq *qp, struct net_device *dev)
        iph = head->nh.iph;
        iph->frag_off = 0;
        iph->tot_len = htons(len);
-       IP_INC_STATS_BH(ReasmOKs);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMOKS);
        qp->fragments = NULL;
        return head;
 
@@ -625,7 +625,7 @@ out_oversize:
                        "Oversized IP packet from %d.%d.%d.%d.\n",
                        NIPQUAD(qp->saddr));
 out_fail:
-       IP_INC_STATS_BH(ReasmFails);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        return NULL;
 }
 
@@ -636,7 +636,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
        struct ipq *qp;
        struct net_device *dev;
        
-       IP_INC_STATS_BH(ReasmReqds);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
 
        /* Start by cleaning up the memory. */
        if (atomic_read(&ip_frag_mem) > sysctl_ipfrag_high_thresh)
@@ -661,7 +661,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb)
                return ret;
        }
 
-       IP_INC_STATS_BH(ReasmFails);
+       IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        kfree_skb(skb);
        return NULL;
 }
index 399e0b5..c7b3b60 100644 (file)
@@ -245,16 +245,16 @@ static inline int ip_local_deliver_finish(struct sk_buff *skb)
                                protocol = -ret;
                                goto resubmit;
                        }
-                       IP_INC_STATS_BH(InDelivers);
+                       IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS);
                } else {
                        if (!raw_sk) {
                                if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-                                       IP_INC_STATS_BH(InUnknownProtos);
+                                       IP_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS);
                                        icmp_send(skb, ICMP_DEST_UNREACH,
                                                  ICMP_PROT_UNREACH, 0);
                                }
                        } else
-                               IP_INC_STATS_BH(InDelivers);
+                               IP_INC_STATS_BH(IPSTATS_MIB_INDELIVERS);
                        kfree_skb(skb);
                }
        }
@@ -320,7 +320,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
                */
 
                if (skb_cow(skb, skb_headroom(skb))) {
-                       IP_INC_STATS_BH(InDiscards);
+                       IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
                        goto drop;
                }
                iph = skb->nh.iph;
@@ -349,7 +349,7 @@ static inline int ip_rcv_finish(struct sk_buff *skb)
        return dst_input(skb);
 
 inhdr_error:
-       IP_INC_STATS_BH(InHdrErrors);
+       IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
 drop:
         kfree_skb(skb);
         return NET_RX_DROP;
@@ -368,10 +368,10 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop;
 
-       IP_INC_STATS_BH(InReceives);
+       IP_INC_STATS_BH(IPSTATS_MIB_INRECEIVES);
 
        if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
-               IP_INC_STATS_BH(InDiscards);
+               IP_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
                goto out;
        }
 
@@ -422,7 +422,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt)
                       ip_rcv_finish);
 
 inhdr_error:
-       IP_INC_STATS_BH(InHdrErrors);
+       IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
 drop:
         kfree_skb(skb);
 out:
index 770eeee..5a853aa 100644 (file)
@@ -233,7 +233,7 @@ int ip_mc_output(struct sk_buff **pskb)
        /*
         *      If the indicated interface is up and running, send the packet.
         */
-       IP_INC_STATS(OutRequests);
+       IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
 
        skb->dev = dev;
        skb->protocol = htons(ETH_P_IP);
@@ -288,7 +288,7 @@ int ip_output(struct sk_buff **pskb)
 {
        struct sk_buff *skb = *pskb;
 
-       IP_INC_STATS(OutRequests);
+       IP_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
 
        if ((skb->len > dst_pmtu(skb->dst) || skb_shinfo(skb)->frag_list) &&
            !skb_shinfo(skb)->tso_size)
@@ -393,7 +393,7 @@ packet_routed:
                       dst_output);
 
 no_route:
-       IP_INC_STATS(OutNoRoutes);
+       IP_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
        kfree_skb(skb);
        return -EHOSTUNREACH;
 }
@@ -546,7 +546,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
                }
 
                if (err == 0) {
-                       IP_INC_STATS(FragOKs);
+                       IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
                        return 0;
                }
 
@@ -555,7 +555,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
                        kfree_skb(frag);
                        frag = skb;
                }
-               IP_INC_STATS(FragFails);
+               IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
                return err;
        }
 
@@ -661,7 +661,7 @@ slow_path:
                 *      Put this fragment into the sending queue.
                 */
 
-               IP_INC_STATS(FragCreates);
+               IP_INC_STATS(IPSTATS_MIB_FRAGCREATES);
 
                iph->tot_len = htons(len + hlen);
 
@@ -672,12 +672,12 @@ slow_path:
                        goto fail;
        }
        kfree_skb(skb);
-       IP_INC_STATS(FragOKs);
+       IP_INC_STATS(IPSTATS_MIB_FRAGOKS);
        return err;
 
 fail:
        kfree_skb(skb); 
-       IP_INC_STATS(FragFails);
+       IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
        return err;
 }
 
@@ -963,7 +963,7 @@ alloc_new_skb:
 
 error:
        inet->cork.length -= length;
-       IP_INC_STATS(OutDiscards);
+       IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        return err; 
 }
 
@@ -1076,7 +1076,7 @@ ssize_t   ip_append_page(struct sock *sk, struct page *page,
 
 error:
        inet->cork.length -= size;
-       IP_INC_STATS(OutDiscards);
+       IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        return err;
 }
 
@@ -1184,7 +1184,7 @@ out:
        return err;
 
 error:
-       IP_INC_STATS(OutDiscards);
+       IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        goto out;
 }
 
index 5604b25..7ce7469 100644 (file)
@@ -18,7 +18,6 @@
 #include <asm/scatterlist.h>
 #include <linux/crypto.h>
 #include <linux/pfkeyv2.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/icmp.h>
index faede83..9079766 100644 (file)
@@ -1114,7 +1114,7 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
 {
        struct ip_options * opt = &(IPCB(skb)->opt);
 
-       IP_INC_STATS_BH(OutForwDatagrams);
+       IP_INC_STATS_BH(IPSTATS_MIB_OUTFORWDATAGRAMS);
 
        if (unlikely(opt->optlen))
                ip_forward_options(skb);
@@ -1177,7 +1177,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
                   to blackhole.
                 */
 
-               IP_INC_STATS_BH(FragFails);
+               IP_INC_STATS_BH(IPSTATS_MIB_FRAGFAILS);
                ip_rt_put(rt);
                goto out_free;
        }
index 5df55ca..d90a793 100644 (file)
@@ -1347,13 +1347,13 @@ static int ip_vs_zero_all(void)
 
 static int
 proc_do_defense_mode(ctl_table *table, int write, struct file * filp,
-                    void __user *buffer, size_t *lenp)
+                    void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int *valp = table->data;
        int val = *valp;
        int rc;
 
-       rc = proc_dointvec(table, write, filp, buffer, lenp);
+       rc = proc_dointvec(table, write, filp, buffer, lenp, ppos);
        if (write && (*valp != val)) {
                if ((*valp < 0) || (*valp > 3)) {
                        /* Restore the correct value */
@@ -1370,7 +1370,7 @@ proc_do_defense_mode(ctl_table *table, int write, struct file * filp,
 
 static int
 proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
-                      void __user *buffer, size_t *lenp)
+                      void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int *valp = table->data;
        int val[2];
@@ -1379,7 +1379,7 @@ proc_do_sync_threshold(ctl_table *table, int write, struct file *filp,
        /* backup the value first */
        memcpy(val, valp, sizeof(val));
 
-       rc = proc_dointvec(table, write, filp, buffer, lenp);
+       rc = proc_dointvec(table, write, filp, buffer, lenp, ppos);
        if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) {
                /* Restore the correct value */
                memcpy(valp, val, sizeof(val));
index e7f3f28..80fdab7 100644 (file)
@@ -555,25 +555,15 @@ static struct socket * make_receive_sock(void)
 static int
 ip_vs_send_async(struct socket *sock, const char *buffer, const size_t length)
 {
-       struct msghdr   msg;
-       mm_segment_t    oldfs;
-       struct iovec    iov;
+       struct msghdr   msg = {.msg_flags = MSG_DONTWAIT|MSG_NOSIGNAL};
+       struct kvec     iov;
        int             len;
 
        EnterFunction(7);
        iov.iov_base     = (void *)buffer;
        iov.iov_len      = length;
-       msg.msg_name     = 0;
-       msg.msg_namelen  = 0;
-       msg.msg_iov      = &iov;
-       msg.msg_iovlen   = 1;
-       msg.msg_control  = NULL;
-       msg.msg_controllen = 0;
-       msg.msg_flags    = MSG_DONTWAIT|MSG_NOSIGNAL;
-
-       oldfs = get_fs(); set_fs(KERNEL_DS);
-       len = sock_sendmsg(sock, &msg, (size_t)(length));
-       set_fs(oldfs);
+
+       len = kernel_sendmsg(sock, &msg, &iov, 1, (size_t)(length));
 
        LeaveFunction(7);
        return len;
@@ -583,27 +573,17 @@ ip_vs_send_async(struct socket *sock, const char *buffer, const size_t length)
 static int
 ip_vs_receive(struct socket *sock, char *buffer, const size_t buflen)
 {
-       struct msghdr           msg;
-       struct iovec            iov;
+       struct msghdr           msg = {NULL,};
+       struct kvec             iov;
        int                     len;
-       mm_segment_t            oldfs;
 
        EnterFunction(7);
 
        /* Receive a packet */
        iov.iov_base     = buffer;
        iov.iov_len      = (size_t)buflen;
-       msg.msg_name     = NULL;
-       msg.msg_namelen  = 0;
-       msg.msg_iov      = &iov;
-       msg.msg_iovlen   = 1;
-       msg.msg_control  = NULL;
-       msg.msg_controllen = 0;
-       msg.msg_flags    = 0;
-
-       oldfs = get_fs(); set_fs(KERNEL_DS);
-       len = sock_recvmsg(sock, &msg, buflen, 0);
-       set_fs(oldfs);
+
+       len = kernel_recvmsg(sock, &msg, &iov, 1, buflen, 0);
 
        if (len < 0)
                return -1;
index 23854e0..539ad18 100644 (file)
@@ -862,6 +862,77 @@ static unsigned char snmp_request_decode(struct asn1_ctx *ctx,
        return 1;
 }
 
+/* 
+ * Fast checksum update for possibly oddly-aligned UDP byte, from the
+ * code example in the draft.
+ */
+static void fast_csum(unsigned char *csum,
+                      const unsigned char *optr,
+                      const unsigned char *nptr,
+                      int odd)
+{
+       long x, old, new;
+       
+       x = csum[0] * 256 + csum[1];
+       
+       x =~ x & 0xFFFF;
+       
+       if (odd) old = optr[0] * 256;
+       else old = optr[0];
+       
+       x -= old & 0xFFFF;
+       if (x <= 0) {
+               x--;
+               x &= 0xFFFF;
+       }
+       
+       if (odd) new = nptr[0] * 256;
+       else new = nptr[0];
+       
+       x += new & 0xFFFF;
+       if (x & 0x10000) {
+               x++;
+               x &= 0xFFFF;
+       }
+       
+       x =~ x & 0xFFFF;
+       csum[0] = x / 256;
+       csum[1] = x & 0xFF;
+}
+
+/* 
+ * Mangle IP address.
+ *     - begin points to the start of the snmp messgae
+ *      - addr points to the start of the address
+ */
+static inline void mangle_address(unsigned char *begin,
+                                  unsigned char *addr,
+                                  const struct oct1_map *map,
+                                  u_int16_t *check)
+{
+       if (map->from == NOCT1(*addr)) {
+               u_int32_t old;
+               
+               if (debug)
+                       memcpy(&old, (unsigned char *)addr, sizeof(old));
+                       
+               *addr = map->to;
+               
+               /* Update UDP checksum if being used */
+               if (*check) {
+                       unsigned char odd = !((addr - begin) % 2);
+                       
+                       fast_csum((unsigned char *)check,
+                                 &map->from, &map->to, odd);
+                                 
+               }
+               
+               if (debug)
+                       printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to "
+                              "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr));
+       }
+}
+
 static unsigned char snmp_trap_decode(struct asn1_ctx *ctx,
                                       struct snmp_v1_trap *trap,
                                       const struct oct1_map *map,
@@ -952,77 +1023,6 @@ static void hex_dump(unsigned char *buf, size_t len)
        printk("\n");
 }
 
-/* 
- * Fast checksum update for possibly oddly-aligned UDP byte, from the
- * code example in the draft.
- */
-static void fast_csum(unsigned char *csum,
-                      const unsigned char *optr,
-                      const unsigned char *nptr,
-                      int odd)
-{
-       long x, old, new;
-       
-       x = csum[0] * 256 + csum[1];
-       
-       x =~ x & 0xFFFF;
-       
-       if (odd) old = optr[0] * 256;
-       else old = optr[0];
-       
-       x -= old & 0xFFFF;
-       if (x <= 0) {
-               x--;
-               x &= 0xFFFF;
-       }
-       
-       if (odd) new = nptr[0] * 256;
-       else new = nptr[0];
-       
-       x += new & 0xFFFF;
-       if (x & 0x10000) {
-               x++;
-               x &= 0xFFFF;
-       }
-       
-       x =~ x & 0xFFFF;
-       csum[0] = x / 256;
-       csum[1] = x & 0xFF;
-}
-
-/* 
- * Mangle IP address.
- *     - begin points to the start of the snmp messgae
- *      - addr points to the start of the address
- */
-static inline void mangle_address(unsigned char *begin,
-                                  unsigned char *addr,
-                                  const struct oct1_map *map,
-                                  u_int16_t *check)
-{
-       if (map->from == NOCT1(*addr)) {
-               u_int32_t old;
-               
-               if (debug)
-                       memcpy(&old, (unsigned char *)addr, sizeof(old));
-                       
-               *addr = map->to;
-               
-               /* Update UDP checksum if being used */
-               if (*check) {
-                       unsigned char odd = !((addr - begin) % 2);
-                       
-                       fast_csum((unsigned char *)check,
-                                 &map->from, &map->to, odd);
-                                 
-               }
-               
-               if (debug)
-                       printk(KERN_DEBUG "bsalg: mapped %u.%u.%u.%u to "
-                              "%u.%u.%u.%u\n", NIPQUAD(old), NIPQUAD(*addr));
-       }
-}
-
 /*
  * Parse and mangle SNMP message according to mapping.
  * (And this is the fucking 'basic' method).
index be47cbe..fca126a 100644 (file)
@@ -88,7 +88,7 @@ static struct file_operations sockstat_seq_fops = {
 };
 
 static unsigned long
-__fold_field(void *mib[], int offt)
+fold_field(void *mib[], int offt)
 {
        unsigned long res = 0;
        int i;
@@ -96,41 +96,157 @@ __fold_field(void *mib[], int offt)
        for (i = 0; i < NR_CPUS; i++) {
                if (!cpu_possible(i))
                        continue;
-               res +=
-                   *((unsigned long *) (((void *) per_cpu_ptr(mib[0], i)) +
-                                        offt));
-               res +=
-                   *((unsigned long *) (((void *) per_cpu_ptr(mib[1], i)) +
-                                        offt));
+               res += *(((unsigned long *) per_cpu_ptr(mib[0], i)) + offt);
+               res += *(((unsigned long *) per_cpu_ptr(mib[1], i)) + offt);
        }
        return res;
 }
 
-#define fold_field(_mib, _nr)  __fold_field(_mib, (sizeof(unsigned long) * (_nr)))
-
 /* snmp items */
-static struct snmp_item snmp4_ipstats_list[] = {
-#define __SNMP_GEN(x,y)        SNMP_ITEM(struct ipstats_mib, x, y)
-#define SNMP_GEN(x)    __SNMP_GEN(x, #x)
-       SNMP_GEN(InReceives),
-       SNMP_GEN(InHdrErrors),
-       SNMP_GEN(InAddrErrors),
-       __SNMP_GEN(OutForwDatagrams,"ForwDatagrams"),   /* for backward compatibility */
-       SNMP_GEN(InUnknownProtos),
-       SNMP_GEN(InDiscards),
-       SNMP_GEN(InDelivers),
-       SNMP_GEN(OutRequests),
-       SNMP_GEN(OutDiscards),
-       SNMP_GEN(OutNoRoutes),
-       SNMP_GEN(ReasmTimeout),
-       SNMP_GEN(ReasmReqds),
-       SNMP_GEN(ReasmOKs),
-       SNMP_GEN(ReasmFails),
-       SNMP_GEN(FragOKs),
-       SNMP_GEN(FragFails),
-       SNMP_GEN(FragCreates),
-       SNMP_ITEM_SENTINEL
-#undef SNMP_GEN
+static struct snmp_mib snmp4_ipstats_list[] = {
+       SNMP_MIB_ITEM("InReceives", IPSTATS_MIB_INRECEIVES),
+       SNMP_MIB_ITEM("InHdrErrors", IPSTATS_MIB_INHDRERRORS),
+       SNMP_MIB_ITEM("InAddrErrors", IPSTATS_MIB_INADDRERRORS),
+       SNMP_MIB_ITEM("ForwDatagrams", IPSTATS_MIB_OUTFORWDATAGRAMS),
+       SNMP_MIB_ITEM("InUnknownProtos", IPSTATS_MIB_INUNKNOWNPROTOS),
+       SNMP_MIB_ITEM("InDiscards", IPSTATS_MIB_INDISCARDS),
+       SNMP_MIB_ITEM("InDelivers", IPSTATS_MIB_INDELIVERS),
+       SNMP_MIB_ITEM("OutRequests", IPSTATS_MIB_OUTREQUESTS),
+       SNMP_MIB_ITEM("OutDiscards", IPSTATS_MIB_OUTDISCARDS),
+       SNMP_MIB_ITEM("OutNoRoutes", IPSTATS_MIB_OUTNOROUTES),
+       SNMP_MIB_ITEM("ReasmTimeout", IPSTATS_MIB_REASMTIMEOUT),
+       SNMP_MIB_ITEM("ReasmReqds", IPSTATS_MIB_REASMREQDS),
+       SNMP_MIB_ITEM("ReasmOKs", IPSTATS_MIB_REASMOKS),
+       SNMP_MIB_ITEM("ReasmFails", IPSTATS_MIB_REASMFAILS),
+       SNMP_MIB_ITEM("FragOKs", IPSTATS_MIB_FRAGOKS),
+       SNMP_MIB_ITEM("FragFails", IPSTATS_MIB_FRAGFAILS),
+       SNMP_MIB_ITEM("FragCreates", IPSTATS_MIB_FRAGCREATES),
+       SNMP_MIB_SENTINEL
+};
+
+static struct snmp_mib snmp4_icmp_list[] = {
+       SNMP_MIB_ITEM("InMsgs", ICMP_MIB_INMSGS),
+       SNMP_MIB_ITEM("InErrors", ICMP_MIB_INERRORS),
+       SNMP_MIB_ITEM("InDestUnreachs", ICMP_MIB_INDESTUNREACHS),
+       SNMP_MIB_ITEM("InTimeExcds", ICMP_MIB_INTIMEEXCDS),
+       SNMP_MIB_ITEM("InParmProbs", ICMP_MIB_INPARMPROBS),
+       SNMP_MIB_ITEM("InSrcQuenchs", ICMP_MIB_INSRCQUENCHS),
+       SNMP_MIB_ITEM("InRedirects", ICMP_MIB_INREDIRECTS),
+       SNMP_MIB_ITEM("InEchos", ICMP_MIB_INECHOS),
+       SNMP_MIB_ITEM("InEchoReps", ICMP_MIB_INECHOREPS),
+       SNMP_MIB_ITEM("InTimestamps", ICMP_MIB_INTIMESTAMPS),
+       SNMP_MIB_ITEM("InTimestampReps", ICMP_MIB_INTIMESTAMPREPS),
+       SNMP_MIB_ITEM("InAddrMasks", ICMP_MIB_INADDRMASKS),
+       SNMP_MIB_ITEM("InAddrMaskReps", ICMP_MIB_INADDRMASKREPS),
+       SNMP_MIB_ITEM("OutMsgs", ICMP_MIB_OUTMSGS),
+       SNMP_MIB_ITEM("OutErrors", ICMP_MIB_OUTERRORS),
+       SNMP_MIB_ITEM("OutDestUnreachs", ICMP_MIB_OUTDESTUNREACHS),
+       SNMP_MIB_ITEM("OutTimeExcds", ICMP_MIB_OUTTIMEEXCDS),
+       SNMP_MIB_ITEM("OutParmProbs", ICMP_MIB_OUTPARMPROBS),
+       SNMP_MIB_ITEM("OutSrcQuenchs", ICMP_MIB_OUTSRCQUENCHS),
+       SNMP_MIB_ITEM("OutRedirects", ICMP_MIB_OUTREDIRECTS),
+       SNMP_MIB_ITEM("OutEchos", ICMP_MIB_OUTECHOS),
+       SNMP_MIB_ITEM("OutEchoReps", ICMP_MIB_OUTECHOREPS),
+       SNMP_MIB_ITEM("OutTimestamps", ICMP_MIB_OUTTIMESTAMPS),
+       SNMP_MIB_ITEM("OutTimestampReps", ICMP_MIB_OUTTIMESTAMPREPS),
+       SNMP_MIB_ITEM("OutAddrMasks", ICMP_MIB_OUTADDRMASKS),
+       SNMP_MIB_ITEM("OutAddrMaskReps", ICMP_MIB_OUTADDRMASKREPS),
+       SNMP_MIB_SENTINEL
+};
+
+static struct snmp_mib snmp4_tcp_list[] = {
+       SNMP_MIB_ITEM("RtoAlgorithm", TCP_MIB_RTOALGORITHM),
+       SNMP_MIB_ITEM("RtoMin", TCP_MIB_RTOMIN),
+       SNMP_MIB_ITEM("RtoMax", TCP_MIB_RTOMAX),
+       SNMP_MIB_ITEM("MaxConn", TCP_MIB_MAXCONN),
+       SNMP_MIB_ITEM("ActiveOpens", TCP_MIB_ACTIVEOPENS),
+       SNMP_MIB_ITEM("PassiveOpens", TCP_MIB_PASSIVEOPENS),
+       SNMP_MIB_ITEM("AttemptFails", TCP_MIB_ATTEMPTFAILS),
+       SNMP_MIB_ITEM("EstabResets", TCP_MIB_ESTABRESETS),
+       SNMP_MIB_ITEM("CurrEstab", TCP_MIB_CURRESTAB),
+       SNMP_MIB_ITEM("InSegs", TCP_MIB_INSEGS),
+       SNMP_MIB_ITEM("OutSegs", TCP_MIB_OUTSEGS),
+       SNMP_MIB_ITEM("RetransSegs", TCP_MIB_RETRANSSEGS),
+       SNMP_MIB_ITEM("InErrs", TCP_MIB_INERRS),
+       SNMP_MIB_ITEM("OutRsts", TCP_MIB_OUTRSTS),
+       SNMP_MIB_SENTINEL
+};
+
+static struct snmp_mib snmp4_udp_list[] = {
+       SNMP_MIB_ITEM("InDatagrams", UDP_MIB_INDATAGRAMS),
+       SNMP_MIB_ITEM("NoPorts", UDP_MIB_NOPORTS),
+       SNMP_MIB_ITEM("InErrors", UDP_MIB_INERRORS),
+       SNMP_MIB_ITEM("OutDatagrams", UDP_MIB_OUTDATAGRAMS),
+       SNMP_MIB_SENTINEL
+};
+
+static struct snmp_mib snmp4_net_list[] = {
+       SNMP_MIB_ITEM("SyncookiesSent", LINUX_MIB_SYNCOOKIESSENT),
+       SNMP_MIB_ITEM("SyncookiesRecv", LINUX_MIB_SYNCOOKIESRECV),
+       SNMP_MIB_ITEM("SyncookiesFailed", LINUX_MIB_SYNCOOKIESFAILED),
+       SNMP_MIB_ITEM("EmbryonicRsts", LINUX_MIB_EMBRYONICRSTS),
+       SNMP_MIB_ITEM("PruneCalled", LINUX_MIB_PRUNECALLED),
+       SNMP_MIB_ITEM("RcvPruned", LINUX_MIB_RCVPRUNED),
+       SNMP_MIB_ITEM("OfoPruned", LINUX_MIB_OFOPRUNED),
+       SNMP_MIB_ITEM("OutOfWindowIcmps", LINUX_MIB_OUTOFWINDOWICMPS),
+       SNMP_MIB_ITEM("LockDroppedIcmps", LINUX_MIB_LOCKDROPPEDICMPS),
+       SNMP_MIB_ITEM("ArpFilter", LINUX_MIB_ARPFILTER),
+       SNMP_MIB_ITEM("TW", LINUX_MIB_TIMEWAITED),
+       SNMP_MIB_ITEM("TWRecycled", LINUX_MIB_TIMEWAITRECYCLED),
+       SNMP_MIB_ITEM("TWKilled", LINUX_MIB_TIMEWAITKILLED),
+       SNMP_MIB_ITEM("PAWSPassive", LINUX_MIB_PAWSPASSIVEREJECTED),
+       SNMP_MIB_ITEM("PAWSActive", LINUX_MIB_PAWSACTIVEREJECTED),
+       SNMP_MIB_ITEM("PAWSEstab", LINUX_MIB_PAWSESTABREJECTED),
+       SNMP_MIB_ITEM("DelayedACKs", LINUX_MIB_DELAYEDACKS),
+       SNMP_MIB_ITEM("DelayedACKLocked", LINUX_MIB_DELAYEDACKLOCKED),
+       SNMP_MIB_ITEM("DelayedACKLost", LINUX_MIB_DELAYEDACKLOST),
+       SNMP_MIB_ITEM("ListenOverflows", LINUX_MIB_LISTENOVERFLOWS),
+       SNMP_MIB_ITEM("ListenDrops", LINUX_MIB_LISTENDROPS),
+       SNMP_MIB_ITEM("TCPPrequeued", LINUX_MIB_TCPPREQUEUED),
+       SNMP_MIB_ITEM("TCPDirectCopyFromBacklog", LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG),
+       SNMP_MIB_ITEM("TCPDirectCopyFromPrequeue", LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE),
+       SNMP_MIB_ITEM("TCPPrequeueDropped", LINUX_MIB_TCPPREQUEUEDROPPED),
+       SNMP_MIB_ITEM("TCPHPHits", LINUX_MIB_TCPHPHITS),
+       SNMP_MIB_ITEM("TCPHPHitsToUser", LINUX_MIB_TCPHPHITSTOUSER),
+       SNMP_MIB_ITEM("TCPPureAcks", LINUX_MIB_TCPPUREACKS),
+       SNMP_MIB_ITEM("TCPHPAcks", LINUX_MIB_TCPHPACKS),
+       SNMP_MIB_ITEM("TCPRenoRecovery", LINUX_MIB_TCPRENORECOVERY),
+       SNMP_MIB_ITEM("TCPSackRecovery", LINUX_MIB_TCPSACKRECOVERY),
+       SNMP_MIB_ITEM("TCPSACKReneging", LINUX_MIB_TCPSACKRENEGING),
+       SNMP_MIB_ITEM("TCPFACKReorder", LINUX_MIB_TCPFACKREORDER),
+       SNMP_MIB_ITEM("TCPSACKReorder", LINUX_MIB_TCPSACKREORDER),
+       SNMP_MIB_ITEM("TCPRenoReorder", LINUX_MIB_TCPRENOREORDER),
+       SNMP_MIB_ITEM("TCPTSReorder", LINUX_MIB_TCPTSREORDER),
+       SNMP_MIB_ITEM("TCPFullUndo", LINUX_MIB_TCPFULLUNDO),
+       SNMP_MIB_ITEM("TCPPartialUndo", LINUX_MIB_TCPPARTIALUNDO),
+       SNMP_MIB_ITEM("TCPDSACKUndo", LINUX_MIB_TCPDSACKUNDO),
+       SNMP_MIB_ITEM("TCPLossUndo", LINUX_MIB_TCPLOSSUNDO),
+       SNMP_MIB_ITEM("TCPLoss", LINUX_MIB_TCPLOSS),
+       SNMP_MIB_ITEM("TCPLostRetransmit", LINUX_MIB_TCPLOSTRETRANSMIT),
+       SNMP_MIB_ITEM("TCPRenoFailures", LINUX_MIB_TCPRENOFAILURES),
+       SNMP_MIB_ITEM("TCPSackFailures", LINUX_MIB_TCPSACKFAILURES),
+       SNMP_MIB_ITEM("TCPLossFailures", LINUX_MIB_TCPLOSSFAILURES),
+       SNMP_MIB_ITEM("TCPFastRetrans", LINUX_MIB_TCPFASTRETRANS),
+       SNMP_MIB_ITEM("TCPForwardRetrans", LINUX_MIB_TCPFORWARDRETRANS),
+       SNMP_MIB_ITEM("TCPSlowStartRetrans", LINUX_MIB_TCPSLOWSTARTRETRANS),
+       SNMP_MIB_ITEM("TCPTimeouts", LINUX_MIB_TCPTIMEOUTS),
+       SNMP_MIB_ITEM("TCPRenoRecoveryFail", LINUX_MIB_TCPRENORECOVERYFAIL),
+       SNMP_MIB_ITEM("TCPSackRecoveryFail", LINUX_MIB_TCPSACKRECOVERYFAIL),
+       SNMP_MIB_ITEM("TCPSchedulerFailed", LINUX_MIB_TCPSCHEDULERFAILED),
+       SNMP_MIB_ITEM("TCPRcvCollapsed", LINUX_MIB_TCPRCVCOLLAPSED),
+       SNMP_MIB_ITEM("TCPDSACKOldSent", LINUX_MIB_TCPDSACKOLDSENT),
+       SNMP_MIB_ITEM("TCPDSACKOfoSent", LINUX_MIB_TCPDSACKOFOSENT),
+       SNMP_MIB_ITEM("TCPDSACKRecv", LINUX_MIB_TCPDSACKRECV),
+       SNMP_MIB_ITEM("TCPDSACKOfoRecv", LINUX_MIB_TCPDSACKOFORECV),
+       SNMP_MIB_ITEM("TCPAbortOnSyn", LINUX_MIB_TCPABORTONSYN),
+       SNMP_MIB_ITEM("TCPAbortOnData", LINUX_MIB_TCPABORTONDATA),
+       SNMP_MIB_ITEM("TCPAbortOnClose", LINUX_MIB_TCPABORTONCLOSE),
+       SNMP_MIB_ITEM("TCPAbortOnMemory", LINUX_MIB_TCPABORTONMEMORY),
+       SNMP_MIB_ITEM("TCPAbortOnTimeout", LINUX_MIB_TCPABORTONTIMEOUT),
+       SNMP_MIB_ITEM("TCPAbortOnLinger", LINUX_MIB_TCPABORTONLINGER),
+       SNMP_MIB_ITEM("TCPAbortFailed", LINUX_MIB_TCPABORTFAILED),
+       SNMP_MIB_ITEM("TCPMemoryPressures", LINUX_MIB_TCPMEMORYPRESSURES),
+       SNMP_MIB_SENTINEL
 };
 
 /*
@@ -140,7 +256,7 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
 {
        int i;
 
-       seq_printf(seq, "Ip: Forwarding DefaultTTL");
+       seq_puts(seq, "Ip: Forwarding DefaultTTL");
 
        for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
                seq_printf(seq, " %s", snmp4_ipstats_list[i].name);
@@ -150,44 +266,45 @@ static int snmp_seq_show(struct seq_file *seq, void *v)
 
        for (i = 0; snmp4_ipstats_list[i].name != NULL; i++)
                seq_printf(seq, " %lu",
-                          __fold_field((void **) ip_statistics, 
-                                       snmp4_ipstats_list[i].offset));
-
-       seq_printf(seq, "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds "
-                       "InParmProbs InSrcQuenchs InRedirects InEchos "
-                       "InEchoReps InTimestamps InTimestampReps InAddrMasks "
-                       "InAddrMaskReps OutMsgs OutErrors OutDestUnreachs "
-                       "OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects "
-                       "OutEchos OutEchoReps OutTimestamps OutTimestampReps "
-                       "OutAddrMasks OutAddrMaskReps\nIcmp:");
-
-       for (i = 0;
-            i < offsetof(struct icmp_mib, dummy) / sizeof(unsigned long); i++)
+                          fold_field((void **) ip_statistics, 
+                                     snmp4_ipstats_list[i].entry));
+
+       seq_puts(seq, "\nIcmp:");
+       for (i = 0; snmp4_icmp_list[i].name != NULL; i++)
+               seq_printf(seq, " %s", snmp4_icmp_list[i].name);
+
+       seq_puts(seq, "\nIcmp:");
+       for (i = 0; snmp4_icmp_list[i].name != NULL; i++)
                seq_printf(seq, " %lu",
-                          fold_field((void **) icmp_statistics, i)); 
-
-       seq_printf(seq, "\nTcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens "
-                       "PassiveOpens AttemptFails EstabResets CurrEstab "
-                       "InSegs OutSegs RetransSegs InErrs OutRsts\nTcp:");
-
-       for (i = 0;
-            i < offsetof(struct tcp_mib, __pad) / sizeof(unsigned long); i++) {
-               if (i == (offsetof(struct tcp_mib, TcpMaxConn) / sizeof(unsigned long)))
-                       /* MaxConn field is negative, RFC 2012 */
-                       seq_printf(seq, " %ld", 
-                                  fold_field((void **) tcp_statistics, i));
+                          fold_field((void **) icmp_statistics, 
+                                     snmp4_icmp_list[i].entry));
+
+       seq_puts(seq, "\nTcp:");
+       for (i = 0; snmp4_tcp_list[i].name != NULL; i++)
+               seq_printf(seq, " %s", snmp4_tcp_list[i].name);
+
+       seq_puts(seq, "\nTcp:");
+       for (i = 0; snmp4_tcp_list[i].name != NULL; i++) {
+               /* MaxConn field is signed, RFC 2012 */
+               if (snmp4_tcp_list[i].entry == TCP_MIB_MAXCONN)
+                       seq_printf(seq, " %ld",
+                                  fold_field((void **) tcp_statistics, 
+                                             snmp4_tcp_list[i].entry));
                else
-                       seq_printf(seq, " %lu", 
-                                  fold_field((void **) tcp_statistics, i));
+                       seq_printf(seq, " %lu",
+                                  fold_field((void **) tcp_statistics,
+                                             snmp4_tcp_list[i].entry));
        }
 
-       seq_printf(seq, "\nUdp: InDatagrams NoPorts InErrors OutDatagrams\n"
-                       "Udp:");
+       seq_puts(seq, "\nUdp:");
+       for (i = 0; snmp4_udp_list[i].name != NULL; i++)
+               seq_printf(seq, " %s", snmp4_udp_list[i].name);
 
-       for (i = 0;
-            i < offsetof(struct udp_mib, __pad) / sizeof(unsigned long); i++)
-               seq_printf(seq, " %lu", 
-                               fold_field((void **) udp_statistics, i));
+       seq_puts(seq, "\nUdp:");
+       for (i = 0; snmp4_udp_list[i].name != NULL; i++)
+               seq_printf(seq, " %lu",
+                          fold_field((void **) udp_statistics, 
+                                     snmp4_udp_list[i].entry));
 
        seq_putc(seq, '\n');
        return 0;
@@ -213,39 +330,16 @@ static int netstat_seq_show(struct seq_file *seq, void *v)
 {
        int i;
 
-       seq_puts(seq, "TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed"
-                     " EmbryonicRsts PruneCalled RcvPruned OfoPruned"
-                     " OutOfWindowIcmps LockDroppedIcmps ArpFilter"
-                     " TW TWRecycled TWKilled"
-                     " PAWSPassive PAWSActive PAWSEstab"
-                     " DelayedACKs DelayedACKLocked DelayedACKLost"
-                     " ListenOverflows ListenDrops"
-                     " TCPPrequeued TCPDirectCopyFromBacklog"
-                     " TCPDirectCopyFromPrequeue TCPPrequeueDropped"
-                     " TCPHPHits TCPHPHitsToUser"
-                     " TCPPureAcks TCPHPAcks"
-                     " TCPRenoRecovery TCPSackRecovery"
-                     " TCPSACKReneging"
-                     " TCPFACKReorder TCPSACKReorder TCPRenoReorder"
-                     " TCPTSReorder"
-                     " TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo"
-                     " TCPLoss TCPLostRetransmit"
-                     " TCPRenoFailures TCPSackFailures TCPLossFailures"
-                     " TCPFastRetrans TCPForwardRetrans TCPSlowStartRetrans"
-                     " TCPTimeouts"
-                     " TCPRenoRecoveryFail TCPSackRecoveryFail"
-                     " TCPSchedulerFailed TCPRcvCollapsed"
-                     " TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv"
-                     " TCPDSACKOfoRecv"
-                     " TCPAbortOnSyn TCPAbortOnData TCPAbortOnClose"
-                     " TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger"
-                     " TCPAbortFailed TCPMemoryPressures\n"
-                     "TcpExt:");
-       for (i = 0;
-            i < offsetof(struct linux_mib, __pad) / sizeof(unsigned long); 
-            i++)
-               seq_printf(seq, " %lu", 
-                          fold_field((void **) net_statistics, i)); 
+       seq_puts(seq, "\nTcpExt:");
+       for (i = 0; snmp4_net_list[i].name != NULL; i++)
+               seq_printf(seq, " %s", snmp4_net_list[i].name);
+
+       seq_puts(seq, "\nTcpExt:");
+       for (i = 0; snmp4_net_list[i].name != NULL; i++)
+               seq_printf(seq, " %lu",
+                          fold_field((void **) net_statistics, 
+                                     snmp4_net_list[i].entry));
+
        seq_putc(seq, '\n');
        return 0;
 }
index 41aaa7c..1f7364a 100644 (file)
@@ -320,7 +320,7 @@ error_fault:
        err = -EFAULT;
        kfree_skb(skb);
 error:
-       IP_INC_STATS(OutDiscards);
+       IP_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        return err; 
 }
 
@@ -556,9 +556,11 @@ int raw_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        }
        if (inet->cmsg_flags)
                ip_cmsg_recv(msg, skb);
+       if (flags & MSG_TRUNC)
+               copied = skb->len;
 done:
        skb_free_datagram(sk, skb);
-out:   return err ? : copied;
+out:   return err ? err : copied;
 }
 
 static int raw_init(struct sock *sk)
@@ -658,7 +660,7 @@ static int raw_ioctl(struct sock *sk, int cmd, unsigned long arg)
 struct proto raw_prot = {
        .name =         "RAW",
        .close =        raw_close,
-       .connect =      udp_connect,
+       .connect =      ip4_datagram_connect,
        .disconnect =   udp_disconnect,
        .ioctl =        raw_ioctl,
        .init =         raw_init,
index 5d2cf03..15d9eca 100644 (file)
@@ -1729,17 +1729,6 @@ static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,
 
        rth->rt_flags = flags;
 
-#ifdef CONFIG_NET_FASTROUTE
-       if (netdev_fastroute && !(flags&(RTCF_NAT|RTCF_MASQ|RTCF_DOREDIRECT))) {
-               struct net_device *odev = rth->u.dst.dev;
-               if (odev != dev &&
-                   dev->accept_fastpath &&
-                   odev->mtu >= dev->mtu &&
-                   dev->accept_fastpath(dev, &rth->u.dst) == 0)
-                       rth->rt_flags |= RTCF_FAST;
-       }
-#endif
-
 intern:
        err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
 done:
@@ -2509,10 +2498,10 @@ static int flush_delay;
 
 static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
                                        struct file *filp, void __user *buffer,
-                                       size_t *lenp)
+                                       size_t *lenp, loff_t *ppos)
 {
        if (write) {
-               proc_dointvec(ctl, write, filp, buffer, lenp);
+               proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
                rt_cache_flush(flush_delay);
                return 0;
        } 
index e6a0ce3..90bb78a 100644 (file)
@@ -69,12 +69,12 @@ extern ctl_table ipv4_route_table[];
 
 static
 int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-                       void __user *buffer, size_t *lenp)
+                       void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int val = ipv4_devconf.forwarding;
        int ret;
 
-       ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+       ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && ipv4_devconf.forwarding != val)
                inet_forward_change();
index bceeaee..c99f5ce 100644 (file)
@@ -309,7 +309,7 @@ EXPORT_SYMBOL(tcp_memory_pressure);
 void tcp_enter_memory_pressure(void)
 {
        if (!tcp_memory_pressure) {
-               NET_INC_STATS(TCPMemoryPressures);
+               NET_INC_STATS(LINUX_MIB_TCPMEMORYPRESSURES);
                tcp_memory_pressure = 1;
        }
 }
@@ -1097,7 +1097,7 @@ static int tcp_recv_urg(struct sock *sk, long timeo,
  * calculation of whether or not we must ACK for the sake of
  * a window update.
  */
-static void cleanup_rbuf(struct sock *sk, int copied)
+void cleanup_rbuf(struct sock *sk, int copied)
 {
        struct tcp_opt *tp = tcp_sk(sk);
        int time_to_ack = 0;
@@ -1156,7 +1156,7 @@ static void tcp_prequeue_process(struct sock *sk)
        struct sk_buff *skb;
        struct tcp_opt *tp = tcp_sk(sk);
 
-       NET_ADD_STATS_USER(TCPPrequeued, skb_queue_len(&tp->ucopy.prequeue));
+       NET_ADD_STATS_USER(LINUX_MIB_TCPPREQUEUED, skb_queue_len(&tp->ucopy.prequeue));
 
        /* RX process wants to run with disabled BHs, though it is not
         * necessary */
@@ -1439,7 +1439,7 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                        /* __ Restore normal policy in scheduler __ */
 
                        if ((chunk = len - tp->ucopy.len) != 0) {
-                               NET_ADD_STATS_USER(TCPDirectCopyFromBacklog, chunk);
+                               NET_ADD_STATS_USER(LINUX_MIB_TCPDIRECTCOPYFROMBACKLOG, chunk);
                                len -= chunk;
                                copied += chunk;
                        }
@@ -1450,7 +1450,7 @@ do_prequeue:
                                tcp_prequeue_process(sk);
 
                                if ((chunk = len - tp->ucopy.len) != 0) {
-                                       NET_ADD_STATS_USER(TCPDirectCopyFromPrequeue, chunk);
+                                       NET_ADD_STATS_USER(LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE, chunk);
                                        len -= chunk;
                                        copied += chunk;
                                }
@@ -1535,7 +1535,7 @@ skip_copy:
                        tcp_prequeue_process(sk);
 
                        if (copied > 0 && (chunk = len - tp->ucopy.len) != 0) {
-                               NET_ADD_STATS_USER(TCPDirectCopyFromPrequeue, chunk);
+                               NET_ADD_STATS_USER(LINUX_MIB_TCPDIRECTCOPYFROMPREQUEUE, chunk);
                                len -= chunk;
                                copied += chunk;
                        }
@@ -1706,13 +1706,13 @@ void tcp_close(struct sock *sk, long timeout)
         */
        if (data_was_unread) {
                /* Unread data was tossed, zap the connection. */
-               NET_INC_STATS_USER(TCPAbortOnClose);
+               NET_INC_STATS_USER(LINUX_MIB_TCPABORTONCLOSE);
                tcp_set_state(sk, TCP_CLOSE);
                tcp_send_active_reset(sk, GFP_KERNEL);
        } else if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
                /* Check zero linger _after_ checking for unread data. */
                sk->sk_prot->disconnect(sk, 0);
-               NET_INC_STATS_USER(TCPAbortOnData);
+               NET_INC_STATS_USER(LINUX_MIB_TCPABORTONDATA);
        } else if (tcp_close_state(sk)) {
                /* We FIN if the application ate all the data before
                 * zapping the connection.
@@ -1778,7 +1778,7 @@ adjudge_to_death:
                if (tp->linger2 < 0) {
                        tcp_set_state(sk, TCP_CLOSE);
                        tcp_send_active_reset(sk, GFP_ATOMIC);
-                       NET_INC_STATS_BH(TCPAbortOnLinger);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPABORTONLINGER);
                } else {
                        int tmo = tcp_fin_time(tp);
 
@@ -1801,7 +1801,7 @@ adjudge_to_death:
                                       "sockets\n");
                        tcp_set_state(sk, TCP_CLOSE);
                        tcp_send_active_reset(sk, GFP_ATOMIC);
-                       NET_INC_STATS_BH(TCPAbortOnMemory);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPABORTONMEMORY);
                }
        }
        atomic_inc(&tcp_orphan_count);
@@ -2496,3 +2496,4 @@ EXPORT_SYMBOL(tcp_setsockopt);
 EXPORT_SYMBOL(tcp_shutdown);
 EXPORT_SYMBOL(tcp_statistics);
 EXPORT_SYMBOL(tcp_timewait_cachep);
+EXPORT_SYMBOL_GPL(cleanup_rbuf);
index fd6cc97..5e7f70f 100644 (file)
@@ -330,6 +330,15 @@ static void tcp_init_buffer_space(struct sock *sk)
        tp->snd_cwnd_stamp = tcp_time_stamp;
 }
 
+static void init_bictcp(struct tcp_opt *tp)
+{
+       tp->bictcp.cnt = 0;
+
+       tp->bictcp.last_max_cwnd = 0;
+       tp->bictcp.last_cwnd = 0;
+       tp->bictcp.last_stamp = 0;
+}
+
 /* 5. Recalculate window clamp after socket hit its memory bounds. */
 static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
 {
@@ -876,13 +885,13 @@ static void tcp_update_reordering(struct tcp_opt *tp, int metric, int ts)
 
                /* This exciting event is worth to be remembered. 8) */
                if (ts)
-                       NET_INC_STATS_BH(TCPTSReorder);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPTSREORDER);
                else if (IsReno(tp))
-                       NET_INC_STATS_BH(TCPRenoReorder);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPRENOREORDER);
                else if (IsFack(tp))
-                       NET_INC_STATS_BH(TCPFACKReorder);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPFACKREORDER);
                else
-                       NET_INC_STATS_BH(TCPSACKReorder);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPSACKREORDER);
 #if FASTRETRANS_DEBUG > 1
                printk(KERN_DEBUG "Disorder%d %d %u f%u s%u rr%d\n",
                       tp->sack_ok, tp->ca_state,
@@ -981,13 +990,13 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                        if (before(start_seq, ack)) {
                                dup_sack = 1;
                                tp->sack_ok |= 4;
-                               NET_INC_STATS_BH(TCPDSACKRecv);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
                        } else if (num_sacks > 1 &&
                                   !after(end_seq, ntohl(sp[1].end_seq)) &&
                                   !before(start_seq, ntohl(sp[1].start_seq))) {
                                dup_sack = 1;
                                tp->sack_ok |= 4;
-                               NET_INC_STATS_BH(TCPDSACKOfoRecv);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
                        }
 
                        /* D-SACK for already forgotten data...
@@ -1131,7 +1140,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                                        tp->lost_out++;
                                        TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
                                        flag |= FLAG_DATA_SACKED;
-                                       NET_INC_STATS_BH(TCPLostRetransmit);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPLOSTRETRANSMIT);
                                }
                        }
                }
@@ -1233,6 +1242,8 @@ static void tcp_enter_frto_loss(struct sock *sk)
        tcp_set_ca_state(tp, TCP_CA_Loss);
        tp->high_seq = tp->frto_highmark;
        TCP_ECN_queue_cwr(tp);
+
+       init_bictcp(tp);
 }
 
 void tcp_clear_retrans(struct tcp_opt *tp)
@@ -1310,7 +1321,7 @@ static int tcp_check_sack_reneging(struct sock *sk, struct tcp_opt *tp)
         */
        if ((skb = skb_peek(&sk->sk_write_queue)) != NULL &&
            (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) {
-               NET_INC_STATS_BH(TCPSACKReneging);
+               NET_INC_STATS_BH(LINUX_MIB_TCPSACKRENEGING);
 
                tcp_enter_loss(sk, 1);
                tp->retransmits++;
@@ -1658,9 +1669,9 @@ static int tcp_try_undo_recovery(struct sock *sk, struct tcp_opt *tp)
                DBGUNDO(sk, tp, tp->ca_state == TCP_CA_Loss ? "loss" : "retrans");
                tcp_undo_cwr(tp, 1);
                if (tp->ca_state == TCP_CA_Loss)
-                       NET_INC_STATS_BH(TCPLossUndo);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPLOSSUNDO);
                else
-                       NET_INC_STATS_BH(TCPFullUndo);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPFULLUNDO);
                tp->undo_marker = 0;
        }
        if (tp->snd_una == tp->high_seq && IsReno(tp)) {
@@ -1681,7 +1692,7 @@ static void tcp_try_undo_dsack(struct sock *sk, struct tcp_opt *tp)
                DBGUNDO(sk, tp, "D-SACK");
                tcp_undo_cwr(tp, 1);
                tp->undo_marker = 0;
-               NET_INC_STATS_BH(TCPDSACKUndo);
+               NET_INC_STATS_BH(LINUX_MIB_TCPDSACKUNDO);
        }
 }
 
@@ -1703,7 +1714,7 @@ static int tcp_try_undo_partial(struct sock *sk, struct tcp_opt *tp, int acked)
 
                DBGUNDO(sk, tp, "Hoe");
                tcp_undo_cwr(tp, 0);
-               NET_INC_STATS_BH(TCPPartialUndo);
+               NET_INC_STATS_BH(LINUX_MIB_TCPPARTIALUNDO);
 
                /* So... Do not make Hoe's retransmit yet.
                 * If the first packet was delayed, the rest
@@ -1726,7 +1737,7 @@ static int tcp_try_undo_loss(struct sock *sk, struct tcp_opt *tp)
                tp->lost_out = 0;
                tp->left_out = tp->sacked_out;
                tcp_undo_cwr(tp, 1);
-               NET_INC_STATS_BH(TCPLossUndo);
+               NET_INC_STATS_BH(LINUX_MIB_TCPLOSSUNDO);
                tp->retransmits = 0;
                tp->undo_marker = 0;
                if (!IsReno(tp))
@@ -1814,7 +1825,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
            tp->ca_state != TCP_CA_Open &&
            tp->fackets_out > tp->reordering) {
                tcp_mark_head_lost(sk, tp, tp->fackets_out-tp->reordering, tp->high_seq);
-               NET_INC_STATS_BH(TCPLoss);
+               NET_INC_STATS_BH(LINUX_MIB_TCPLOSS);
        }
 
        /* D. Synchronize left_out to current state. */
@@ -1907,9 +1918,9 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
                /* Otherwise enter Recovery state */
 
                if (IsReno(tp))
-                       NET_INC_STATS_BH(TCPRenoRecovery);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPRENORECOVERY);
                else
-                       NET_INC_STATS_BH(TCPSackRecovery);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPSACKRECOVERY);
 
                tp->high_seq = tp->snd_nxt;
                tp->prior_ssthresh = 0;
@@ -2011,10 +2022,12 @@ static inline __u32 bictcp_cwnd(struct tcp_opt *tp)
        if (!sysctl_tcp_bic)
                return tp->snd_cwnd;
 
-       if (tp->bictcp.last_cwnd == tp->snd_cwnd)
-               return tp->bictcp.cnt; /*  same cwnd, no update */
-      
+       if (tp->bictcp.last_cwnd == tp->snd_cwnd &&
+          (s32)(tcp_time_stamp - tp->bictcp.last_stamp) <= (HZ>>5))
+               return tp->bictcp.cnt;
+
        tp->bictcp.last_cwnd = tp->snd_cwnd;
+       tp->bictcp.last_stamp = tcp_time_stamp;
       
        /* start off normal */
        if (tp->snd_cwnd <= sysctl_tcp_bic_low_window)
@@ -2797,12 +2810,12 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
                tcp_westwood_fast_bw(sk, skb);
                flag |= FLAG_WIN_UPDATE;
 
-               NET_INC_STATS_BH(TCPHPAcks);
+               NET_INC_STATS_BH(LINUX_MIB_TCPHPACKS);
        } else {
                if (ack_seq != TCP_SKB_CB(skb)->end_seq)
                        flag |= FLAG_DATA;
                else
-                       NET_INC_STATS_BH(TCPPureAcks);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPPUREACKS);
 
                flag |= tcp_ack_update_window(sk, tp, skb, ack, ack_seq);
 
@@ -3197,9 +3210,9 @@ static __inline__ void tcp_dsack_set(struct tcp_opt *tp, u32 seq, u32 end_seq)
 {
        if (tp->sack_ok && sysctl_tcp_dsack) {
                if (before(seq, tp->rcv_nxt))
-                       NET_INC_STATS_BH(TCPDSACKOldSent);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOLDSENT);
                else
-                       NET_INC_STATS_BH(TCPDSACKOfoSent);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFOSENT);
 
                tp->dsack = 1;
                tp->duplicate_sack[0].start_seq = seq;
@@ -3222,7 +3235,7 @@ static void tcp_send_dupack(struct sock *sk, struct sk_buff *skb)
 
        if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
            before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
-               NET_INC_STATS_BH(DelayedACKLost);
+               NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOST);
                tcp_enter_quickack_mode(tp);
 
                if (tp->sack_ok && sysctl_tcp_dsack) {
@@ -3489,7 +3502,7 @@ queue_and_out:
 
        if (!after(TCP_SKB_CB(skb)->end_seq, tp->rcv_nxt)) {
                /* A retransmit, 2nd most common case.  Force an immediate ack. */
-               NET_INC_STATS_BH(DelayedACKLost);
+               NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOST);
                tcp_dsack_set(tp, TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq);
 
 out_of_window:
@@ -3631,7 +3644,7 @@ tcp_collapse(struct sock *sk, struct sk_buff *head,
                        struct sk_buff *next = skb->next;
                        __skb_unlink(skb, skb->list);
                        __kfree_skb(skb);
-                       NET_INC_STATS_BH(TCPRcvCollapsed);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPRCVCOLLAPSED);
                        skb = next;
                        continue;
                }
@@ -3697,7 +3710,7 @@ tcp_collapse(struct sock *sk, struct sk_buff *head,
                                struct sk_buff *next = skb->next;
                                __skb_unlink(skb, skb->list);
                                __kfree_skb(skb);
-                               NET_INC_STATS_BH(TCPRcvCollapsed);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPRCVCOLLAPSED);
                                skb = next;
                                if (skb == tail || skb->h.th->syn || skb->h.th->fin)
                                        return;
@@ -3760,7 +3773,7 @@ static int tcp_prune_queue(struct sock *sk)
 
        SOCK_DEBUG(sk, "prune_queue: c=%x\n", tp->copied_seq);
 
-       NET_INC_STATS_BH(PruneCalled);
+       NET_INC_STATS_BH(LINUX_MIB_PRUNECALLED);
 
        if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf)
                tcp_clamp_window(sk, tp);
@@ -3781,7 +3794,7 @@ static int tcp_prune_queue(struct sock *sk)
 
        /* First, purge the out_of_order queue. */
        if (skb_queue_len(&tp->out_of_order_queue)) {
-               NET_ADD_STATS_BH(OfoPruned,
+               NET_ADD_STATS_BH(LINUX_MIB_OFOPRUNED, 
                                 skb_queue_len(&tp->out_of_order_queue));
                __skb_queue_purge(&tp->out_of_order_queue);
 
@@ -3802,7 +3815,7 @@ static int tcp_prune_queue(struct sock *sk)
         * drop receive data on the floor.  It will get retransmitted
         * and hopefully then we'll have sufficient space.
         */
-       NET_INC_STATS_BH(RcvPruned);
+       NET_INC_STATS_BH(LINUX_MIB_RCVPRUNED);
 
        /* Massive buffer overcommit. */
        tp->pred_flags = 0;
@@ -4181,7 +4194,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
                                tcp_data_snd_check(sk);
                                return 0;
                        } else { /* Header too small */
-                               TCP_INC_STATS_BH(TcpInErrs);
+                               TCP_INC_STATS_BH(TCP_MIB_INERRS);
                                goto discard;
                        }
                } else {
@@ -4208,7 +4221,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
 
                                        __skb_pull(skb, tcp_header_len);
                                        tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
-                                       NET_INC_STATS_BH(TCPHPHitsToUser);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPHPHITSTOUSER);
                                        eaten = 1;
                                }
                        }
@@ -4230,7 +4243,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
                                if ((int)skb->truesize > sk->sk_forward_alloc)
                                        goto step5;
 
-                               NET_INC_STATS_BH(TCPHPHits);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPHPHITS);
 
                                /* Bulk data transfer: receiver */
                                __skb_pull(skb,tcp_header_len);
@@ -4278,7 +4291,7 @@ slow_path:
        if (tcp_fast_parse_options(skb, th, tp) && tp->saw_tstamp &&
            tcp_paws_discard(tp, skb)) {
                if (!th->rst) {
-                       NET_INC_STATS_BH(PAWSEstabRejected);
+                       NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
                        tcp_send_dupack(sk, skb);
                        goto discard;
                }
@@ -4313,8 +4326,8 @@ slow_path:
        tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
 
        if (th->syn && !before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
-               TCP_INC_STATS_BH(TcpInErrs);
-               NET_INC_STATS_BH(TCPAbortOnSyn);
+               TCP_INC_STATS_BH(TCP_MIB_INERRS);
+               NET_INC_STATS_BH(LINUX_MIB_TCPABORTONSYN);
                tcp_reset(sk);
                return 1;
        }
@@ -4336,7 +4349,7 @@ step5:
        return 0;
 
 csum_error:
-       TCP_INC_STATS_BH(TcpInErrs);
+       TCP_INC_STATS_BH(TCP_MIB_INERRS);
 
 discard:
        __kfree_skb(skb);
@@ -4369,7 +4382,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
                if (tp->saw_tstamp && tp->rcv_tsecr &&
                    !between(tp->rcv_tsecr, tp->retrans_stamp,
                             tcp_time_stamp)) {
-                       NET_INC_STATS_BH(PAWSActiveRejected);
+                       NET_INC_STATS_BH(LINUX_MIB_PAWSACTIVEREJECTED);
                        goto reset_and_undo;
                }
 
@@ -4612,6 +4625,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                                return 1;
 
                        init_westwood(sk);
+                       init_bictcp(tp);
 
                        /* Now we have several options: In theory there is 
                         * nothing else in the frame. KA9Q has an option to 
@@ -4635,6 +4649,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 
        case TCP_SYN_SENT:
                init_westwood(sk);
+               init_bictcp(tp);
 
                queued = tcp_rcv_synsent_state_process(sk, skb, th, len);
                if (queued >= 0)
@@ -4650,7 +4665,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
        if (tcp_fast_parse_options(skb, th, tp) && tp->saw_tstamp &&
            tcp_paws_discard(tp, skb)) {
                if (!th->rst) {
-                       NET_INC_STATS_BH(PAWSEstabRejected);
+                       NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
                        tcp_send_dupack(sk, skb);
                        goto discard;
                }
@@ -4679,7 +4694,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
         *      Check for a SYN in window.
         */
        if (th->syn && !before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) {
-               NET_INC_STATS_BH(TCPAbortOnSyn);
+               NET_INC_STATS_BH(LINUX_MIB_TCPABORTONSYN);
                tcp_reset(sk);
                return 1;
        }
@@ -4758,7 +4773,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                                            (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
                                             after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) {
                                                tcp_done(sk);
-                                               NET_INC_STATS_BH(TCPAbortOnData);
+                                               NET_INC_STATS_BH(LINUX_MIB_TCPABORTONDATA);
                                                return 1;
                                        }
 
@@ -4818,7 +4833,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                if (sk->sk_shutdown & RCV_SHUTDOWN) {
                        if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq &&
                            after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) {
-                               NET_INC_STATS_BH(TCPAbortOnData);
+                               NET_INC_STATS_BH(LINUX_MIB_TCPABORTONDATA);
                                tcp_reset(sk);
                                return 1;
                        }
index 504bbef..aa1f971 100644 (file)
@@ -619,11 +619,11 @@ unique:
 
        if (twp) {
                *twp = tw;
-               NET_INC_STATS_BH(TimeWaitRecycled);
+               NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);
        } else if (tw) {
                /* Silly. Should hash-dance instead... */
                tcp_tw_deschedule(tw);
-               NET_INC_STATS_BH(TimeWaitRecycled);
+               NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);
 
                tcp_tw_put(tw);
        }
@@ -1003,14 +1003,14 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
        int err;
 
        if (skb->len < (iph->ihl << 2) + 8) {
-               ICMP_INC_STATS_BH(IcmpInErrors);
+               ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
                return;
        }
 
        sk = tcp_v4_lookup(iph->daddr, th->dest, iph->saddr,
                           th->source, tcp_v4_iif(skb));
        if (!sk) {
-               ICMP_INC_STATS_BH(IcmpInErrors);
+               ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
                return;
        }
        if (sk->sk_state == TCP_TIME_WAIT) {
@@ -1023,7 +1023,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
         * servers this needs to be solved differently.
         */
        if (sock_owned_by_user(sk))
-               NET_INC_STATS_BH(LockDroppedIcmps);
+               NET_INC_STATS_BH(LINUX_MIB_LOCKDROPPEDICMPS);
 
        if (sk->sk_state == TCP_CLOSE)
                goto out;
@@ -1032,7 +1032,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
        seq = ntohl(th->seq);
        if (sk->sk_state != TCP_LISTEN &&
            !between(seq, tp->snd_una, tp->snd_nxt)) {
-               NET_INC_STATS(OutOfWindowIcmps);
+               NET_INC_STATS(LINUX_MIB_OUTOFWINDOWICMPS);
                goto out;
        }
 
@@ -1083,7 +1083,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
                BUG_TRAP(!req->sk);
 
                if (seq != req->snt_isn) {
-                       NET_INC_STATS_BH(OutOfWindowIcmps);
+                       NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
                        goto out;
                }
 
@@ -1101,7 +1101,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info)
                               It can f.e. if SYNs crossed.
                             */
                if (!sock_owned_by_user(sk)) {
-                       TCP_INC_STATS_BH(TcpAttemptFails);
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                        sk->sk_err = err;
 
                        sk->sk_error_report(sk);
@@ -1210,8 +1210,8 @@ static void tcp_v4_send_reset(struct sk_buff *skb)
 
        ip_send_reply(tcp_socket->sk, skb, &arg, sizeof rth);
 
-       TCP_INC_STATS_BH(TcpOutSegs);
-       TCP_INC_STATS_BH(TcpOutRsts);
+       TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
+       TCP_INC_STATS_BH(TCP_MIB_OUTRSTS);
 }
 
 /* The code following below sending ACKs in SYN-RECV and TIME-WAIT states
@@ -1258,7 +1258,7 @@ static void tcp_v4_send_ack(struct sk_buff *skb, u32 seq, u32 ack,
 
        ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len);
 
-       TCP_INC_STATS_BH(TcpOutSegs);
+       TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
 }
 
 static void tcp_v4_timewait_ack(struct sock *sk, struct sk_buff *skb)
@@ -1295,12 +1295,12 @@ static struct dst_entry* tcp_v4_route_req(struct sock *sk,
                                         .dport = req->rmt_port } } };
 
        if (ip_route_output_flow(&rt, &fl, sk, 0)) {
-               IP_INC_STATS_BH(OutNoRoutes);
+               IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
                return NULL;
        }
        if (opt && opt->is_strictroute && rt->rt_dst != rt->rt_gateway) {
                ip_rt_put(rt);
-               IP_INC_STATS_BH(OutNoRoutes);
+               IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
                return NULL;
        }
        return &rt->u.dst;
@@ -1535,7 +1535,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
                        if (xtime.tv_sec < peer->tcp_ts_stamp + TCP_PAWS_MSL &&
                            (s32)(peer->tcp_ts - req->ts_recent) >
                                                        TCP_PAWS_WINDOW) {
-                               NET_INC_STATS_BH(PAWSPassiveRejected);
+                               NET_INC_STATS_BH(LINUX_MIB_PAWSPASSIVEREJECTED);
                                dst_release(dst);
                                goto drop_and_free;
                        }
@@ -1580,7 +1580,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 drop_and_free:
        tcp_openreq_free(req);
 drop:
-       TCP_INC_STATS_BH(TcpAttemptFails);
+       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
        return 0;
 }
 
@@ -1639,9 +1639,9 @@ struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
        return newsk;
 
 exit_overflow:
-       NET_INC_STATS_BH(ListenOverflows);
+       NET_INC_STATS_BH(LINUX_MIB_LISTENOVERFLOWS);
 exit:
-       NET_INC_STATS_BH(ListenDrops);
+       NET_INC_STATS_BH(LINUX_MIB_LISTENDROPS);
        dst_release(dst);
        return NULL;
 }
@@ -1759,7 +1759,7 @@ discard:
        return 0;
 
 csum_err:
-       TCP_INC_STATS_BH(TcpInErrs);
+       TCP_INC_STATS_BH(TCP_MIB_INERRS);
        goto discard;
 }
 
@@ -1781,7 +1781,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
                goto discard_it;
 
        /* Count it even if it's bad */
-       TCP_INC_STATS_BH(TcpInSegs);
+       TCP_INC_STATS_BH(TCP_MIB_INSEGS);
 
        if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
                goto discard_it;
@@ -1856,7 +1856,7 @@ no_tcp_socket:
 
        if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
 bad_packet:
-               TCP_INC_STATS_BH(TcpInErrs);
+               TCP_INC_STATS_BH(TCP_MIB_INERRS);
        } else {
                tcp_v4_send_reset(skb);
        }
@@ -1877,7 +1877,7 @@ do_time_wait:
        }
 
        if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
-               TCP_INC_STATS_BH(TcpInErrs);
+               TCP_INC_STATS_BH(TCP_MIB_INERRS);
                tcp_tw_put((struct tcp_tw_bucket *) sk);
                goto discard_it;
        }
@@ -2159,6 +2159,14 @@ int tcp_v4_destroy_sock(struct sock *sk)
        if (tp->bind_hash)
                tcp_put_port(sk);
 
+       /*
+        * If sendmsg cached page exists, toss it.
+        */
+       if (sk->sk_sndmsg_page) {
+               __free_page(sk->sk_sndmsg_page);
+               sk->sk_sndmsg_page = NULL;
+       }
+
        atomic_dec(&tcp_sockets_allocated);
 
        return 0;
index a8da77f..9f15b82 100644 (file)
@@ -269,7 +269,7 @@ kill:
        }
 
        if (paws_reject)
-               NET_INC_STATS_BH(PAWSEstabRejected);
+               NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
 
        if(!th->rst) {
                /* In this case we must reset the TIMEWAIT timer.
@@ -470,7 +470,7 @@ rescan:
        }
 
        tcp_tw_count -= killed;
-       NET_ADD_STATS_BH(TimeWaited, killed);
+       NET_ADD_STATS_BH(LINUX_MIB_TIMEWAITED, killed);
 
        return ret;
 }
@@ -680,7 +680,7 @@ void tcp_twcal_tick(unsigned long dummy)
 out:
        if ((tcp_tw_count -= killed) == 0)
                del_timer(&tcp_tw_timer);
-       NET_ADD_STATS_BH(TimeWaitKilled, killed);
+       NET_ADD_STATS_BH(LINUX_MIB_TIMEWAITKILLED, killed);
        spin_unlock(&tw_death_lock);
 }
 
@@ -736,6 +736,9 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
                if ((filter = newsk->sk_filter) != NULL)
                        sk_filter_charge(newsk, filter);
 
+               if (sk->sk_create_child)
+                       sk->sk_create_child(sk, newsk);
+
                if (unlikely(xfrm_sk_clone_policy(newsk))) {
                        /* It is still raw copy of parent, so invalidate
                         * destructor and make plain sk_free() */
@@ -777,9 +780,6 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
                newtp->snd_cwnd = 2;
                newtp->snd_cwnd_cnt = 0;
 
-               newtp->bictcp.cnt = 0;
-               newtp->bictcp.last_max_cwnd = newtp->bictcp.last_cwnd = 0;
-
                newtp->frto_counter = 0;
                newtp->frto_highmark = 0;
 
@@ -867,7 +867,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
                        newsk->sk_no_largesend = 1;
 
                tcp_vegas_init(newtp);
-               TCP_INC_STATS_BH(TcpPassiveOpens);
+               TCP_INC_STATS_BH(TCP_MIB_PASSIVEOPENS);
        }
        return newsk;
 }
@@ -998,7 +998,7 @@ struct sock *tcp_check_req(struct sock *sk,struct sk_buff *skb,
                if (!(flg & TCP_FLAG_RST))
                        req->class->send_ack(skb, req);
                if (paws_reject)
-                       NET_INC_STATS_BH(PAWSEstabRejected);
+                       NET_INC_STATS_BH(LINUX_MIB_PAWSESTABREJECTED);
                return NULL;
        }
 
@@ -1055,7 +1055,7 @@ listen_overflow:
        }
 
 embryonic_reset:
-       NET_INC_STATS_BH(EmbryonicRsts);
+       NET_INC_STATS_BH(LINUX_MIB_EMBRYONICRSTS);
        if (!(flg & TCP_FLAG_RST))
                req->class->send_reset(skb);
 
index 98212fa..68ab99f 100644 (file)
@@ -168,6 +168,14 @@ static __inline__ u16 tcp_select_window(struct sock *sk)
        tp->rcv_wnd = new_win;
        tp->rcv_wup = tp->rcv_nxt;
 
+       /* Make sure we do not exceed the maximum possible
+        * scaled window.
+        */
+       if (!tp->rcv_wscale)
+               new_win = min(new_win, MAX_TCP_WINDOW);
+       else
+               new_win = min(new_win, (65535U << tp->rcv_wscale));
+
        /* RFC1323 scaling applied */
        new_win >>= tp->rcv_wscale;
 
@@ -291,7 +299,7 @@ int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb)
                if (skb->len != tcp_header_size)
                        tcp_event_data_sent(tp, skb, sk);
 
-               TCP_INC_STATS(TcpOutSegs);
+               TCP_INC_STATS(TCP_MIB_OUTSEGS);
 
                err = tp->af_specific->queue_xmit(skb, 0);
                if (err <= 0)
@@ -916,7 +924,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
 
        if (err == 0) {
                /* Update global TCP statistics. */
-               TCP_INC_STATS(TcpRetransSegs);
+               TCP_INC_STATS(TCP_MIB_RETRANSSEGS);
 
 #if FASTRETRANS_DEBUG > 0
                if (TCP_SKB_CB(skb)->sacked&TCPCB_SACKED_RETRANS) {
@@ -968,9 +976,9 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
                                        if (tcp_retransmit_skb(sk, skb))
                                                return;
                                        if (tp->ca_state != TCP_CA_Loss)
-                                               NET_INC_STATS_BH(TCPFastRetrans);
+                                               NET_INC_STATS_BH(LINUX_MIB_TCPFASTRETRANS);
                                        else
-                                               NET_INC_STATS_BH(TCPSlowStartRetrans);
+                                               NET_INC_STATS_BH(LINUX_MIB_TCPSLOWSTARTRETRANS);
 
                                        if (skb ==
                                            skb_peek(&sk->sk_write_queue))
@@ -1022,7 +1030,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
                if (skb == skb_peek(&sk->sk_write_queue))
                        tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
 
-               NET_INC_STATS_BH(TCPForwardRetrans);
+               NET_INC_STATS_BH(LINUX_MIB_TCPFORWARDRETRANS);
        }
 }
 
@@ -1082,7 +1090,7 @@ void tcp_send_active_reset(struct sock *sk, int priority)
        /* NOTE: No TCP options attached and we never retransmit this. */
        skb = alloc_skb(MAX_TCP_HEADER, priority);
        if (!skb) {
-               NET_INC_STATS(TCPAbortFailed);
+               NET_INC_STATS(LINUX_MIB_TCPABORTFAILED);
                return;
        }
 
@@ -1097,7 +1105,7 @@ void tcp_send_active_reset(struct sock *sk, int priority)
        TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq;
        TCP_SKB_CB(skb)->when = tcp_time_stamp;
        if (tcp_transmit_skb(sk, skb))
-               NET_INC_STATS(TCPAbortFailed);
+               NET_INC_STATS(LINUX_MIB_TCPABORTFAILED);
 }
 
 /* WARNING: This routine must only be called when we have already sent
@@ -1197,7 +1205,7 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 
        skb->csum = 0;
        th->doff = (tcp_header_size >> 2);
-       TCP_INC_STATS(TcpOutSegs);
+       TCP_INC_STATS(TCP_MIB_OUTSEGS);
        return skb;
 }
 
@@ -1285,7 +1293,7 @@ int tcp_connect(struct sock *sk)
        sk_charge_skb(sk, buff);
        tp->packets_out++;
        tcp_transmit_skb(sk, skb_clone(buff, GFP_KERNEL));
-       TCP_INC_STATS(TcpActiveOpens);
+       TCP_INC_STATS(TCP_MIB_ACTIVEOPENS);
 
        /* Timer for repeating the SYN until an answer. */
        tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
index fc8e84f..a57d2d2 100644 (file)
@@ -83,7 +83,7 @@ static void tcp_write_err(struct sock *sk)
        sk->sk_error_report(sk);
 
        tcp_done(sk);
-       NET_INC_STATS_BH(TCPAbortOnTimeout);
+       NET_INC_STATS_BH(LINUX_MIB_TCPABORTONTIMEOUT);
 }
 
 /* Do not allow orphaned sockets to eat all our resources.
@@ -126,7 +126,7 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset)
                if (do_reset)
                        tcp_send_active_reset(sk, GFP_ATOMIC);
                tcp_done(sk);
-               NET_INC_STATS_BH(TCPAbortOnMemory);
+               NET_INC_STATS_BH(LINUX_MIB_TCPABORTONMEMORY);
                return 1;
        }
        return 0;
@@ -212,7 +212,7 @@ static void tcp_delack_timer(unsigned long data)
        if (sock_owned_by_user(sk)) {
                /* Try again later. */
                tp->ack.blocked = 1;
-               NET_INC_STATS_BH(DelayedACKLocked);
+               NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKLOCKED);
                sk_reset_timer(sk, &tp->delack_timer, jiffies + TCP_DELACK_MIN);
                goto out_unlock;
        }
@@ -231,8 +231,8 @@ static void tcp_delack_timer(unsigned long data)
        if (skb_queue_len(&tp->ucopy.prequeue)) {
                struct sk_buff *skb;
 
-               NET_ADD_STATS_BH(TCPSchedulerFailed,
-                                 skb_queue_len(&tp->ucopy.prequeue));
+               NET_ADD_STATS_BH(LINUX_MIB_TCPSCHEDULERFAILED, 
+                                skb_queue_len(&tp->ucopy.prequeue));
 
                while ((skb = __skb_dequeue(&tp->ucopy.prequeue)) != NULL)
                        sk->sk_backlog_rcv(sk, skb);
@@ -252,7 +252,7 @@ static void tcp_delack_timer(unsigned long data)
                        tp->ack.ato = TCP_ATO_MIN;
                }
                tcp_send_ack(sk);
-               NET_INC_STATS_BH(DelayedACKs);
+               NET_INC_STATS_BH(LINUX_MIB_DELAYEDACKS);
        }
        TCP_CHECK_TIMER(sk);
 
@@ -353,19 +353,19 @@ static void tcp_retransmit_timer(struct sock *sk)
                if (tp->ca_state == TCP_CA_Disorder || tp->ca_state == TCP_CA_Recovery) {
                        if (tp->sack_ok) {
                                if (tp->ca_state == TCP_CA_Recovery)
-                                       NET_INC_STATS_BH(TCPSackRecoveryFail);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPSACKRECOVERYFAIL);
                                else
-                                       NET_INC_STATS_BH(TCPSackFailures);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPSACKFAILURES);
                        } else {
                                if (tp->ca_state == TCP_CA_Recovery)
-                                       NET_INC_STATS_BH(TCPRenoRecoveryFail);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPRENORECOVERYFAIL);
                                else
-                                       NET_INC_STATS_BH(TCPRenoFailures);
+                                       NET_INC_STATS_BH(LINUX_MIB_TCPRENOFAILURES);
                        }
                } else if (tp->ca_state == TCP_CA_Loss) {
-                       NET_INC_STATS_BH(TCPLossFailures);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPLOSSFAILURES);
                } else {
-                       NET_INC_STATS_BH(TCPTimeouts);
+                       NET_INC_STATS_BH(LINUX_MIB_TCPTIMEOUTS);
                }
        }
 
index 9c64e45..b8c77b1 100644 (file)
@@ -328,7 +328,7 @@ void udp_err(struct sk_buff *skb, u32 info)
 
        sk = udp_v4_lookup(iph->daddr, uh->dest, iph->saddr, uh->source, skb->dev->ifindex);
        if (sk == NULL) {
-               ICMP_INC_STATS_BH(IcmpInErrors);
+               ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
                return; /* No socket for error */
        }
 
@@ -655,7 +655,7 @@ out:
        if (free)
                kfree(ipc.opt);
        if (!err) {
-               UDP_INC_STATS_USER(UdpOutDatagrams);
+               UDP_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS);
                return len;
        }
        return err;
@@ -829,7 +829,10 @@ try_again:
        }
        if (inet->cmsg_flags)
                ip_cmsg_recv(msg, skb);
+
        err = copied;
+       if (flags & MSG_TRUNC)
+               err = skb->len - sizeof(struct udphdr);
   
 out_free:
        skb_free_datagram(sk, skb);
@@ -837,7 +840,7 @@ out:
        return err;
 
 csum_copy_err:
-       UDP_INC_STATS_BH(UdpInErrors);
+       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
 
        /* Clear queue. */
        if (flags&MSG_PEEK) {
@@ -859,54 +862,6 @@ csum_copy_err:
        goto try_again;
 }
 
-int udp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
-{
-       struct inet_opt *inet = inet_sk(sk);
-       struct sockaddr_in *usin = (struct sockaddr_in *) uaddr;
-       struct rtable *rt;
-       u32 saddr;
-       int oif;
-       int err;
-
-       
-       if (addr_len < sizeof(*usin)) 
-               return -EINVAL;
-
-       if (usin->sin_family != AF_INET) 
-               return -EAFNOSUPPORT;
-
-       sk_dst_reset(sk);
-
-       oif = sk->sk_bound_dev_if;
-       saddr = inet->saddr;
-       if (MULTICAST(usin->sin_addr.s_addr)) {
-               if (!oif)
-                       oif = inet->mc_index;
-               if (!saddr)
-                       saddr = inet->mc_addr;
-       }
-       err = ip_route_connect(&rt, usin->sin_addr.s_addr, saddr,
-                              RT_CONN_FLAGS(sk), oif,
-                              IPPROTO_UDP,
-                              inet->sport, usin->sin_port, sk);
-       if (err)
-               return err;
-       if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) {
-               ip_rt_put(rt);
-               return -EACCES;
-       }
-       if (!inet->saddr)
-               inet->saddr = rt->rt_src;       /* Update source address */
-       if (!inet->rcv_saddr)
-               inet->rcv_saddr = rt->rt_src;
-       inet->daddr = rt->rt_dst;
-       inet->dport = usin->sin_port;
-       sk->sk_state = TCP_ESTABLISHED;
-       inet->id = jiffies;
-
-       sk_dst_set(sk, &rt->u.dst);
-       return(0);
-}
 
 int udp_disconnect(struct sock *sk, int flags)
 {
@@ -976,7 +931,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
                } else
                        /* Must be an IKE packet.. pass it through */
                        return 1;
-
+               break;
        case UDP_ENCAP_ESPINUDP_NON_IKE:
                /* Check if this is a keepalive packet.  If so, eat it. */
                if (len == 1 && udpdata[0] == 0xff) {
@@ -989,6 +944,7 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb)
                } else
                        /* Must be an IKE packet.. pass it through */
                        return 1;
+               break;
        }
 
        /* At this point we are sure that this is an ESPinUDP packet,
@@ -1061,7 +1017,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
                if (ret < 0) {
                        /* process the ESP packet */
                        ret = xfrm4_rcv_encap(skb, up->encap_type);
-                       UDP_INC_STATS_BH(UdpInDatagrams);
+                       UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
                        return -ret;
                }
                /* FALLTHROUGH -- it's a UDP Packet */
@@ -1069,7 +1025,7 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
 
        if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) {
                if (__udp_checksum_complete(skb)) {
-                       UDP_INC_STATS_BH(UdpInErrors);
+                       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
                        kfree_skb(skb);
                        return -1;
                }
@@ -1077,11 +1033,11 @@ static int udp_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
        }
 
        if (sock_queue_rcv_skb(sk,skb)<0) {
-               UDP_INC_STATS_BH(UdpInErrors);
+               UDP_INC_STATS_BH(UDP_MIB_INERRORS);
                kfree_skb(skb);
                return -1;
        }
-       UDP_INC_STATS_BH(UdpInDatagrams);
+       UDP_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
        return 0;
 }
 
@@ -1209,7 +1165,7 @@ int udp_rcv(struct sk_buff *skb)
        if (udp_checksum_complete(skb))
                goto csum_error;
 
-       UDP_INC_STATS_BH(UdpNoPorts);
+       UDP_INC_STATS_BH(UDP_MIB_NOPORTS);
        icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PORT_UNREACH, 0);
 
        /*
@@ -1229,7 +1185,7 @@ short_packet:
                        NIPQUAD(daddr),
                        ntohs(uh->dest)));
 no_header:
-       UDP_INC_STATS_BH(UdpInErrors);
+       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
        kfree_skb(skb);
        return(0);
 
@@ -1246,7 +1202,7 @@ csum_error:
                        ntohs(uh->dest),
                        ulen));
 drop:
-       UDP_INC_STATS_BH(UdpInErrors);
+       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
        kfree_skb(skb);
        return(0);
 }
@@ -1352,7 +1308,7 @@ static int udp_getsockopt(struct sock *sk, int level, int optname,
 struct proto udp_prot = {
        .name =         "UDP",
        .close =        udp_close,
-       .connect =      udp_connect,
+       .connect =      ip4_datagram_connect,
        .disconnect =   udp_disconnect,
        .ioctl =        udp_ioctl,
        .destroy =      udp_destroy_sock,
@@ -1556,7 +1512,6 @@ void udp4_proc_exit(void)
 }
 #endif /* CONFIG_PROC_FS */
 
-EXPORT_SYMBOL(udp_connect);
 EXPORT_SYMBOL(udp_disconnect);
 EXPORT_SYMBOL(udp_hash);
 EXPORT_SYMBOL(udp_hash_lock);
index 783f63c..b28a388 100644 (file)
@@ -74,11 +74,8 @@ __xfrm4_find_acq(u8 mode, u32 reqid, u8 proto,
                    proto == x->id.proto &&
                    saddr->a4 == x->props.saddr.a4 &&
                    reqid == x->props.reqid &&
-                   x->km.state == XFRM_STATE_ACQ) {
-                           if (!x0)
-                                   x0 = x;
-                           if (x->id.spi)
-                                   continue;
+                   x->km.state == XFRM_STATE_ACQ &&
+                   !x->id.spi) {
                            x0 = x;
                            break;
                    }
index 0999f9e..0d1a0b0 100644 (file)
@@ -6,32 +6,7 @@
 #include <linux/skbuff.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
-#include <net/icmp.h>
-#include <net/inet_ecn.h>
-
-int xfrm4_tunnel_check_size(struct sk_buff *skb)
-{
-       int mtu, ret = 0;
-       struct dst_entry *dst;
-       struct iphdr *iph = skb->nh.iph;
-
-       if (IPCB(skb)->flags & IPSKB_XFRM_TUNNEL_SIZE)
-               goto out;
-
-       IPCB(skb)->flags |= IPSKB_XFRM_TUNNEL_SIZE;
-       
-       if (!(iph->frag_off & htons(IP_DF)))
-               goto out;
-
-       dst = skb->dst;
-       mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;
-       if (skb->len > mtu) {
-               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
-               ret = -EMSGSIZE;
-       }
-out:
-       return ret;
-}
+#include <net/protocol.h>
 
 static int ipip_output(struct sk_buff **pskb)
 {
index 31afc9c..d9e309f 100644 (file)
@@ -11,7 +11,7 @@ ipv6-objs :=  af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o sit.o \
                ip6_flowlabel.o ipv6_syms.o
 
 ipv6-$(CONFIG_XFRM) += xfrm6_policy.o xfrm6_state.o xfrm6_input.o \
-       xfrm6_tunnel.o
+       xfrm6_tunnel.o xfrm6_output.o
 ipv6-objs += $(ipv6-y)
 
 obj-$(CONFIG_INET6_AH) += ah6.o
index 3032aaa..40ad73c 100644 (file)
@@ -1544,7 +1544,7 @@ int addrconf_set_dstaddr(void __user *arg)
                p.iph.ihl = 5;
                p.iph.protocol = IPPROTO_IPV6;
                p.iph.ttl = 64;
-               ifr.ifr_ifru.ifru_data = (void*)&p;
+               ifr.ifr_ifru.ifru_data = (void __user *)&p;
 
                oldfs = get_fs(); set_fs(KERNEL_DS);
                err = dev->do_ioctl(dev, &ifr, SIOCADDTUNNEL);
@@ -3003,13 +3003,13 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
 
 static
 int addrconf_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
-                          void __user *buffer, size_t *lenp)
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        int *valp = ctl->data;
        int val = *valp;
        int ret;
 
-       ret = proc_dointvec(ctl, write, filp, buffer, lenp);
+       ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 
        if (write && *valp != val && valp != &ipv6_devconf_dflt.forwarding) {
                struct inet6_dev *idev = NULL;
index 980687f..83e832e 100644 (file)
@@ -560,8 +560,6 @@ static struct inet_protosw rawv6_protosw = {
        .flags          = INET_PROTOSW_REUSE,
 };
 
-#define INETSW6_ARRAY_LEN (sizeof(inetsw6_array) / sizeof(struct inet_protosw))
-
 void
 inet6_register_protosw(struct inet_protosw *p)
 {
index bb7ee1a..eda2737 100644 (file)
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/ah.h>
 #include <linux/crypto.h>
 #include <linux/pfkeyv2.h>
+#include <linux/string.h>
 #include <net/icmp.h>
 #include <net/ipv6.h>
 #include <net/xfrm.h>
@@ -74,141 +74,138 @@ bad:
        return 0;
 }
 
-static int ipv6_clear_mutable_options(struct sk_buff *skb, u16 *nh_offset, int dir)
+/**
+ *     ipv6_rearrange_rthdr - rearrange IPv6 routing header
+ *     @iph: IPv6 header
+ *     @rthdr: routing header
+ *
+ *     Rearrange the destination address in @iph and the addresses in @rthdr
+ *     so that they appear in the order they will at the final destination.
+ *     See Appendix A2 of RFC 2402 for details.
+ */
+static void ipv6_rearrange_rthdr(struct ipv6hdr *iph, struct ipv6_rt_hdr *rthdr)
 {
-       u16 offset = sizeof(struct ipv6hdr);
-       struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-       unsigned int packet_len = skb->tail - skb->nh.raw;
-       u8 nexthdr = skb->nh.ipv6h->nexthdr;
-       u8 nextnexthdr = 0;
+       int segments, segments_left;
+       struct in6_addr *addrs;
+       struct in6_addr final_addr;
+
+       segments_left = rthdr->segments_left;
+       if (segments_left == 0)
+               return;
+       rthdr->segments_left = 0; 
+
+       /* The value of rthdr->hdrlen has been verified either by the system
+        * call if it is locally generated, or by ipv6_rthdr_rcv() for incoming
+        * packets.  So we can assume that it is even and that segments is
+        * greater than or equal to segments_left.
+        *
+        * For the same reason we can assume that this option is of type 0.
+        */
+       segments = rthdr->hdrlen >> 1;
 
-       *nh_offset = ((unsigned char *)&skb->nh.ipv6h->nexthdr) - skb->nh.raw;
+       addrs = ((struct rt0_hdr *)rthdr)->addr;
+       ipv6_addr_copy(&final_addr, addrs + segments - 1);
 
-       while (offset + 1 <= packet_len) {
+       addrs += segments - segments_left;
+       memmove(addrs + 1, addrs, (segments_left - 1) * sizeof(*addrs));
 
-               switch (nexthdr) {
+       ipv6_addr_copy(addrs, &iph->daddr);
+       ipv6_addr_copy(&iph->daddr, &final_addr);
+}
 
+static int ipv6_clear_mutable_options(struct ipv6hdr *iph, int len)
+{
+       union {
+               struct ipv6hdr *iph;
+               struct ipv6_opt_hdr *opth;
+               struct ipv6_rt_hdr *rth;
+               char *raw;
+       } exthdr = { .iph = iph };
+       char *end = exthdr.raw + len;
+       int nexthdr = iph->nexthdr;
+
+       exthdr.iph++;
+
+       while (exthdr.raw < end) {
+               switch (nexthdr) {
                case NEXTHDR_HOP:
-                       *nh_offset = offset;
-                       offset += ipv6_optlen(exthdr);
-                       if (!zero_out_mutable_opts(exthdr)) {
-                               LIMIT_NETDEBUG(
-                               printk(KERN_WARNING "overrun hopopts\n")); 
-                               return 0;
+               case NEXTHDR_DEST:
+                       if (!zero_out_mutable_opts(exthdr.opth)) {
+                               LIMIT_NETDEBUG(printk(
+                                       KERN_WARNING "overrun %sopts\n",
+                                       nexthdr == NEXTHDR_HOP ?
+                                               "hop" : "dest"));
+                               return -EINVAL;
                        }
-                       nexthdr = exthdr->nexthdr;
-                       exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
                        break;
 
                case NEXTHDR_ROUTING:
-                       *nh_offset = offset;
-                       offset += ipv6_optlen(exthdr);
-                       ((struct ipv6_rt_hdr*)exthdr)->segments_left = 0; 
-                       nexthdr = exthdr->nexthdr;
-                       exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-                       break;
-
-               case NEXTHDR_DEST:
-                       *nh_offset = offset;
-                       offset += ipv6_optlen(exthdr);
-                       if (!zero_out_mutable_opts(exthdr))  {
-                               LIMIT_NETDEBUG(
-                                       printk(KERN_WARNING "overrun destopt\n")); 
-                               return 0;
-                       }
-                       nexthdr = exthdr->nexthdr;
-                       exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
+                       ipv6_rearrange_rthdr(iph, exthdr.rth);
                        break;
 
-               case NEXTHDR_AUTH:
-                       if (dir == XFRM_POLICY_OUT) {
-                               memset(((struct ipv6_auth_hdr*)exthdr)->auth_data, 0, 
-                                      (((struct ipv6_auth_hdr*)exthdr)->hdrlen - 1) << 2);
-                       }
-                       if (exthdr->nexthdr == NEXTHDR_DEST) {
-                               offset += (((struct ipv6_auth_hdr*)exthdr)->hdrlen + 2) << 2;
-                               exthdr = (struct ipv6_opt_hdr*)(skb->nh.raw + offset);
-                               nextnexthdr = exthdr->nexthdr;
-                               if (!zero_out_mutable_opts(exthdr)) {
-                                       LIMIT_NETDEBUG(
-                                               printk(KERN_WARNING "overrun destopt\n"));
-                                       return 0;
-                               }
-                       }
-                       return nexthdr;
                default :
-                       return nexthdr;
+                       return 0;
                }
+
+               nexthdr = exthdr.opth->nexthdr;
+               exthdr.raw += ipv6_optlen(exthdr.opth);
        }
 
-       return nexthdr;
+       return 0;
 }
 
 int ah6_output(struct sk_buff **pskb)
 {
        int err;
-       int hdr_len = sizeof(struct ipv6hdr);
+       int extlen;
        struct dst_entry *dst = (*pskb)->dst;
        struct xfrm_state *x  = dst->xfrm;
-       struct ipv6hdr *iph = NULL;
+       struct ipv6hdr *top_iph;
        struct ip_auth_hdr *ah;
        struct ah_data *ahp;
-       u16 nh_offset = 0;
        u8 nexthdr;
+       char tmp_base[8];
+       struct {
+               struct in6_addr daddr;
+               char hdrs[0];
+       } *tmp_ext;
 
-       if ((*pskb)->ip_summed == CHECKSUM_HW) {
-               err = skb_checksum_help(pskb, 0);
-               if (err)
-                       goto error_nolock;
-       }
-
-       spin_lock_bh(&x->lock);
-       err = xfrm_state_check(x, *pskb);
-       if (err)
-               goto error;
+       top_iph = (struct ipv6hdr *)(*pskb)->data;
+       top_iph->payload_len = htons((*pskb)->len - sizeof(*top_iph));
 
-       if (x->props.mode) {
-               err = xfrm6_tunnel_check_size(*pskb);
-               if (err)
-                       goto error;
+       nexthdr = *(*pskb)->nh.raw;
+       *(*pskb)->nh.raw = IPPROTO_AH;
 
-               iph = (*pskb)->nh.ipv6h;
-               (*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
-               (*pskb)->nh.ipv6h->version = 6;
-               (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
-               (*pskb)->nh.ipv6h->nexthdr = IPPROTO_AH;
-               ipv6_addr_copy(&(*pskb)->nh.ipv6h->saddr,
-                              (struct in6_addr *) &x->props.saddr);
-               ipv6_addr_copy(&(*pskb)->nh.ipv6h->daddr,
-                              (struct in6_addr *) &x->id.daddr);
-               ah = (struct ip_auth_hdr*)((*pskb)->nh.ipv6h+1);
-               ah->nexthdr = IPPROTO_IPV6;
-       } else {
-               hdr_len = (*pskb)->h.raw - (*pskb)->nh.raw;
-               iph = kmalloc(hdr_len, GFP_ATOMIC);
-               if (!iph) {
+       /* When there are no extension headers, we only need to save the first
+        * 8 bytes of the base IP header.
+        */
+       memcpy(tmp_base, top_iph, sizeof(tmp_base));
+
+       tmp_ext = NULL;
+       extlen = (*pskb)->h.raw - (unsigned char *)(top_iph + 1);
+       if (extlen) {
+               extlen += sizeof(*tmp_ext);
+               tmp_ext = kmalloc(extlen, GFP_ATOMIC);
+               if (!tmp_ext) {
                        err = -ENOMEM;
                        goto error;
                }
-               memcpy(iph, (*pskb)->data, hdr_len);
-               (*pskb)->nh.ipv6h = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
-               memcpy((*pskb)->nh.ipv6h, iph, hdr_len);
-               nexthdr = ipv6_clear_mutable_options(*pskb, &nh_offset, XFRM_POLICY_OUT);
-               if (nexthdr == 0)
+               memcpy(tmp_ext, &top_iph->daddr, extlen);
+               err = ipv6_clear_mutable_options(top_iph,
+                                                extlen - sizeof(*tmp_ext) +
+                                                sizeof(*top_iph));
+               if (err)
                        goto error_free_iph;
-
-               (*pskb)->nh.raw[nh_offset] = IPPROTO_AH;
-               (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
-               ah = (struct ip_auth_hdr*)((*pskb)->nh.raw+hdr_len);
-               (*pskb)->h.raw = (unsigned char*) ah;
-               ah->nexthdr = nexthdr;
        }
 
-       (*pskb)->nh.ipv6h->priority    = 0;
-       (*pskb)->nh.ipv6h->flow_lbl[0] = 0;
-       (*pskb)->nh.ipv6h->flow_lbl[1] = 0;
-       (*pskb)->nh.ipv6h->flow_lbl[2] = 0;
-       (*pskb)->nh.ipv6h->hop_limit    = 0;
+       ah = (struct ip_auth_hdr *)(*pskb)->h.raw;
+       ah->nexthdr = nexthdr;
+
+       top_iph->priority    = 0;
+       top_iph->flow_lbl[0] = 0;
+       top_iph->flow_lbl[1] = 0;
+       top_iph->flow_lbl[2] = 0;
+       top_iph->hop_limit   = 0;
 
        ahp = x->data;
        ah->hdrlen  = (XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + 
@@ -219,37 +216,16 @@ int ah6_output(struct sk_buff **pskb)
        ah->seq_no = htonl(++x->replay.oseq);
        ahp->icv(ahp, *pskb, ah->auth_data);
 
-       if (x->props.mode) {
-               (*pskb)->nh.ipv6h->hop_limit   = iph->hop_limit;
-               (*pskb)->nh.ipv6h->priority    = iph->priority;         
-               (*pskb)->nh.ipv6h->flow_lbl[0] = iph->flow_lbl[0];
-               (*pskb)->nh.ipv6h->flow_lbl[1] = iph->flow_lbl[1];
-               (*pskb)->nh.ipv6h->flow_lbl[2] = iph->flow_lbl[2];
-               if (x->props.flags & XFRM_STATE_NOECN)
-                       IP6_ECN_clear((*pskb)->nh.ipv6h);
-       } else {
-               memcpy((*pskb)->nh.ipv6h, iph, hdr_len);
-               (*pskb)->nh.raw[nh_offset] = IPPROTO_AH;
-               (*pskb)->nh.ipv6h->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
-               kfree (iph);
-       }
-
-       (*pskb)->nh.raw = (*pskb)->data;
+       err = 0;
 
-       x->curlft.bytes += (*pskb)->len;
-       x->curlft.packets++;
-       spin_unlock_bh(&x->lock);
-       if (((*pskb)->dst = dst_pop(dst)) == NULL) {
-               err = -EHOSTUNREACH;
-               goto error_nolock;
-       }
-       return NET_XMIT_BYPASS;
+       memcpy(top_iph, tmp_base, sizeof(tmp_base));
+       if (tmp_ext) {
+               memcpy(&top_iph->daddr, tmp_ext, extlen);
 error_free_iph:
-       kfree(iph);
+               kfree(tmp_ext);
+       }
+
 error:
-       spin_unlock_bh(&x->lock);
-error_nolock:
-       kfree_skb(*pskb);
        return err;
 }
 
@@ -259,7 +235,6 @@ int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_bu
         * Before process AH
         * [IPv6][Ext1][Ext2][AH][Dest][Payload]
         * |<-------------->| hdr_len
-        * |<------------------------>| cleared_hlen
         *
         * To erase AH:
         * Keeping copy of cleared headers. After AH processing,
@@ -276,10 +251,7 @@ int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_bu
        unsigned char *tmp_hdr = NULL;
        u16 hdr_len;
        u16 ah_hlen;
-       u16 cleared_hlen;
-       u16 nh_offset = 0;
-       u8 nexthdr = 0;
-       u8 *prevhdr;
+       int nexthdr;
 
        if (!pskb_may_pull(skb, sizeof(struct ip_auth_hdr)))
                goto out;
@@ -291,17 +263,10 @@ int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_bu
                goto out;
 
        hdr_len = skb->data - skb->nh.raw;
-       cleared_hlen = hdr_len;
        ah = (struct ipv6_auth_hdr*)skb->data;
        ahp = x->data;
        nexthdr = ah->nexthdr;
        ah_hlen = (ah->hdrlen + 2) << 2;
-       cleared_hlen += ah_hlen;
-
-       if (nexthdr == NEXTHDR_DEST) {
-               struct ipv6_opt_hdr *dsthdr = (struct ipv6_opt_hdr*)(skb->data + ah_hlen);
-               cleared_hlen += ipv6_optlen(dsthdr);
-       }
 
         if (ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_full_len) &&
             ah_hlen != XFRM_ALIGN8(sizeof(struct ipv6_auth_hdr) + ahp->icv_trunc_len))
@@ -310,11 +275,12 @@ int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_bu
        if (!pskb_may_pull(skb, ah_hlen))
                goto out;
 
-       tmp_hdr = kmalloc(cleared_hlen, GFP_ATOMIC);
+       tmp_hdr = kmalloc(hdr_len, GFP_ATOMIC);
        if (!tmp_hdr)
                goto out;
-       memcpy(tmp_hdr, skb->nh.raw, cleared_hlen);
-       ipv6_clear_mutable_options(skb, &nh_offset, XFRM_POLICY_IN);
+       memcpy(tmp_hdr, skb->nh.raw, hdr_len);
+       if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len))
+               goto out;
        skb->nh.ipv6h->priority    = 0;
        skb->nh.ipv6h->flow_lbl[0] = 0;
        skb->nh.ipv6h->flow_lbl[1] = 0;
@@ -338,13 +304,6 @@ int ah6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_bu
 
        skb->nh.raw = skb_pull(skb, ah_hlen);
        memcpy(skb->nh.raw, tmp_hdr, hdr_len);
-       if (nexthdr == NEXTHDR_DEST) {
-               memcpy(skb->nh.raw + hdr_len,
-                      tmp_hdr + hdr_len + ah_hlen,
-                      cleared_hlen - hdr_len - ah_hlen);
-       }
-       prevhdr = (u8*)(skb->nh.raw + nh_offset);
-       *prevhdr = nexthdr;
        skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
        skb_pull(skb, hdr_len);
        skb->h.raw = skb->data;
index 8682cf1..4977271 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/esp.h>
 int esp6_output(struct sk_buff **pskb)
 {
        int err;
-       int hdr_len = 0;
+       int hdr_len;
        struct dst_entry *dst = (*pskb)->dst;
        struct xfrm_state *x  = dst->xfrm;
-       struct ipv6hdr *iph = NULL, *top_iph;
+       struct ipv6hdr *top_iph;
        struct ipv6_esp_hdr *esph;
        struct crypto_tfm *tfm;
        struct esp_data *esp;
@@ -53,37 +52,13 @@ int esp6_output(struct sk_buff **pskb)
        int clen;
        int alen;
        int nfrags;
-       u8 *prevhdr;
-       u8 nexthdr = 0;
 
-       if ((*pskb)->ip_summed == CHECKSUM_HW) {
-               err = skb_checksum_help(pskb, 0);
-               if (err)
-                       goto error_nolock;
-       }
+       esp = x->data;
+       hdr_len = (*pskb)->h.raw - (*pskb)->data +
+                 sizeof(*esph) + esp->conf.ivlen;
 
-       spin_lock_bh(&x->lock);
-       err = xfrm_state_check(x, *pskb);
-       if (err)
-               goto error;
-
-       if (x->props.mode) {
-               err = xfrm6_tunnel_check_size(*pskb);
-               if (err)
-                       goto error;
-       } else {
-               /* Strip IP header in transport mode. Save it. */
-               hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr);
-               nexthdr = *prevhdr;
-               *prevhdr = IPPROTO_ESP;
-               iph = kmalloc(hdr_len, GFP_ATOMIC);
-               if (!iph) {
-                       err = -ENOMEM;
-                       goto error;
-               }
-               memcpy(iph, (*pskb)->nh.raw, hdr_len);
-               __skb_pull(*pskb, hdr_len);
-       }
+       /* Strip IP+ESP header. */
+       __skb_pull(*pskb, hdr_len);
 
        /* Now skb is pure payload to encrypt */
        err = -ENOMEM;
@@ -91,7 +66,6 @@ int esp6_output(struct sk_buff **pskb)
        /* Round to block size */
        clen = (*pskb)->len;
 
-       esp = x->data;
        alen = esp->auth.icv_trunc_len;
        tfm = esp->conf.tfm;
        blksize = (crypto_tfm_alg_blocksize(tfm) + 3) & ~3;
@@ -100,7 +74,6 @@ int esp6_output(struct sk_buff **pskb)
                clen = (clen + esp->conf.padlen-1)&~(esp->conf.padlen-1);
 
        if ((nfrags = skb_cow_data(*pskb, clen-(*pskb)->len+alen, &trailer)) < 0) {
-               if (!x->props.mode && iph) kfree(iph);
                goto error;
        }
 
@@ -113,34 +86,11 @@ int esp6_output(struct sk_buff **pskb)
        *(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2;
        pskb_put(*pskb, trailer, clen - (*pskb)->len);
 
-       if (x->props.mode) {
-               iph = (*pskb)->nh.ipv6h;
-               top_iph = (struct ipv6hdr*)skb_push(*pskb, x->props.header_len);
-               esph = (struct ipv6_esp_hdr*)(top_iph+1);
-               *(u8*)(trailer->tail - 1) = IPPROTO_IPV6;
-               top_iph->version = 6;
-               top_iph->priority = iph->priority;
-               top_iph->flow_lbl[0] = iph->flow_lbl[0];
-               top_iph->flow_lbl[1] = iph->flow_lbl[1];
-               top_iph->flow_lbl[2] = iph->flow_lbl[2];
-               if (x->props.flags & XFRM_STATE_NOECN)
-                       IP6_ECN_clear(top_iph);
-               top_iph->nexthdr = IPPROTO_ESP;
-               top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr));
-               top_iph->hop_limit = iph->hop_limit;
-               ipv6_addr_copy(&top_iph->saddr,
-                              (struct in6_addr *)&x->props.saddr);
-               ipv6_addr_copy(&top_iph->daddr,
-                              (struct in6_addr *)&x->id.daddr);
-       } else { 
-               esph = (struct ipv6_esp_hdr*)skb_push(*pskb, x->props.header_len);
-               (*pskb)->h.raw = (unsigned char*)esph;
-               top_iph = (struct ipv6hdr*)skb_push(*pskb, hdr_len);
-               memcpy(top_iph, iph, hdr_len);
-               kfree(iph);
-               top_iph->payload_len = htons((*pskb)->len + alen - sizeof(struct ipv6hdr));
-               *(u8*)(trailer->tail - 1) = nexthdr;
-       }
+       top_iph = (struct ipv6hdr *)__skb_push(*pskb, hdr_len);
+       esph = (struct ipv6_esp_hdr *)(*pskb)->h.raw;
+       top_iph->payload_len = htons((*pskb)->len + alen - sizeof(*top_iph));
+       *(u8*)(trailer->tail - 1) = *(*pskb)->nh.raw;
+       *(*pskb)->nh.raw = IPPROTO_ESP;
 
        esph->spi = x->id.spi;
        esph->seq_no = htonl(++x->replay.oseq);
@@ -173,21 +123,9 @@ int esp6_output(struct sk_buff **pskb)
                pskb_put(*pskb, trailer, alen);
        }
 
-       (*pskb)->nh.raw = (*pskb)->data;
-
-       x->curlft.bytes += (*pskb)->len;
-       x->curlft.packets++;
-       spin_unlock_bh(&x->lock);
-       if (((*pskb)->dst = dst_pop(dst)) == NULL) {
-               err = -EHOSTUNREACH;
-               goto error_nolock;
-       }
-       return NET_XMIT_BYPASS;
+       err = 0;
 
 error:
-       spin_unlock_bh(&x->lock);
-error_nolock:
-       kfree_skb(*pskb);
        return err;
 }
 
@@ -258,7 +196,6 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
                u8 nexthdr[2];
                struct scatterlist *sg = &esp->sgbuf[0];
                u8 padlen;
-               u8 *prevhdr;
 
                if (unlikely(nfrags > ESP_NUM_FAST_SG)) {
                        sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
@@ -289,8 +226,7 @@ int esp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_b
                skb->nh.raw += sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen;
                memcpy(skb->nh.raw, tmp_hdr, hdr_len);
                skb->nh.ipv6h->payload_len = htons(skb->len - sizeof(struct ipv6hdr));
-               ip6_find_1stfragopt(skb, &prevhdr);
-               ret = *prevhdr = nexthdr[1];
+               ret = nexthdr[1];
        }
 
 out:
index ff12dcf..464a3f4 100644 (file)
@@ -159,7 +159,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 
        if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
            !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
                return -1;
        }
@@ -172,7 +172,7 @@ static int ipv6_destopt_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
                return 1;
        }
 
-       IP6_INC_STATS_BH(InHdrErrors);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
        return -1;
 }
 
@@ -227,7 +227,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 
        if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8) ||
            !pskb_may_pull(skb, (skb->h.raw-skb->data)+((skb->h.raw[1]+1)<<3))) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                kfree_skb(skb);
                return -1;
        }
@@ -236,7 +236,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 
        if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
            skb->pkt_type != PACKET_HOST) {
-               IP6_INC_STATS_BH(InAddrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
                kfree_skb(skb);
                return -1;
        }
@@ -252,13 +252,13 @@ looped_back:
        }
 
        if (hdr->type != IPV6_SRCRT_TYPE_0) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->type) - skb->nh.raw);
                return -1;
        }
        
        if (hdr->hdrlen & 0x01) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->hdrlen) - skb->nh.raw);
                return -1;
        }
@@ -271,7 +271,7 @@ looped_back:
        n = hdr->hdrlen >> 1;
 
        if (hdr->segments_left > n) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, (&hdr->segments_left) - skb->nh.raw);
                return -1;
        }
@@ -284,7 +284,7 @@ looped_back:
                kfree_skb(skb);
                /* the copy is a forwarded packet */
                if (skb2 == NULL) {
-                       IP6_INC_STATS_BH(OutDiscards);  
+                       IP6_INC_STATS_BH(IPSTATS_MIB_OUTDISCARDS);      
                        return -1;
                }
                *skbp = skb = skb2;
@@ -302,7 +302,7 @@ looped_back:
        addr += i - 1;
 
        if (ipv6_addr_is_multicast(addr)) {
-               IP6_INC_STATS_BH(InAddrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
                kfree_skb(skb);
                return -1;
        }
@@ -319,7 +319,7 @@ looped_back:
        }
        if (skb->dst->dev->flags&IFF_LOOPBACK) {
                if (skb->nh.ipv6h->hop_limit <= 1) {
-                       IP6_INC_STATS_BH(InHdrErrors);
+                       IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                        icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
                                    0, skb->dev);
                        kfree_skb(skb);
@@ -436,24 +436,24 @@ static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
        if (skb->nh.raw[optoff+1] != 4 || (optoff&3) != 2) {
                LIMIT_NETDEBUG(
                         printk(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n", skb->nh.raw[optoff+1]));
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                goto drop;
        }
 
        pkt_len = ntohl(*(u32*)(skb->nh.raw+optoff+2));
        if (pkt_len <= IPV6_MAXPLEN) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
                return 0;
        }
        if (skb->nh.ipv6h->payload_len) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
                return 0;
        }
 
        if (pkt_len > skb->len - sizeof(struct ipv6hdr)) {
-               IP6_INC_STATS_BH(InTruncatedPkts);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS);
                goto drop;
        }
        if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
index 6bc7ebc..4faafff 100644 (file)
@@ -174,7 +174,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type,
         */
        dst = ip6_route_output(sk, fl);
        if (dst->error) {
-               IP6_INC_STATS(OutNoRoutes);
+               IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
        } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) {
                res = 1;
        } else {
@@ -404,8 +404,8 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
        err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, len + sizeof(struct icmp6hdr));
 
        if (type >= ICMPV6_DEST_UNREACH && type <= ICMPV6_PARAMPROB)
-               ICMP6_INC_STATS_OFFSET_BH(idev, Icmp6OutDestUnreachs, type - ICMPV6_DEST_UNREACH);
-       ICMP6_INC_STATS_BH(idev, Icmp6OutMsgs);
+               ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_OUTDESTUNREACHS, type - ICMPV6_DEST_UNREACH);
+       ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
 
 out_put:
        if (likely(idev != NULL))
@@ -480,8 +480,8 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
        }
        err = icmpv6_push_pending_frames(sk, &fl, &tmp_hdr, skb->len + sizeof(struct icmp6hdr));
 
-        ICMP6_INC_STATS_BH(idev, Icmp6OutEchoReplies);
-        ICMP6_INC_STATS_BH(idev, Icmp6OutMsgs);
+        ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTECHOREPLIES);
+        ICMP6_INC_STATS_BH(idev, ICMP6_MIB_OUTMSGS);
 
 out_put: 
        if (likely(idev != NULL))
@@ -560,7 +560,7 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
        struct icmp6hdr *hdr;
        int type;
 
-       ICMP6_INC_STATS_BH(idev, Icmp6InMsgs);
+       ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS);
 
        saddr = &skb->nh.ipv6h->saddr;
        daddr = &skb->nh.ipv6h->daddr;
@@ -593,9 +593,9 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
        type = hdr->icmp6_type;
 
        if (type >= ICMPV6_DEST_UNREACH && type <= ICMPV6_PARAMPROB)
-               ICMP6_INC_STATS_OFFSET_BH(idev, Icmp6InDestUnreachs, type - ICMPV6_DEST_UNREACH);
+               ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_INDESTUNREACHS, type - ICMPV6_DEST_UNREACH);
        else if (type >= ICMPV6_ECHO_REQUEST && type <= NDISC_REDIRECT)
-               ICMP6_INC_STATS_OFFSET_BH(idev, Icmp6InEchos, type - ICMPV6_ECHO_REQUEST);
+               ICMP6_INC_STATS_OFFSET_BH(idev, ICMP6_MIB_INECHOS, type - ICMPV6_ECHO_REQUEST);
 
        switch (type) {
        case ICMPV6_ECHO_REQUEST:
@@ -646,7 +646,13 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
                break;
 
        case ICMPV6_MGM_REDUCTION:
+       case ICMPV6_NI_QUERY:
+       case ICMPV6_NI_REPLY:
        case ICMPV6_MLD2_REPORT:
+       case ICMPV6_DHAAD_REQUEST:
+       case ICMPV6_DHAAD_REPLY:
+       case ICMPV6_MOBILE_PREFIX_SOL:
+       case ICMPV6_MOBILE_PREFIX_ADV:
                break;
 
        default:
@@ -668,7 +674,7 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
        return 0;
 
 discard_it:
-       ICMP6_INC_STATS_BH(idev, Icmp6InErrors);
+       ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INERRORS);
        kfree_skb(skb);
        return 0;
 }
index 5c885fa..2c5aab0 100644 (file)
@@ -645,8 +645,8 @@ static void ip6fl_fl_seq_show(struct seq_file *seq, struct ip6_flowlabel *fl)
 static int ip6fl_seq_show(struct seq_file *seq, void *v)
 {
        if (v == SEQ_START_TOKEN)
-               seq_printf(seq, "Label S Owner  Users  Linger Expires  "
-                               "Dst                              Opt\n");
+               seq_puts(seq, "Label S Owner  Users  Linger Expires  "
+                             "Dst                              Opt\n");
        else
                ip6fl_fl_seq_show(seq, v);
        return 0;
index 0be5945..9b9cee7 100644 (file)
@@ -64,10 +64,10 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        if (skb->pkt_type == PACKET_OTHERHOST)
                goto drop;
 
-       IP6_INC_STATS_BH(InReceives);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INRECEIVES);
 
        if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
-               IP6_INC_STATS_BH(InDiscards);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
                goto out;
        }
 
@@ -80,7 +80,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
                goto err;
 
        if (!pskb_may_pull(skb, sizeof(struct ipv6hdr))) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                goto drop;
        }
 
@@ -97,7 +97,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
                        goto truncated;
                if (pkt_len + sizeof(struct ipv6hdr) < skb->len) {
                        if (__pskb_trim(skb, pkt_len + sizeof(struct ipv6hdr))){
-                               IP6_INC_STATS_BH(InHdrErrors);
+                               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                                goto drop;
                        }
                        hdr = skb->nh.ipv6h;
@@ -109,7 +109,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
        if (hdr->nexthdr == NEXTHDR_HOP) {
                skb->h.raw = (u8*)(hdr+1);
                if (ipv6_parse_hopopts(skb, offsetof(struct ipv6hdr, nexthdr)) < 0) {
-                       IP6_INC_STATS_BH(InHdrErrors);
+                       IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                        return 0;
                }
                hdr = skb->nh.ipv6h;
@@ -117,9 +117,9 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
 
        return NF_HOOK(PF_INET6,NF_IP6_PRE_ROUTING, skb, dev, NULL, ip6_rcv_finish);
 truncated:
-       IP6_INC_STATS_BH(InTruncatedPkts);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INTRUNCATEDPKTS);
 err:
-       IP6_INC_STATS_BH(InHdrErrors);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
 drop:
        kfree_skb(skb);
 out:
@@ -194,15 +194,15 @@ resubmit:
                if (ret > 0)
                        goto resubmit;
                else if (ret == 0)
-                       IP6_INC_STATS_BH(InDelivers);
+                       IP6_INC_STATS_BH(IPSTATS_MIB_INDELIVERS);
        } else {
                if (!raw_sk) {
                        if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-                               IP6_INC_STATS_BH(InUnknownProtos);
+                               IP6_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS);
                                icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff);
                        }
                } else {
-                       IP6_INC_STATS_BH(InDelivers);
+                       IP6_INC_STATS_BH(IPSTATS_MIB_INDELIVERS);
                        kfree_skb(skb);
                }
        }
@@ -210,7 +210,7 @@ resubmit:
        return 0;
 
 discard:
-       IP6_INC_STATS_BH(InDiscards);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INDISCARDS);
        rcu_read_unlock();
        kfree_skb(skb);
        return 0;
@@ -227,7 +227,7 @@ int ip6_mc_input(struct sk_buff *skb)
        struct ipv6hdr *hdr;
        int deliver;
 
-       IP6_INC_STATS_BH(InMcastPkts);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INMCASTPKTS);
 
        hdr = skb->nh.ipv6h;
        deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
index 8791db7..81eed71 100644 (file)
@@ -87,7 +87,7 @@ static inline int ip6_output_finish(struct sk_buff *skb)
        } else if (dst->neighbour)
                return dst->neighbour->output(skb);
 
-       IP6_INC_STATS_BH(OutNoRoutes);
+       IP6_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
        kfree_skb(skb);
        return -EINVAL;
 
@@ -133,13 +133,13 @@ static int ip6_output2(struct sk_buff **pskb)
                                        ip6_dev_loopback_xmit);
 
                        if (skb->nh.ipv6h->hop_limit == 0) {
-                               IP6_INC_STATS(OutDiscards);
+                               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
                                kfree_skb(skb);
                                return 0;
                        }
                }
 
-               IP6_INC_STATS(OutMcastPkts);
+               IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
        }
 
        return NF_HOOK(PF_INET6, NF_IP6_POST_ROUTING, skb,NULL, skb->dev,ip6_output_finish);
@@ -172,7 +172,7 @@ int ip6_route_me_harder(struct sk_buff *skb)
        dst = ip6_route_output(skb->sk, &fl);
 
        if (dst->error) {
-               IP6_INC_STATS(OutNoRoutes);
+               IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
                LIMIT_NETDEBUG(
                        printk(KERN_DEBUG "ip6_route_me_harder: No more route.\n"));
                dst_release(dst);
@@ -231,7 +231,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
                        kfree_skb(skb);
                        skb = skb2;
                        if (skb == NULL) {      
-                               IP6_INC_STATS(OutDiscards);
+                               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
                                return -ENOBUFS;
                        }
                        if (sk)
@@ -265,7 +265,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
 
        mtu = dst_pmtu(dst);
        if ((skb->len <= mtu) || ipfragok) {
-               IP6_INC_STATS(OutRequests);
+               IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
                return NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, ip6_maybe_reroute);
        }
 
@@ -273,7 +273,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
                printk(KERN_DEBUG "IPv6: sending pkt_too_big to self\n");
        skb->dev = dst->dev;
        icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev);
-       IP6_INC_STATS(FragFails);
+       IP6_INC_STATS(IPSTATS_MIB_FRAGFAILS);
        kfree_skb(skb);
        return -EMSGSIZE;
 }
@@ -355,7 +355,7 @@ int ip6_forward(struct sk_buff *skb)
                goto error;
 
        if (!xfrm6_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
-               IP6_INC_STATS(InDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_INDISCARDS);
                goto drop;
        }
 
@@ -394,7 +394,7 @@ int ip6_forward(struct sk_buff *skb)
        }
 
        if (!xfrm6_route_forward(skb)) {
-               IP6_INC_STATS(InDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_INDISCARDS);
                goto drop;
        }
 
@@ -432,14 +432,14 @@ int ip6_forward(struct sk_buff *skb)
                /* Again, force OUTPUT device used as source address */
                skb->dev = dst->dev;
                icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_pmtu(dst), skb->dev);
-               IP6_INC_STATS_BH(InTooBigErrors);
-               IP6_INC_STATS_BH(FragFails);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INTOOBIGERRORS);
+               IP6_INC_STATS_BH(IPSTATS_MIB_FRAGFAILS);
                kfree_skb(skb);
                return -EMSGSIZE;
        }
 
        if (skb_cow(skb, dst->dev->hard_header_len)) {
-               IP6_INC_STATS(OutDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
                goto drop;
        }
 
@@ -449,11 +449,11 @@ int ip6_forward(struct sk_buff *skb)
  
        hdr->hop_limit--;
 
-       IP6_INC_STATS_BH(OutForwDatagrams);
+       IP6_INC_STATS_BH(IPSTATS_MIB_OUTFORWDATAGRAMS);
        return NF_HOOK(PF_INET6,NF_IP6_FORWARD, skb, skb->dev, dst->dev, ip6_forward_finish);
 
 error:
-       IP6_INC_STATS_BH(InAddrErrors);
+       IP6_INC_STATS_BH(IPSTATS_MIB_INADDRERRORS);
 drop:
        kfree_skb(skb);
        return -EINVAL;
@@ -566,7 +566,7 @@ static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**))
 
                tmp_hdr = kmalloc(hlen, GFP_ATOMIC);
                if (!tmp_hdr) {
-                       IP6_INC_STATS(FragFails);
+                       IP6_INC_STATS(IPSTATS_MIB_FRAGFAILS);
                        return -ENOMEM;
                }
 
@@ -621,7 +621,7 @@ static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**))
                        kfree(tmp_hdr);
 
                if (err == 0) {
-                       IP6_INC_STATS(FragOKs);
+                       IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);
                        return 0;
                }
 
@@ -631,7 +631,7 @@ static int ip6_fragment(struct sk_buff **pskb, int (*output)(struct sk_buff**))
                        frag = skb;
                }
 
-               IP6_INC_STATS(FragFails);
+               IP6_INC_STATS(IPSTATS_MIB_FRAGFAILS);
                return err;
        }
 
@@ -664,7 +664,7 @@ slow_path:
 
                if ((frag = alloc_skb(len+hlen+sizeof(struct frag_hdr)+LL_RESERVED_SPACE(rt->u.dst.dev), GFP_ATOMIC)) == NULL) {
                        NETDEBUG(printk(KERN_INFO "IPv6: frag: no memory for new fragment!\n"));
-                       IP6_INC_STATS(FragFails);
+                       IP6_INC_STATS(IPSTATS_MIB_FRAGFAILS);
                        err = -ENOMEM;
                        goto fail;
                }
@@ -722,19 +722,19 @@ slow_path:
                 *      Put this fragment into the sending queue.
                 */
 
-               IP6_INC_STATS(FragCreates);
+               IP6_INC_STATS(IPSTATS_MIB_FRAGCREATES);
 
                err = output(&frag);
                if (err)
                        goto fail;
        }
        kfree_skb(skb);
-       IP6_INC_STATS(FragOKs);
+       IP6_INC_STATS(IPSTATS_MIB_FRAGOKS);
        return err;
 
 fail:
        kfree_skb(skb); 
-       IP6_INC_STATS(FragFails);
+       IP6_INC_STATS(IPSTATS_MIB_FRAGFAILS);
        return err;
 }
 
@@ -1019,7 +1019,7 @@ alloc_new_skb:
        return 0;
 error:
        inet->cork.length -= length;
-       IP6_INC_STATS(OutDiscards);
+       IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        return err;
 }
 
@@ -1079,7 +1079,7 @@ int ip6_push_pending_frames(struct sock *sk)
        ipv6_addr_copy(&hdr->daddr, final_dst);
 
        skb->dst = dst_clone(&rt->u.dst);
-       IP6_INC_STATS(OutRequests);     
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dst->dev, dst_output);
        if (err) {
                if (err > 0)
@@ -1111,7 +1111,7 @@ void ip6_flush_pending_frames(struct sock *sk)
        struct sk_buff *skb;
 
        while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
-               IP6_INC_STATS(OutDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
                kfree_skb(skb);
        }
 
index 5abb89b..0430376 100644 (file)
@@ -32,7 +32,6 @@
  */
 #include <linux/config.h>
 #include <linux/module.h>
-#include <net/inet_ecn.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/ipcomp.h>
@@ -49,7 +48,6 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s
 {
        int err = 0;
        u8 nexthdr = 0;
-       u8 *prevhdr;
        int hdr_len = skb->h.raw - skb->nh.raw;
        unsigned char *tmp_hdr = NULL;
        struct ipv6hdr *iph;
@@ -106,8 +104,6 @@ static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, s
        iph = skb->nh.ipv6h;
        iph->payload_len = htons(skb->len);
        
-       ip6_find_1stfragopt(skb, &prevhdr);
-       *prevhdr = nexthdr;
 out:
        if (tmp_hdr)
                kfree(tmp_hdr);
@@ -123,52 +119,14 @@ static int ipcomp6_output(struct sk_buff **pskb)
        int err;
        struct dst_entry *dst = (*pskb)->dst;
        struct xfrm_state *x = dst->xfrm;
-       struct ipv6hdr *iph, *top_iph;
-       int hdr_len = 0;
+       struct ipv6hdr *top_iph;
+       int hdr_len;
        struct ipv6_comp_hdr *ipch;
        struct ipcomp_data *ipcd = x->data;
-       u8 *prevhdr;
-       u8 nexthdr = 0;
        int plen, dlen;
        u8 *start, *scratch = ipcd->scratch;
 
-       if ((*pskb)->ip_summed == CHECKSUM_HW) {
-               err = skb_checksum_help(pskb, 0);
-               if (err)
-                       goto error_nolock;
-       }
-
-       spin_lock_bh(&x->lock);
-
-       err = xfrm_state_check(x, *pskb);
-       if (err)
-               goto error;
-
-       if (x->props.mode) {
-               err = xfrm6_tunnel_check_size(*pskb);
-               if (err)
-                       goto error;
-
-               hdr_len = sizeof(struct ipv6hdr);
-               nexthdr = IPPROTO_IPV6;
-               iph = (*pskb)->nh.ipv6h;
-               top_iph = (struct ipv6hdr *)skb_push(*pskb, sizeof(struct ipv6hdr));
-               top_iph->version = 6;
-               top_iph->priority = iph->priority;
-               top_iph->flow_lbl[0] = iph->flow_lbl[0];
-               top_iph->flow_lbl[1] = iph->flow_lbl[1];
-               top_iph->flow_lbl[2] = iph->flow_lbl[2];
-               top_iph->nexthdr = IPPROTO_IPV6; /* initial */
-               top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
-               top_iph->hop_limit = iph->hop_limit;
-               memcpy(&top_iph->saddr, (struct in6_addr *)&x->props.saddr, sizeof(struct in6_addr));
-               memcpy(&top_iph->daddr, (struct in6_addr *)&x->id.daddr, sizeof(struct in6_addr));
-               (*pskb)->nh.raw = (*pskb)->data; /* == top_iph */
-               (*pskb)->h.raw = (*pskb)->nh.raw + hdr_len;
-       } else {
-               hdr_len = ip6_find_1stfragopt(*pskb, &prevhdr);
-               nexthdr = *prevhdr;
-       }
+       hdr_len = (*pskb)->h.raw - (*pskb)->data;
 
        /* check whether datagram len is larger than threshold */
        if (((*pskb)->len - hdr_len) < ipcd->threshold) {
@@ -184,7 +142,7 @@ static int ipcomp6_output(struct sk_buff **pskb)
        /* compression */
        plen = (*pskb)->len - hdr_len;
        dlen = IPCOMP_SCRATCH_SIZE;
-       start = (*pskb)->data + hdr_len;
+       start = (*pskb)->h.raw;
 
        err = crypto_comp_compress(ipcd->tfm, start, plen, scratch, &dlen);
        if (err) {
@@ -197,39 +155,21 @@ static int ipcomp6_output(struct sk_buff **pskb)
        pskb_trim(*pskb, hdr_len + dlen + sizeof(struct ip_comp_hdr));
 
        /* insert ipcomp header and replace datagram */
-       top_iph = (*pskb)->nh.ipv6h;
+       top_iph = (struct ipv6hdr *)(*pskb)->data;
 
-       if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
-               IP6_ECN_clear(top_iph);
        top_iph->payload_len = htons((*pskb)->len - sizeof(struct ipv6hdr));
-       (*pskb)->nh.raw = (*pskb)->data; /* top_iph */
-       ip6_find_1stfragopt(*pskb, &prevhdr); 
-       *prevhdr = IPPROTO_COMP;
 
-       ipch = (struct ipv6_comp_hdr *)((unsigned char *)top_iph + hdr_len);
-       ipch->nexthdr = nexthdr;
+       ipch = (struct ipv6_comp_hdr *)start;
+       ipch->nexthdr = *(*pskb)->nh.raw;
        ipch->flags = 0;
        ipch->cpi = htons((u16 )ntohl(x->id.spi));
+       *(*pskb)->nh.raw = IPPROTO_COMP;
 
-       (*pskb)->h.raw = (unsigned char*)ipch;
 out_ok:
-       x->curlft.bytes += (*pskb)->len;
-       x->curlft.packets++;
-       spin_unlock_bh(&x->lock);
-
-       if (((*pskb)->dst = dst_pop(dst)) == NULL) {
-               err = -EHOSTUNREACH;
-               goto error_nolock;
-       }
-       err = NET_XMIT_BYPASS;
+       err = 0;
 
-out_exit:
-       return err;
 error:
-       spin_unlock_bh(&x->lock);
-error_nolock:
-       kfree_skb(*pskb);
-       goto out_exit;
+       return err;
 }
 
 static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
@@ -240,7 +180,7 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        struct ipv6_comp_hdr *ipcomph = (struct ipv6_comp_hdr*)(skb->data+offset);
        struct xfrm_state *x;
 
-       if (type != ICMPV6_DEST_UNREACH || type != ICMPV6_PKT_TOOBIG)
+       if (type != ICMPV6_DEST_UNREACH && type != ICMPV6_PKT_TOOBIG)
                return;
 
        spi = ntohl(ntohs(ipcomph->cpi));
index da0719a..893fe40 100644 (file)
@@ -1317,7 +1317,7 @@ static void mld_sendpack(struct sk_buff *skb)
        struct inet6_dev *idev = in6_dev_get(skb->dev);
        int err;
 
-       IP6_INC_STATS(OutRequests);
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
        payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h -
                sizeof(struct ipv6hdr);
        mldlen = skb->tail - skb->h.raw;
@@ -1328,10 +1328,10 @@ static void mld_sendpack(struct sk_buff *skb)
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, skb->dev,
                dev_queue_xmit);
        if (!err) {
-               ICMP6_INC_STATS(idev,Icmp6OutMsgs);
-               IP6_INC_STATS(OutMcastPkts);
+               ICMP6_INC_STATS(idev,ICMP6_MIB_OUTMSGS);
+               IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
        } else
-               IP6_INC_STATS(OutDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
 
        if (likely(idev != NULL))
                in6_dev_put(idev);
@@ -1613,7 +1613,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
                     IPV6_TLV_ROUTERALERT, 2, 0, 0,
                     IPV6_TLV_PADN, 0 };
 
-       IP6_INC_STATS(OutRequests);
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
        snd_addr = addr;
        if (type == ICMPV6_MGM_REDUCTION) {
                snd_addr = &all_routers;
@@ -1627,7 +1627,7 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
        skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
 
        if (skb == NULL) {
-               IP6_INC_STATS(OutDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
                return;
        }
 
@@ -1668,20 +1668,20 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
                dev_queue_xmit);
        if (!err) {
                if (type == ICMPV6_MGM_REDUCTION)
-                       ICMP6_INC_STATS(idev, Icmp6OutGroupMembReductions);
+                       ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBREDUCTIONS);
                else
-                       ICMP6_INC_STATS(idev, Icmp6OutGroupMembResponses);
-               ICMP6_INC_STATS(idev, Icmp6OutMsgs);
-               IP6_INC_STATS(OutMcastPkts);
+                       ICMP6_INC_STATS(idev, ICMP6_MIB_OUTGROUPMEMBRESPONSES);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
+               IP6_INC_STATS(IPSTATS_MIB_OUTMCASTPKTS);
        } else
-               IP6_INC_STATS(OutDiscards);
+               IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
 
        if (likely(idev != NULL))
                in6_dev_put(idev);
        return;
 
 out:
-       IP6_INC_STATS(OutDiscards);
+       IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        kfree_skb(skb);
 }
 
index 3b6d83e..b278e5a 100644 (file)
@@ -452,11 +452,11 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
 
        skb->dst = dst;
        idev = in6_dev_get(dst->dev);
-       IP6_INC_STATS(OutRequests);
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, Icmp6OutNeighborAdvertisements);
-               ICMP6_INC_STATS(idev, Icmp6OutMsgs);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
        if (likely(idev != NULL))
@@ -536,11 +536,11 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
        /* send it! */
        skb->dst = dst;
        idev = in6_dev_get(dst->dev);
-       IP6_INC_STATS(OutRequests);
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, Icmp6OutNeighborSolicits);
-               ICMP6_INC_STATS(idev, Icmp6OutMsgs);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTNEIGHBORSOLICITS);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
        if (likely(idev != NULL))
@@ -609,11 +609,11 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
        /* send it! */
        skb->dst = dst;
        idev = in6_dev_get(dst->dev);
-       IP6_INC_STATS(OutRequests);     
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS); 
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, Icmp6OutRouterSolicits);
-               ICMP6_INC_STATS(idev, Icmp6OutMsgs);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTROUTERSOLICITS);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
        if (likely(idev != NULL))
@@ -1335,11 +1335,11 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 
        buff->dst = dst;
        idev = in6_dev_get(dst->dev);
-       IP6_INC_STATS(OutRequests);
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, buff, NULL, dst->dev, dst_output);
        if (!err) {
-               ICMP6_INC_STATS(idev, Icmp6OutRedirects);
-               ICMP6_INC_STATS(idev, Icmp6OutMsgs);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTREDIRECTS);
+               ICMP6_INC_STATS(idev, ICMP6_MIB_OUTMSGS);
        }
 
        if (likely(idev != NULL))
@@ -1423,7 +1423,7 @@ static struct notifier_block ndisc_netdev_notifier = {
 };
 
 #ifdef CONFIG_SYSCTL
-int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp)
+int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * filp, void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        struct net_device *dev = ctl->extra1;
        struct inet6_dev *idev;
@@ -1433,7 +1433,7 @@ int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write, struct file * f
                inet6_ifinfo_notify(RTM_NEWLINK, idev);
                in6_dev_put(idev);
        }
-       return proc_dointvec(ctl, write, filp, buffer, lenp);
+       return proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
 }
 #endif
 
index fda6285..3330ba6 100644 (file)
@@ -57,36 +57,34 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct snmp_item snmp6_ipstats_list[] = {
+static struct snmp_mib snmp6_ipstats_list[] = {
 /* ipv6 mib according to RFC 2465 */
-#define SNMP6_GEN(x)   SNMP_ITEM(struct ipstats_mib, x, "Ip6" #x)
-       SNMP6_GEN(InReceives),
-       SNMP6_GEN(InHdrErrors),
-       SNMP6_GEN(InTooBigErrors),
-       SNMP6_GEN(InNoRoutes),
-       SNMP6_GEN(InAddrErrors),
-       SNMP6_GEN(InUnknownProtos),
-       SNMP6_GEN(InTruncatedPkts),
-       SNMP6_GEN(InDiscards),
-       SNMP6_GEN(InDelivers),
-       SNMP6_GEN(OutForwDatagrams),
-       SNMP6_GEN(OutRequests),
-       SNMP6_GEN(OutDiscards),
-       SNMP6_GEN(OutNoRoutes),
-       SNMP6_GEN(ReasmTimeout),
-       SNMP6_GEN(ReasmReqds),
-       SNMP6_GEN(ReasmOKs),
-       SNMP6_GEN(ReasmFails),
-       SNMP6_GEN(FragOKs),
-       SNMP6_GEN(FragFails),
-       SNMP6_GEN(FragCreates),
-       SNMP6_GEN(InMcastPkts),
-       SNMP6_GEN(OutMcastPkts),
-#undef SNMP6_GEN
-       SNMP_ITEM_SENTINEL
+       SNMP_MIB_ITEM("Ip6InReceives", IPSTATS_MIB_INRECEIVES),
+       SNMP_MIB_ITEM("Ip6InHdrErrors", IPSTATS_MIB_INHDRERRORS),
+       SNMP_MIB_ITEM("Ip6InTooBigErrors", IPSTATS_MIB_INTOOBIGERRORS),
+       SNMP_MIB_ITEM("Ip6InNoRoutes", IPSTATS_MIB_INNOROUTES),
+       SNMP_MIB_ITEM("Ip6InAddrErrors", IPSTATS_MIB_INADDRERRORS),
+       SNMP_MIB_ITEM("Ip6InUnknownProtos", IPSTATS_MIB_INUNKNOWNPROTOS),
+       SNMP_MIB_ITEM("Ip6InTruncatedPkts", IPSTATS_MIB_INTRUNCATEDPKTS),
+       SNMP_MIB_ITEM("Ip6InDiscards", IPSTATS_MIB_INDISCARDS),
+       SNMP_MIB_ITEM("Ip6InDelivers", IPSTATS_MIB_INDELIVERS),
+       SNMP_MIB_ITEM("Ip6OutForwDatagrams", IPSTATS_MIB_OUTFORWDATAGRAMS),
+       SNMP_MIB_ITEM("Ip6OutRequests", IPSTATS_MIB_OUTREQUESTS),
+       SNMP_MIB_ITEM("Ip6OutDiscards", IPSTATS_MIB_OUTDISCARDS),
+       SNMP_MIB_ITEM("Ip6OutNoRoutes", IPSTATS_MIB_OUTNOROUTES),
+       SNMP_MIB_ITEM("Ip6ReasmTimeout", IPSTATS_MIB_REASMTIMEOUT),
+       SNMP_MIB_ITEM("Ip6ReasmReqds", IPSTATS_MIB_REASMREQDS),
+       SNMP_MIB_ITEM("Ip6ReasmOKs", IPSTATS_MIB_REASMOKS),
+       SNMP_MIB_ITEM("Ip6ReasmFails", IPSTATS_MIB_REASMFAILS),
+       SNMP_MIB_ITEM("Ip6FragOKs", IPSTATS_MIB_FRAGOKS),
+       SNMP_MIB_ITEM("Ip6FragFails", IPSTATS_MIB_FRAGFAILS),
+       SNMP_MIB_ITEM("Ip6FragCreates", IPSTATS_MIB_FRAGCREATES),
+       SNMP_MIB_ITEM("Ip6InMcastPkts", IPSTATS_MIB_INMCASTPKTS),
+       SNMP_MIB_ITEM("Ip6OutMcastPkts", IPSTATS_MIB_OUTMCASTPKTS),
+       SNMP_MIB_SENTINEL
 };
 
-static struct snmp_item snmp6_icmp6_list[] = {
+static struct snmp_mib snmp6_icmp6_list[] = {
 /* icmpv6 mib according to RFC 2466
 
    Exceptions:  {In|Out}AdminProhibs are removed, because I see
@@ -97,47 +95,43 @@ static struct snmp_item snmp6_icmp6_list[] = {
                OutRouterAdvertisements too.
                OutGroupMembQueries too.
  */
-#define SNMP6_GEN(x)   SNMP_ITEM(struct icmpv6_mib, x, #x)
-       SNMP6_GEN(Icmp6InMsgs),
-       SNMP6_GEN(Icmp6InErrors),
-       SNMP6_GEN(Icmp6InDestUnreachs),
-       SNMP6_GEN(Icmp6InPktTooBigs),
-       SNMP6_GEN(Icmp6InTimeExcds),
-       SNMP6_GEN(Icmp6InParmProblems),
-       SNMP6_GEN(Icmp6InEchos),
-       SNMP6_GEN(Icmp6InEchoReplies),
-       SNMP6_GEN(Icmp6InGroupMembQueries),
-       SNMP6_GEN(Icmp6InGroupMembResponses),
-       SNMP6_GEN(Icmp6InGroupMembReductions),
-       SNMP6_GEN(Icmp6InRouterSolicits),
-       SNMP6_GEN(Icmp6InRouterAdvertisements),
-       SNMP6_GEN(Icmp6InNeighborSolicits),
-       SNMP6_GEN(Icmp6InNeighborAdvertisements),
-       SNMP6_GEN(Icmp6InRedirects),
-       SNMP6_GEN(Icmp6OutMsgs),
-       SNMP6_GEN(Icmp6OutDestUnreachs),
-       SNMP6_GEN(Icmp6OutPktTooBigs),
-       SNMP6_GEN(Icmp6OutTimeExcds),
-       SNMP6_GEN(Icmp6OutParmProblems),
-       SNMP6_GEN(Icmp6OutEchoReplies),
-       SNMP6_GEN(Icmp6OutRouterSolicits),
-       SNMP6_GEN(Icmp6OutNeighborSolicits),
-       SNMP6_GEN(Icmp6OutNeighborAdvertisements),
-       SNMP6_GEN(Icmp6OutRedirects),
-       SNMP6_GEN(Icmp6OutGroupMembResponses),
-       SNMP6_GEN(Icmp6OutGroupMembReductions),
-#undef SNMP6_GEN
-       SNMP_ITEM_SENTINEL
+       SNMP_MIB_ITEM("Icmp6InMsgs", ICMP6_MIB_INMSGS),
+       SNMP_MIB_ITEM("Icmp6InErrors", ICMP6_MIB_INERRORS),
+       SNMP_MIB_ITEM("Icmp6InDestUnreachs", ICMP6_MIB_INDESTUNREACHS),
+       SNMP_MIB_ITEM("Icmp6InPktTooBigs", ICMP6_MIB_INPKTTOOBIGS),
+       SNMP_MIB_ITEM("Icmp6InTimeExcds", ICMP6_MIB_INTIMEEXCDS),
+       SNMP_MIB_ITEM("Icmp6InParmProblems", ICMP6_MIB_INPARMPROBLEMS),
+       SNMP_MIB_ITEM("Icmp6InEchos", ICMP6_MIB_INECHOS),
+       SNMP_MIB_ITEM("Icmp6InEchoReplies", ICMP6_MIB_INECHOREPLIES),
+       SNMP_MIB_ITEM("Icmp6InGroupMembQueries", ICMP6_MIB_INGROUPMEMBQUERIES),
+       SNMP_MIB_ITEM("Icmp6InGroupMembResponses", ICMP6_MIB_INGROUPMEMBRESPONSES),
+       SNMP_MIB_ITEM("Icmp6InGroupMembReductions", ICMP6_MIB_INGROUPMEMBREDUCTIONS),
+       SNMP_MIB_ITEM("Icmp6InRouterSolicits", ICMP6_MIB_INROUTERSOLICITS),
+       SNMP_MIB_ITEM("Icmp6InRouterAdvertisements", ICMP6_MIB_INROUTERADVERTISEMENTS),
+       SNMP_MIB_ITEM("Icmp6InNeighborSolicits", ICMP6_MIB_INNEIGHBORSOLICITS),
+       SNMP_MIB_ITEM("Icmp6InNeighborAdvertisements", ICMP6_MIB_INNEIGHBORADVERTISEMENTS),
+       SNMP_MIB_ITEM("Icmp6InRedirects", ICMP6_MIB_INREDIRECTS),
+       SNMP_MIB_ITEM("Icmp6OutMsgs", ICMP6_MIB_OUTMSGS),
+       SNMP_MIB_ITEM("Icmp6OutDestUnreachs", ICMP6_MIB_OUTDESTUNREACHS),
+       SNMP_MIB_ITEM("Icmp6OutPktTooBigs", ICMP6_MIB_OUTPKTTOOBIGS),
+       SNMP_MIB_ITEM("Icmp6OutTimeExcds", ICMP6_MIB_OUTTIMEEXCDS),
+       SNMP_MIB_ITEM("Icmp6OutParmProblems", ICMP6_MIB_OUTPARMPROBLEMS),
+       SNMP_MIB_ITEM("Icmp6OutEchoReplies", ICMP6_MIB_OUTECHOREPLIES),
+       SNMP_MIB_ITEM("Icmp6OutRouterSolicits", ICMP6_MIB_OUTROUTERSOLICITS),
+       SNMP_MIB_ITEM("Icmp6OutNeighborSolicits", ICMP6_MIB_OUTNEIGHBORSOLICITS),
+       SNMP_MIB_ITEM("Icmp6OutNeighborAdvertisements", ICMP6_MIB_OUTNEIGHBORADVERTISEMENTS),
+       SNMP_MIB_ITEM("Icmp6OutRedirects", ICMP6_MIB_OUTREDIRECTS),
+       SNMP_MIB_ITEM("Icmp6OutGroupMembResponses", ICMP6_MIB_OUTGROUPMEMBRESPONSES),
+       SNMP_MIB_ITEM("Icmp6OutGroupMembReductions", ICMP6_MIB_OUTGROUPMEMBREDUCTIONS),
+       SNMP_MIB_SENTINEL
 };
 
-static struct snmp_item snmp6_udp6_list[] = {
-#define SNMP6_GEN(x)   SNMP_ITEM(struct udp_mib, Udp##x, "Udp6" #x)
-       SNMP6_GEN(InDatagrams),
-       SNMP6_GEN(NoPorts),
-       SNMP6_GEN(InErrors),
-       SNMP6_GEN(OutDatagrams),
-#undef SNMP6_GEN
-       SNMP_ITEM_SENTINEL
+static struct snmp_mib snmp6_udp6_list[] = {
+       SNMP_MIB_ITEM("Udp6InDatagrams", UDP_MIB_INDATAGRAMS),
+       SNMP_MIB_ITEM("Udp6NoPorts", UDP_MIB_NOPORTS),
+       SNMP_MIB_ITEM("Udp6InErrors", UDP_MIB_INERRORS),
+       SNMP_MIB_ITEM("Udp6OutDatagrams", UDP_MIB_OUTDATAGRAMS),
+       SNMP_MIB_SENTINEL
 };
 
 static unsigned long
@@ -149,23 +143,19 @@ fold_field(void *mib[], int offt)
         for (i = 0; i < NR_CPUS; i++) {
                 if (!cpu_possible(i))
                         continue;
-                res +=
-                    *((unsigned long *) (((void *)per_cpu_ptr(mib[0], i)) +
-                                         offt));
-                res +=
-                    *((unsigned long *) (((void *)per_cpu_ptr(mib[1], i)) +
-                                         offt));
+                res += *(((unsigned long *)per_cpu_ptr(mib[0], i)) + offt);
+                res += *(((unsigned long *)per_cpu_ptr(mib[1], i)) + offt);
         }
         return res;
 }
 
 static inline void
-snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_item *itemlist)
+snmp6_seq_show_item(struct seq_file *seq, void **mib, struct snmp_mib *itemlist)
 {
        int i;
        for (i=0; itemlist[i].name; i++)
                seq_printf(seq, "%-32s\t%lu\n", itemlist[i].name, 
-                               fold_field(mib, itemlist[i].offset));
+                               fold_field(mib, itemlist[i].entry));
 }
 
 static int snmp6_seq_show(struct seq_file *seq, void *v)
index 447b142..0319896 100644 (file)
@@ -419,7 +419,10 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
 
        if (np->rxopt.all)
                datagram_recv_ctl(sk, msg, skb);
+
        err = copied;
+       if (flags & MSG_TRUNC)
+               err = skb->len;
 
 out_free:
        skb_free_datagram(sk, skb);
@@ -535,7 +538,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
        if (err)
                goto error_fault;
 
-       IP6_INC_STATS(OutRequests);             
+       IP6_INC_STATS(IPSTATS_MIB_OUTREQUESTS);         
        err = NF_HOOK(PF_INET6, NF_IP6_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
                      dst_output);
        if (err > 0)
@@ -549,7 +552,7 @@ error_fault:
        err = -EFAULT;
        kfree_skb(skb);
 error:
-       IP6_INC_STATS(OutDiscards);
+       IP6_INC_STATS(IPSTATS_MIB_OUTDISCARDS);
        return err; 
 }
 static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
@@ -916,7 +919,7 @@ static int rawv6_init_sk(struct sock *sk)
 struct proto rawv6_prot = {
        .name =         "RAW",
        .close =        rawv6_close,
-       .connect =      udpv6_connect,
+       .connect =      ip6_datagram_connect,
        .disconnect =   udp_disconnect,
        .ioctl =        rawv6_ioctl,
        .init =         rawv6_init_sk,
index ccee987..836d2ae 100644 (file)
@@ -284,7 +284,7 @@ static void ip6_evictor(void)
                spin_unlock(&fq->lock);
 
                fq_put(fq);
-               IP6_INC_STATS_BH(ReasmFails);
+               IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        }
 }
 
@@ -299,8 +299,8 @@ static void ip6_frag_expire(unsigned long data)
 
        fq_kill(fq);
 
-       IP6_INC_STATS_BH(ReasmTimeout);
-       IP6_INC_STATS_BH(ReasmFails);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMTIMEOUT);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
 
        /* Send error only if the first segment arrived. */
        if (fq->last_in&FIRST_IN && fq->fragments) {
@@ -386,7 +386,7 @@ ip6_frag_create(unsigned int hash, u32 id, struct in6_addr *src, struct in6_addr
        return ip6_frag_intern(hash, fq);
 
 oom:
-       IP6_INC_STATS_BH(ReasmFails);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        return NULL;
 }
 
@@ -426,7 +426,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
                        ((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
 
        if ((unsigned int)end > IPV6_MAXPLEN) {
-               IP6_INC_STATS_BH(InHdrErrors);
+               IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb,ICMPV6_HDR_FIELD, (u8*)&fhdr->frag_off - skb->nh.raw);
                return;
        }
@@ -453,7 +453,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
                        /* RFC2460 says always send parameter problem in
                         * this case. -DaveM
                         */
-                       IP6_INC_STATS_BH(InHdrErrors);
+                       IP6_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS);
                        icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, 
                                          offsetof(struct ipv6hdr, payload_len));
                        return;
@@ -572,7 +572,7 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
        return;
 
 err:
-       IP6_INC_STATS(ReasmFails);
+       IP6_INC_STATS(IPSTATS_MIB_REASMFAILS);
        kfree_skb(skb);
 }
 
@@ -666,7 +666,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
        if (head->ip_summed == CHECKSUM_HW)
                head->csum = csum_partial(head->nh.raw, head->h.raw-head->nh.raw, head->csum);
 
-       IP6_INC_STATS_BH(ReasmOKs);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMOKS);
        fq->fragments = NULL;
        *nhoffp = nhoff;
        return 1;
@@ -679,7 +679,7 @@ out_oom:
        if (net_ratelimit())
                printk(KERN_DEBUG "ip6_frag_reasm: no memory for reassembly\n");
 out_fail:
-       IP6_INC_STATS_BH(ReasmFails);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        return -1;
 }
 
@@ -693,16 +693,16 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
 
        hdr = skb->nh.ipv6h;
 
-       IP6_INC_STATS_BH(ReasmReqds);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
 
        /* Jumbo payload inhibits frag. header */
        if (hdr->payload_len==0) {
-               IP6_INC_STATS(InHdrErrors);
+               IP6_INC_STATS(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
                return -1;
        }
        if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+sizeof(struct frag_hdr))) {
-               IP6_INC_STATS(InHdrErrors);
+               IP6_INC_STATS(IPSTATS_MIB_INHDRERRORS);
                icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, skb->h.raw-skb->nh.raw);
                return -1;
        }
@@ -713,7 +713,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
        if (!(fhdr->frag_off & htons(0xFFF9))) {
                /* It is not a fragmented frame */
                skb->h.raw += sizeof(struct frag_hdr);
-               IP6_INC_STATS_BH(ReasmOKs);
+               IP6_INC_STATS_BH(IPSTATS_MIB_REASMOKS);
 
                *nhoffp = (u8*)fhdr - skb->nh.raw;
                return 1;
@@ -738,7 +738,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp, unsigned int *nhoffp)
                return ret;
        }
 
-       IP6_INC_STATS_BH(ReasmFails);
+       IP6_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
        kfree_skb(skb);
        return -1;
 }
index c3716df..2017c69 100644 (file)
@@ -584,7 +584,24 @@ static void ip6_rt_update_pmtu(struct dst_entry *dst, u32 mtu)
 /* Protected by rt6_lock.  */
 static struct dst_entry *ndisc_dst_gc_list;
 static int ipv6_get_mtu(struct net_device *dev);
-static inline unsigned int ipv6_advmss(unsigned int mtu);
+
+static inline unsigned int ipv6_advmss(unsigned int mtu)
+{
+       mtu -= sizeof(struct ipv6hdr) + sizeof(struct tcphdr);
+
+       if (mtu < ip6_rt_min_advmss)
+               mtu = ip6_rt_min_advmss;
+
+       /*
+        * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and 
+        * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. 
+        * IPV6_MAXPLEN is also valid and means: "any MSS, 
+        * rely only on pmtu discovery"
+        */
+       if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
+               mtu = IPV6_MAXPLEN;
+       return mtu;
+}
 
 struct dst_entry *ndisc_dst_alloc(struct net_device *dev, 
                                  struct neighbour *neigh,
@@ -692,24 +709,6 @@ static int ipv6_get_mtu(struct net_device *dev)
        return mtu;
 }
 
-static inline unsigned int ipv6_advmss(unsigned int mtu)
-{
-       mtu -= sizeof(struct ipv6hdr) + sizeof(struct tcphdr);
-
-       if (mtu < ip6_rt_min_advmss)
-               mtu = ip6_rt_min_advmss;
-
-       /*
-        * Maximal non-jumbo IPv6 payload is IPV6_MAXPLEN and 
-        * corresponding MSS is IPV6_MAXPLEN - tcp_header_size. 
-        * IPV6_MAXPLEN is also valid and means: "any MSS, 
-        * rely only on pmtu discovery"
-        */
-       if (mtu > IPV6_MAXPLEN - sizeof(struct tcphdr))
-               mtu = IPV6_MAXPLEN;
-       return mtu;
-}
-
 static int ipv6_get_hoplimit(struct net_device *dev)
 {
        int hoplimit = ipv6_devconf.hop_limit;
@@ -1292,7 +1291,7 @@ int ipv6_route_ioctl(unsigned int cmd, void __user *arg)
 
 int ip6_pkt_discard(struct sk_buff *skb)
 {
-       IP6_INC_STATS(OutNoRoutes);
+       IP6_INC_STATS(IPSTATS_MIB_OUTNOROUTES);
        icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_NOROUTE, 0, skb->dev);
        kfree_skb(skb);
        return 0;
@@ -1925,10 +1924,10 @@ static int flush_delay;
 
 static
 int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, struct file * filp,
-                             void __user *buffer, size_t *lenp)
+                             void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        if (write) {
-               proc_dointvec(ctl, write, filp, buffer, lenp);
+               proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
                if (flush_delay < 0)
                        flush_delay = 0;
                fib6_run_gc((unsigned long)flush_delay);
index 4a198fb..0d9554c 100644 (file)
@@ -55,6 +55,8 @@
 #include <net/inet_ecn.h>
 #include <net/protocol.h>
 #include <net/xfrm.h>
+#include <net/addrconf.h>
+#include <net/snmp.h>
 
 #include <asm/uaccess.h>
 
@@ -495,7 +497,7 @@ unique:
                /* Silly. Should hash-dance instead... */
                local_bh_disable();
                tcp_tw_deschedule(tw);
-               NET_INC_STATS_BH(TimeWaitRecycled);
+               NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);
                local_bh_enable();
 
                tcp_tw_put(tw);
@@ -734,7 +736,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        sk = tcp_v6_lookup(&hdr->daddr, th->dest, &hdr->saddr, th->source, skb->dev->ifindex);
 
        if (sk == NULL) {
-               ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), Icmp6InErrors);
+               ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS);
                return;
        }
 
@@ -745,7 +747,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
 
        bh_lock_sock(sk);
        if (sock_owned_by_user(sk))
-               NET_INC_STATS_BH(LockDroppedIcmps);
+               NET_INC_STATS_BH(LINUX_MIB_LOCKDROPPEDICMPS);
 
        if (sk->sk_state == TCP_CLOSE)
                goto out;
@@ -754,7 +756,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        seq = ntohl(th->seq); 
        if (sk->sk_state != TCP_LISTEN &&
            !between(seq, tp->snd_una, tp->snd_nxt)) {
-               NET_INC_STATS_BH(OutOfWindowIcmps);
+               NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
                goto out;
        }
 
@@ -822,7 +824,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                BUG_TRAP(req->sk == NULL);
 
                if (seq != req->snt_isn) {
-                       NET_INC_STATS_BH(OutOfWindowIcmps);
+                       NET_INC_STATS_BH(LINUX_MIB_OUTOFWINDOWICMPS);
                        goto out;
                }
 
@@ -833,7 +835,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        case TCP_SYN_RECV:  /* Cannot happen.
                               It can, it SYNs are crossed. --ANK */ 
                if (!sock_owned_by_user(sk)) {
-                       TCP_INC_STATS_BH(TcpAttemptFails);
+                       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
                        sk->sk_err = err;
                        sk->sk_error_report(sk);                /* Wake people up to see the error (see connect in sock.c) */
 
@@ -1020,8 +1022,8 @@ static void tcp_v6_send_reset(struct sk_buff *skb)
        /* sk = NULL, but it is safe for now. RST socket required. */
        if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
                ip6_xmit(NULL, buff, &fl, NULL, 0);
-               TCP_INC_STATS_BH(TcpOutSegs);
-               TCP_INC_STATS_BH(TcpOutRsts);
+               TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
+               TCP_INC_STATS_BH(TCP_MIB_OUTRSTS);
                return;
        }
 
@@ -1081,7 +1083,7 @@ static void tcp_v6_send_ack(struct sk_buff *skb, u32 seq, u32 ack, u32 win, u32
 
        if (!ip6_dst_lookup(NULL, &buff->dst, &fl)) {
                ip6_xmit(NULL, buff, &fl, NULL, 0);
-               TCP_INC_STATS_BH(TcpOutSegs);
+               TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
                return;
        }
 
@@ -1262,7 +1264,7 @@ drop:
        if (req)
                tcp_openreq_free(req);
 
-       TCP_INC_STATS_BH(TcpAttemptFails);
+       TCP_INC_STATS_BH(TCP_MIB_ATTEMPTFAILS);
        return 0; /* don't send reset */
 }
 
@@ -1442,9 +1444,9 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
        return newsk;
 
 out_overflow:
-       NET_INC_STATS_BH(ListenOverflows);
+       NET_INC_STATS_BH(LINUX_MIB_LISTENOVERFLOWS);
 out:
-       NET_INC_STATS_BH(ListenDrops);
+       NET_INC_STATS_BH(LINUX_MIB_LISTENDROPS);
        if (opt && opt != np->opt)
                sock_kfree_s(sk, opt, opt->tot_len);
        dst_release(dst);
@@ -1569,7 +1571,7 @@ discard:
        kfree_skb(skb);
        return 0;
 csum_err:
-       TCP_INC_STATS_BH(TcpInErrs);
+       TCP_INC_STATS_BH(TCP_MIB_INERRS);
        goto discard;
 
 
@@ -1615,7 +1617,7 @@ static int tcp_v6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
        /*
         *      Count it even if it's bad.
         */
-       TCP_INC_STATS_BH(TcpInSegs);
+       TCP_INC_STATS_BH(TCP_MIB_INSEGS);
 
        if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
                goto discard_it;
@@ -1676,7 +1678,7 @@ no_tcp_socket:
 
        if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) {
 bad_packet:
-               TCP_INC_STATS_BH(TcpInErrs);
+               TCP_INC_STATS_BH(TCP_MIB_INERRS);
        } else {
                tcp_v6_send_reset(skb);
        }
@@ -1701,7 +1703,7 @@ do_time_wait:
        }
 
        if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) {
-               TCP_INC_STATS_BH(TcpInErrs);
+               TCP_INC_STATS_BH(TCP_MIB_INERRS);
                tcp_tw_put((struct tcp_tw_bucket *) sk);
                goto discard_it;
        }
@@ -2048,12 +2050,12 @@ static int tcp6_seq_show(struct seq_file *seq, void *v)
        struct tcp_iter_state *st;
 
        if (v == SEQ_START_TOKEN) {
-               seq_printf(seq,
-                          "  sl  "
-                          "local_address                         "
-                          "remote_address                        "
-                          "st tx_queue rx_queue tr tm->when retrnsmt"
-                          "   uid  timeout inode\n");
+               seq_puts(seq,
+                        "  sl  "
+                        "local_address                         "
+                        "remote_address                        "
+                        "st tx_queue rx_queue tr tm->when retrnsmt"
+                        "   uid  timeout inode\n");
                goto out;
        }
        st = seq->private;
index 9a6bc46..7133801 100644 (file)
@@ -49,6 +49,7 @@
 #include <net/addrconf.h>
 #include <net/ip.h>
 #include <net/udp.h>
+#include <net/raw.h>
 #include <net/inet_common.h>
 
 #include <net/ip6_checksum.h>
@@ -203,159 +204,6 @@ static struct sock *udp_v6_lookup(struct in6_addr *saddr, u16 sport,
  *
  */
 
-int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
-{
-       struct sockaddr_in6     *usin = (struct sockaddr_in6 *) uaddr;
-       struct inet_opt         *inet = inet_sk(sk);
-       struct ipv6_pinfo       *np = inet6_sk(sk);
-       struct in6_addr         *daddr;
-       struct dst_entry        *dst;
-       struct flowi            fl;
-       struct ip6_flowlabel    *flowlabel = NULL;
-       int                     addr_type;
-       int                     err;
-
-       if (usin->sin6_family == AF_INET) {
-               if (__ipv6_only_sock(sk))
-                       return -EAFNOSUPPORT;
-               err = udp_connect(sk, uaddr, addr_len);
-               goto ipv4_connected;
-       }
-
-       if (addr_len < SIN6_LEN_RFC2133)
-               return -EINVAL;
-
-       if (usin->sin6_family != AF_INET6) 
-               return -EAFNOSUPPORT;
-
-       memset(&fl, 0, sizeof(fl));
-       if (np->sndflow) {
-               fl.fl6_flowlabel = usin->sin6_flowinfo&IPV6_FLOWINFO_MASK;
-               if (fl.fl6_flowlabel&IPV6_FLOWLABEL_MASK) {
-                       flowlabel = fl6_sock_lookup(sk, fl.fl6_flowlabel);
-                       if (flowlabel == NULL)
-                               return -EINVAL;
-                       ipv6_addr_copy(&usin->sin6_addr, &flowlabel->dst);
-               }
-       }
-
-       addr_type = ipv6_addr_type(&usin->sin6_addr);
-
-       if (addr_type == IPV6_ADDR_ANY) {
-               /*
-                *      connect to self
-                */
-               usin->sin6_addr.s6_addr[15] = 0x01;
-       }
-
-       daddr = &usin->sin6_addr;
-
-       if (addr_type == IPV6_ADDR_MAPPED) {
-               struct sockaddr_in sin;
-
-               if (__ipv6_only_sock(sk)) {
-                       err = -ENETUNREACH;
-                       goto out;
-               }
-               sin.sin_family = AF_INET;
-               sin.sin_addr.s_addr = daddr->s6_addr32[3];
-               sin.sin_port = usin->sin6_port;
-
-               err = udp_connect(sk, (struct sockaddr*) &sin, sizeof(sin));
-
-ipv4_connected:
-               if (err)
-                       goto out;
-               
-               ipv6_addr_set(&np->daddr, 0, 0, htonl(0x0000ffff), inet->daddr);
-
-               if (ipv6_addr_any(&np->saddr)) {
-                       ipv6_addr_set(&np->saddr, 0, 0, htonl(0x0000ffff),
-                                     inet->saddr);
-               }
-
-               if (ipv6_addr_any(&np->rcv_saddr)) {
-                       ipv6_addr_set(&np->rcv_saddr, 0, 0, htonl(0x0000ffff),
-                                     inet->rcv_saddr);
-               }
-               goto out;
-       }
-
-       if (addr_type&IPV6_ADDR_LINKLOCAL) {
-               if (addr_len >= sizeof(struct sockaddr_in6) &&
-                   usin->sin6_scope_id) {
-                       if (sk->sk_bound_dev_if &&
-                           sk->sk_bound_dev_if != usin->sin6_scope_id) {
-                               err = -EINVAL;
-                               goto out;
-                       }
-                       sk->sk_bound_dev_if = usin->sin6_scope_id;
-                       if (!sk->sk_bound_dev_if &&
-                           (addr_type & IPV6_ADDR_MULTICAST))
-                               fl.oif = np->mcast_oif;
-               }
-
-               /* Connect to link-local address requires an interface */
-               if (!sk->sk_bound_dev_if) {
-                       err = -EINVAL;
-                       goto out;
-               }
-       }
-
-       ipv6_addr_copy(&np->daddr, daddr);
-       np->flow_label = fl.fl6_flowlabel;
-
-       inet->dport = usin->sin6_port;
-
-       /*
-        *      Check for a route to destination an obtain the
-        *      destination cache for it.
-        */
-
-       fl.proto = IPPROTO_UDP;
-       ipv6_addr_copy(&fl.fl6_dst, &np->daddr);
-       ipv6_addr_copy(&fl.fl6_src, &np->saddr);
-       fl.oif = sk->sk_bound_dev_if;
-       fl.fl_ip_dport = inet->dport;
-       fl.fl_ip_sport = inet->sport;
-
-       if (!fl.oif && (addr_type&IPV6_ADDR_MULTICAST))
-               fl.oif = np->mcast_oif;
-
-       if (flowlabel) {
-               if (flowlabel->opt && flowlabel->opt->srcrt) {
-                       struct rt0_hdr *rt0 = (struct rt0_hdr *) flowlabel->opt->srcrt;
-                       ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-               }
-       } else if (np->opt && np->opt->srcrt) {
-               struct rt0_hdr *rt0 = (struct rt0_hdr *)np->opt->srcrt;
-               ipv6_addr_copy(&fl.fl6_dst, rt0->addr);
-       }
-
-       err = ip6_dst_lookup(sk, &dst, &fl);
-       if (err)
-               goto out;
-
-       /* source address lookup done in ip6_dst_lookup */
-
-       if (ipv6_addr_any(&np->saddr))
-               ipv6_addr_copy(&np->saddr, &fl.fl6_src);
-
-       if (ipv6_addr_any(&np->rcv_saddr)) {
-               ipv6_addr_copy(&np->rcv_saddr, &fl.fl6_src);
-               inet->rcv_saddr = LOOPBACK4_IPV6;
-       }
-
-       ip6_dst_store(sk, dst,
-                     !ipv6_addr_cmp(&fl.fl6_dst, &np->daddr) ?
-                     &np->daddr : NULL);
-
-       sk->sk_state = TCP_ESTABLISHED;
-out:
-       fl6_sock_release(flowlabel);
-       return err;
-}
-
 static void udpv6_close(struct sock *sk, long timeout)
 {
        sk_common_release(sk);
@@ -436,7 +284,10 @@ try_again:
                                sin6->sin6_scope_id = IP6CB(skb)->iif;
                }
        }
+
        err = copied;
+       if (flags & MSG_TRUNC)
+               err = skb->len - sizeof(struct udphdr);
 
 out_free:
        skb_free_datagram(sk, skb);
@@ -460,7 +311,7 @@ csum_copy_err:
        skb_free_datagram(sk, skb);
 
        if (flags & MSG_DONTWAIT) {
-               UDP6_INC_STATS_USER(UdpInErrors);
+               UDP6_INC_STATS_USER(UDP_MIB_INERRORS);
                return -EAGAIN;
        }
        goto try_again;
@@ -509,7 +360,7 @@ static inline int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
 
        if (skb->ip_summed != CHECKSUM_UNNECESSARY) {
                if ((unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum))) {
-                       UDP6_INC_STATS_BH(UdpInErrors);
+                       UDP6_INC_STATS_BH(UDP_MIB_INERRORS);
                        kfree_skb(skb);
                        return 0;
                }
@@ -517,11 +368,11 @@ static inline int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
        }
 
        if (sock_queue_rcv_skb(sk,skb)<0) {
-               UDP6_INC_STATS_BH(UdpInErrors);
+               UDP6_INC_STATS_BH(UDP_MIB_INERRORS);
                kfree_skb(skb);
                return 0;
        }
-       UDP6_INC_STATS_BH(UdpInDatagrams);
+       UDP6_INC_STATS_BH(UDP_MIB_INDATAGRAMS);
        return 0;
 }
 
@@ -670,7 +521,7 @@ static int udpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
                if (skb->ip_summed != CHECKSUM_UNNECESSARY &&
                    (unsigned short)csum_fold(skb_checksum(skb, 0, skb->len, skb->csum)))
                        goto discard;
-               UDP6_INC_STATS_BH(UdpNoPorts);
+               UDP6_INC_STATS_BH(UDP_MIB_NOPORTS);
 
                icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, dev);
 
@@ -689,7 +540,7 @@ short_packet:
                printk(KERN_DEBUG "UDP: short packet: %d/%u\n", ulen, skb->len);
 
 discard:
-       UDP6_INC_STATS_BH(UdpInErrors);
+       UDP6_INC_STATS_BH(UDP_MIB_INERRORS);
        kfree_skb(skb);
        return(0);      
 }
@@ -988,7 +839,7 @@ do_append_data:
 out:
        fl6_sock_release(flowlabel);
        if (!err) {
-               UDP6_INC_STATS_USER(UdpOutDatagrams);
+               UDP6_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS);
                return len;
        }
        return err;
@@ -1174,7 +1025,7 @@ void udp6_proc_exit(void) {
 struct proto udpv6_prot = {
        .name =         "UDP",
        .close =        udpv6_close,
-       .connect =      udpv6_connect,
+       .connect =      ip6_datagram_connect,
        .disconnect =   udp_disconnect,
        .ioctl =        udp_ioctl,
        .destroy =      udpv6_destroy_sock,
index b5a3bdb..ab4e40b 100644 (file)
@@ -157,7 +157,7 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
                /* Copy neighbour for reachability confirmation */
                dst_prev->neighbour     = neigh_clone(rt->u.dst.neighbour);
                dst_prev->input         = rt->u.dst.input;
-               dst_prev->output        = dst_prev->xfrm->type->output;
+               dst_prev->output        = xfrm6_output;
                /* Sheit... I remember I did this right. Apparently,
                 * it was magically lost, so this code needs audit */
                x->u.rt6.rt6i_flags    = rt0->rt6i_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
index c72cf83..d98b92d 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/ipsec.h>
 #include <net/ipv6.h>
 
-extern struct xfrm_state_afinfo xfrm6_state_afinfo;
+static struct xfrm_state_afinfo xfrm6_state_afinfo;
 
 static void
 __xfrm6_init_tempsel(struct xfrm_state *x, struct flowi *fl,
@@ -81,11 +81,8 @@ __xfrm6_find_acq(u8 mode, u32 reqid, u8 proto,
                    proto == x->id.proto &&
                    !ipv6_addr_cmp((struct in6_addr *)saddr, (struct in6_addr *)x->props.saddr.a6) &&
                    reqid == x->props.reqid &&
-                   x->km.state == XFRM_STATE_ACQ) {
-                           if (!x0)
-                                   x0 = x;
-                           if (x->id.spi)
-                                   continue;
+                   x->km.state == XFRM_STATE_ACQ &&
+                   !x->id.spi) {
                            x0 = x;
                            break;
                    }
index c90c505..f415a4e 100644 (file)
@@ -1266,7 +1266,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
        unsigned char *asmptr;
        int err;
 
-       IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
+       IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
 
        /* Note : socket.c set MSG_EOR on SEQPACKET sockets */
        if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
@@ -1295,7 +1295,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
 
        /* Check that we don't send out to big frames */
        if (len > self->max_data_size) {
-               IRDA_DEBUG(2, "%s(), Chopping frame from %d to %d bytes!\n",
+               IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n",
                           __FUNCTION__, len, self->max_data_size);
                len = self->max_data_size;
        }
@@ -1355,7 +1355,7 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
        copied     = skb->len;
 
        if (copied > size) {
-               IRDA_DEBUG(2, "%s(), Received truncated frame (%d < %d)!\n",
+               IRDA_DEBUG(2, "%s(), Received truncated frame (%zd < %zd)!\n",
                           __FUNCTION__, copied, size);
                copied = size;
                msg->msg_flags |= MSG_TRUNC;
@@ -1519,7 +1519,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
        unsigned char *asmptr;
        int err;
 
-       IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
+       IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
 
        if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
                return -EINVAL;
@@ -1541,7 +1541,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
         */
        if (len > self->max_data_size) {
                IRDA_DEBUG(0, "%s(), Warning to much data! "
-                          "Chopping frame from %d to %d bytes!\n",
+                          "Chopping frame from %zd to %d bytes!\n",
                           __FUNCTION__, len, self->max_data_size);
                len = self->max_data_size;
        }
@@ -1591,7 +1591,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
        unsigned char *asmptr;
        int err;
 
-       IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
+       IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
 
        if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
                return -EINVAL;
@@ -1637,7 +1637,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
         */
        if (len > self->max_data_size) {
                IRDA_DEBUG(0, "%s(), Warning to much data! "
-                          "Chopping frame from %d to %d bytes!\n",
+                          "Chopping frame from %zd to %d bytes!\n",
                           __FUNCTION__, len, self->max_data_size);
                len = self->max_data_size;
        }
index 1553eb1..fdf75a1 100644 (file)
@@ -1182,10 +1182,10 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
                        min_spi = range->sadb_spirange_min;
                        max_spi = range->sadb_spirange_max;
                } else {
-                       min_spi = htonl(0x100);
-                       max_spi = htonl(0x0fffffff);
+                       min_spi = 0x100;
+                       max_spi = 0x0fffffff;
                }
-               xfrm_alloc_spi(x, min_spi, max_spi);
+               xfrm_alloc_spi(x, htonl(min_spi), htonl(max_spi));
                if (x->id.spi)
                        resp_skb = pfkey_xfrm_state2msg(x, 0, 3);
        }
index fbb97bf..6774669 100644 (file)
@@ -10,6 +10,7 @@
  */
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/socket.h>
@@ -1451,8 +1452,7 @@ static int __init nr_proto_init(void)
 
 module_init(nr_proto_init);
 
-
-MODULE_PARM(nr_ndevs, "i");
+module_param(nr_ndevs, int, 0);
 MODULE_PARM_DESC(nr_ndevs, "number of NET/ROM devices");
 
 MODULE_AUTHOR("Jonathan Naylor G4KLX <g4klx@g4klx.demon.co.uk>");
index a5555c3..31c4ab7 100644 (file)
@@ -11,6 +11,7 @@
  */
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/types.h>
@@ -57,7 +58,7 @@ int sysctl_rose_link_fail_timeout       = ROSE_DEFAULT_FAIL_TIMEOUT;
 int sysctl_rose_maximum_vcs             = ROSE_DEFAULT_MAXVC;
 int sysctl_rose_window_size             = ROSE_DEFAULT_WINDOW_SIZE;
 
-HLIST_HEAD(rose_list);
+static HLIST_HEAD(rose_list);
 spinlock_t rose_list_lock = SPIN_LOCK_UNLOCKED;
 
 static struct proto_ops rose_proto_ops;
@@ -1550,7 +1551,7 @@ fail:
 }
 module_init(rose_proto_init);
 
-MODULE_PARM(rose_ndevs, "i");
+module_param(rose_ndevs, int, 0);
 MODULE_PARM_DESC(rose_ndevs, "number of ROSE devices");
 
 MODULE_AUTHOR("Jonathan Naylor G4KLX <g4klx@g4klx.demon.co.uk>");
index 11c703b..929b82f 100644 (file)
@@ -620,7 +620,6 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
                       struct rxrpc_message *msg)
 {
        struct msghdr msghdr;
-       mm_segment_t oldfs;
        int ret;
 
        _enter("%p{%d}", conn, ntohs(conn->addr.sin_port));
@@ -634,12 +633,6 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
        /* set up the message to be transmitted */
        msghdr.msg_name         = &conn->addr;
        msghdr.msg_namelen      = sizeof(conn->addr);
-       /*
-        * the following is safe, since for compiler definitions of kvec and
-        * iovec are identical, yielding the same in-core layout and alignment
-        */
-       msghdr.msg_iov          = (struct iovec *)msg->data;
-       msghdr.msg_iovlen       = msg->dcount;
        msghdr.msg_control      = NULL;
        msghdr.msg_controllen   = 0;
        msghdr.msg_flags        = MSG_CONFIRM | MSG_DONTWAIT;
@@ -651,15 +644,11 @@ int rxrpc_conn_sendmsg(struct rxrpc_connection *conn,
             htons(conn->addr.sin_port));
 
        /* send the message */
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sock_sendmsg(conn->trans->socket, &msghdr, msg->dsize);
-       set_fs(oldfs);
-
+       ret = kernel_sendmsg(conn->trans->socket, &msghdr,
+                            msg->data, msg->dcount, msg->dsize);
        if (ret < 0) {
                msg->state = RXRPC_MSG_ERROR;
-       }
-       else {
+       } else {
                msg->state = RXRPC_MSG_SENT;
                ret = 0;
 
index 92bcf9b..5770015 100644 (file)
@@ -612,7 +612,6 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
        struct sockaddr_in sin;
        struct msghdr msghdr;
        struct kvec iov[2];
-       mm_segment_t oldfs;
        uint32_t _error;
        int len, ret;
 
@@ -649,12 +648,6 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
 
        msghdr.msg_name         = &sin;
        msghdr.msg_namelen      = sizeof(sin);
-       /*
-        * the following is safe, since for compiler definitions of kvec and
-        * iovec are identical, yielding the same in-core layout and alignment
-        */
-       msghdr.msg_iov          = (struct iovec *)iov;
-       msghdr.msg_iovlen       = 2;
        msghdr.msg_control      = NULL;
        msghdr.msg_controllen   = 0;
        msghdr.msg_flags        = MSG_DONTWAIT;
@@ -666,10 +659,7 @@ int rxrpc_trans_immediate_abort(struct rxrpc_transport *trans,
             htons(sin.sin_port));
 
        /* send the message */
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sock_sendmsg(trans->socket, &msghdr, len);
-       set_fs(oldfs);
+       ret = kernel_sendmsg(trans->socket, &msghdr, iov, 2, len);
 
        _leave(" = %d", ret);
        return ret;
@@ -688,7 +678,6 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
        struct list_head connq, *_p;
        struct errormsg emsg;
        struct msghdr msg;
-       mm_segment_t oldfs;
        uint16_t port;
        int local, err;
 
@@ -700,17 +689,12 @@ static void rxrpc_trans_receive_error_report(struct rxrpc_transport *trans)
                /* try and receive an error message */
                msg.msg_name    = &sin;
                msg.msg_namelen = sizeof(sin);
-               msg.msg_iov     = NULL;
-               msg.msg_iovlen  = 0;
                msg.msg_control = &emsg;
                msg.msg_controllen = sizeof(emsg);
                msg.msg_flags   = 0;
 
-               oldfs = get_fs();
-               set_fs(KERNEL_DS);
-               err = sock_recvmsg(trans->socket, &msg, 0,
+               err = kernel_recvmsg(trans->socket, &msg, NULL, 0, 0,
                                   MSG_ERRQUEUE | MSG_DONTWAIT | MSG_TRUNC);
-               set_fs(oldfs);
 
                if (err == -EAGAIN) {
                        _leave("");
index 54817b8..97a42d9 100644 (file)
@@ -1,6 +1,61 @@
 #
 # Traffic control configuration.
 # 
+choice
+       prompt "Packet scheduler clock source"
+       depends on NET_SCHED
+       default NET_SCH_CLK_JIFFIES
+       help
+         Packet schedulers need a monotonic clock that increments at a static
+         rate. The kernel provides several suitable interfaces, each with
+         different properties:
+         
+         - high resolution (us or better)
+         - fast to read (minimal locking, no i/o access)
+         - synchronized on all processors
+         - handles cpu clock frequency changes
+
+         but nothing provides all of the above.
+
+config NET_SCH_CLK_JIFFIES
+       bool "Timer interrupt"
+       help
+         Say Y here if you want to use the timer interrupt (jiffies) as clock
+         source. This clock source is fast, synchronized on all processors and
+         handles cpu clock frequency changes, but its resolution is too low
+         for accurate shaping except at very low speed.
+
+config NET_SCH_CLK_GETTIMEOFDAY
+       bool "gettimeofday"
+       help
+         Say Y here if you want to use gettimeofday as clock source. This clock
+         source has high resolution, is synchronized on all processors and
+         handles cpu clock frequency changes, but it is slow.
+
+         Choose this if you need a high resolution clock source but can't use
+         the CPU's cycle counter.
+
+config NET_SCH_CLK_CPU
+       bool "CPU cycle counter"
+       depends on X86_TSC || X86_64 || ALPHA || SPARC64 || PPC64 || IA64
+       help
+         Say Y here if you want to use the CPU's cycle counter as clock source.
+         This is a cheap and high resolution clock source, but on some
+         architectures it is not synchronized on all processors and doesn't
+         handle cpu clock frequency changes.
+
+         The useable cycle counters are:
+
+               x86/x86_64      - Timestamp Counter
+               alpha           - Cycle Counter
+               sparc64         - %ticks register
+               ppc64           - Time base
+               ia64            - Interval Time Counter
+
+         Choose this if your CPU's cycle counter is working properly.
+
+endchoice
+
 config NET_SCH_CBQ
        tristate "CBQ packet scheduler"
        depends on NET_SCHED
@@ -158,7 +213,9 @@ config NET_SCH_NETEM
          testing applications or protocols.
 
          To compile this driver as a module, choose M here: the module
-         will be called sch_delay.
+         will be called sch_netem.
+
+         If unsure, say N.
 
 config NET_SCH_INGRESS
        tristate "Ingress Qdisc"
index 5d034cc..e769513 100644 (file)
@@ -236,12 +236,12 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
                        kfree(tp);
                        goto errout;
                }
-               write_lock(&qdisc_tree_lock);
-               spin_lock_bh(&dev->queue_lock);
+
+               qdisc_lock_tree(dev);
                tp->next = *back;
                *back = tp;
-               spin_unlock_bh(&dev->queue_lock);
-               write_unlock(&qdisc_tree_lock);
+               qdisc_unlock_tree(dev);
+
        } else if (tca[TCA_KIND-1] && rtattr_strcmp(tca[TCA_KIND-1], tp->ops->kind))
                goto errout;
 
@@ -249,11 +249,10 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
 
        if (fh == 0) {
                if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
-                       write_lock(&qdisc_tree_lock);
-                       spin_lock_bh(&dev->queue_lock);
+                       qdisc_lock_tree(dev);
                        *back = tp->next;
-                       spin_unlock_bh(&dev->queue_lock);
-                       write_unlock(&qdisc_tree_lock);
+                       qdisc_unlock_tree(dev);
+
                        tfilter_notify(skb, n, tp, fh_s, RTM_DELTFILTER);
                        tcf_destroy(tp);
                        err = 0;
@@ -294,6 +293,19 @@ errout:
        return err;
 }
 
+unsigned long tcf_set_class(struct tcf_proto *tp, unsigned long *clp, 
+                           unsigned long cl)
+{
+       unsigned long old_cl;
+
+       tcf_tree_lock(tp);
+       old_cl = __cls_set_class(clp, cl);
+       tcf_tree_unlock(tp);
+
+       return old_cl;
+}
+
+
 static int
 tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
              u32 pid, u32 seq, unsigned flags, int event)
@@ -375,7 +387,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
        if ((dev = dev_get_by_index(tcm->tcm_ifindex)) == NULL)
                return skb->len;
 
-       read_lock(&qdisc_tree_lock);
+       read_lock_bh(&qdisc_tree_lock);
        if (!tcm->tcm_parent)
                q = dev->qdisc_sleeping;
        else
@@ -432,7 +444,7 @@ errout:
        if (cl)
                cops->put(q, cl);
 out:
-       read_unlock(&qdisc_tree_lock);
+       read_unlock_bh(&qdisc_tree_lock);
        dev_put(dev);
        return skb->len;
 }
@@ -459,3 +471,4 @@ subsys_initcall(tc_filter_init);
 
 EXPORT_SYMBOL(register_tcf_proto_ops);
 EXPORT_SYMBOL(unregister_tcf_proto_ops);
+EXPORT_SYMBOL(tcf_set_class);
index e2d7c0e..30d26d4 100644 (file)
@@ -64,17 +64,20 @@ struct tc_u_knode
        struct tc_u_hnode       *ht_up;
 #ifdef CONFIG_NET_CLS_ACT
        struct tc_action        *action;
-#ifdef CONFIG_NET_CLS_IND
-       char                     indev[IFNAMSIZ];
-#endif
 #else
 #ifdef CONFIG_NET_CLS_POLICE
        struct tcf_police       *police;
 #endif
+#endif
+#ifdef CONFIG_NET_CLS_IND
+       char                     indev[IFNAMSIZ];
 #endif
        u8                      fshift;
        struct tcf_result       res;
        struct tc_u_hnode       *ht_down;
+#ifdef CONFIG_CLS_U32_PERF
+       struct tc_u32_pcnt      *pf;
+#endif
        struct tc_u32_sel       sel;
 };
 
@@ -120,6 +123,9 @@ static int u32_classify(struct sk_buff *skb, struct tcf_proto *tp, struct tcf_re
        int sdepth = 0;
        int off2 = 0;
        int sel = 0;
+#ifdef CONFIG_CLS_U32_PERF
+       int j;
+#endif
        int i;
 
 next_ht:
@@ -130,7 +136,8 @@ next_knode:
                struct tc_u32_key *key = n->sel.keys;
 
 #ifdef CONFIG_CLS_U32_PERF
-               n->sel.rcnt +=1;
+               n->pf->rcnt +=1;
+               j = 0;
 #endif
                for (i = n->sel.nkeys; i>0; i--, key++) {
 
@@ -139,7 +146,8 @@ next_knode:
                                goto next_knode;
                        }
 #ifdef CONFIG_CLS_U32_PERF
-                       key->kcnt +=1;
+                       n->pf->kcnts[j] +=1;
+                       j++;
 #endif
                }
                if (n->ht_down == NULL) {
@@ -147,7 +155,6 @@ check_terminal:
                        if (n->sel.flags&TC_U32_TERMINAL) {
 
                                *res = n->res;
-#ifdef CONFIG_NET_CLS_ACT
 #ifdef CONFIG_NET_CLS_IND
                                /* yes, i know it sucks but the feature is 
                                ** optional dammit! - JHS */
@@ -164,8 +171,9 @@ check_terminal:
                                }
 #endif
 #ifdef CONFIG_CLS_U32_PERF
-               n->sel.rhit +=1;
+                               n->pf->rhit +=1;
 #endif
+#ifdef CONFIG_NET_CLS_ACT
                                if (n->action) {
                                        int pol_res = tcf_action_exec(skb, n->action);
                                        if (skb->tc_classid > 0) {
@@ -358,6 +366,10 @@ static int u32_destroy_key(struct tcf_proto *tp, struct tc_u_knode *n)
 #endif
        if (n->ht_down)
                n->ht_down->refcnt--;
+#ifdef CONFIG_CLS_U32_PERF
+       if (n && (NULL != n->pf))
+               kfree(n->pf);
+#endif
        kfree(n);
        return 0;
 }
@@ -571,18 +583,6 @@ static int u32_set_parms(struct Qdisc *q, unsigned long base,
                tcf_action_destroy(act, TCA_ACT_UNBIND);
        }
 
-#ifdef CONFIG_NET_CLS_IND
-       n->indev[0] = 0;
-       if(tb[TCA_U32_INDEV-1]) {
-               struct rtattr *input_dev = tb[TCA_U32_INDEV-1];
-               if (RTA_PAYLOAD(input_dev) >= IFNAMSIZ) {
-                       printk("cls_u32: bad indev name %s\n",(char*)RTA_DATA(input_dev));
-                       /* should we clear state first? */
-                       return  -EINVAL;
-               }
-               sprintf(n->indev, "%s", (char*)RTA_DATA(input_dev));
-       }
-#endif
 
 #else
 #ifdef CONFIG_NET_CLS_POLICE
@@ -594,6 +594,19 @@ static int u32_set_parms(struct Qdisc *q, unsigned long base,
                tcf_police_release(police, TCA_ACT_UNBIND);
        }
 #endif
+#endif
+#ifdef CONFIG_NET_CLS_IND
+       n->indev[0] = 0;
+       if(tb[TCA_U32_INDEV-1]) {
+               struct rtattr *input_dev = tb[TCA_U32_INDEV-1];
+               if (RTA_PAYLOAD(input_dev) >= IFNAMSIZ) {
+                       printk("cls_u32: bad indev name %s\n",(char*)RTA_DATA(input_dev));
+                       /* should we clear state first? */
+                       return  -EINVAL;
+               }
+               sprintf(n->indev, "%s", (char*)RTA_DATA(input_dev));
+               printk("got IND %s\n",n->indev);
+       }
 #endif
 
        return 0;
@@ -682,17 +695,20 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
 
        s = RTA_DATA(tb[TCA_U32_SEL-1]);
 
-#ifdef CONFIG_CLS_U32_PERF
-       if (RTA_PAYLOAD(tb[TCA_U32_SEL-1]) < 
-               (s->nkeys*sizeof(struct tc_u32_key)) + sizeof(struct tc_u32_sel)) {
-                       printk("Please upgrade your iproute2 tools or compile proper options in!\n");
-                       return -EINVAL;
-}
-#endif
        n = kmalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL);
        if (n == NULL)
                return -ENOBUFS;
+
        memset(n, 0, sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key));
+#ifdef CONFIG_CLS_U32_PERF
+       n->pf = kmalloc(sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(__u64), GFP_KERNEL);
+       if (n->pf == NULL) {
+               kfree(n);
+               return -ENOBUFS;
+       }
+       memset(n->pf, 0, sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(__u64));
+#endif
+
        memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
        n->ht_up = ht;
        n->handle = handle;
@@ -721,6 +737,10 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
                *arg = (unsigned long)n;
                return 0;
        }
+#ifdef CONFIG_CLS_U32_PERF
+       if (n && (NULL != n->pf))
+               kfree(n->pf);
+#endif
        kfree(n);
        return err;
 }
@@ -812,13 +832,6 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
 
                        p_rta->rta_len = skb->tail - (u8*)p_rta;
                }
-#ifdef CONFIG_NET_CLS_IND
-               if(strlen(n->indev)) {
-                       struct rtattr * p_rta = (struct rtattr*)skb->tail;
-                       RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev);
-                       p_rta->rta_len = skb->tail - (u8*)p_rta;
-               }
-#endif
 
 #else
 #ifdef CONFIG_NET_CLS_POLICE
@@ -833,14 +846,29 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
 
                }
 #endif
+#endif
+
+#ifdef CONFIG_NET_CLS_IND
+               if(strlen(n->indev)) {
+                       struct rtattr * p_rta = (struct rtattr*)skb->tail;
+                       RTA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n->indev);
+                       p_rta->rta_len = skb->tail - (u8*)p_rta;
+               }
+#endif
+#ifdef CONFIG_CLS_U32_PERF
+               RTA_PUT(skb, TCA_U32_PCNT, 
+               sizeof(struct tc_u32_pcnt) + n->sel.nkeys*sizeof(__u64),
+                       n->pf);
 #endif
        }
 
        rta->rta_len = skb->tail - b;
 #ifdef CONFIG_NET_CLS_ACT
-       if (TC_U32_KEY(n->handle) && n->action && n->action->type == TCA_OLD_COMPAT) {
-               if (tcf_action_copy_stats(skb,n->action))
-                       goto rtattr_failure;
+       if (TC_U32_KEY(n->handle) != 0) {
+               if (TC_U32_KEY(n->handle) && n->action && n->action->type == TCA_OLD_COMPAT) {
+                       if (tcf_action_copy_stats(skb,n->action))
+                               goto rtattr_failure;
+               }
        }
 #else
 #ifdef CONFIG_NET_CLS_POLICE
@@ -875,6 +903,19 @@ static struct tcf_proto_ops cls_u32_ops = {
 
 static int __init init_u32(void)
 {
+       printk("u32 classifier\n");
+#ifdef CONFIG_CLS_U32_PERF
+       printk("    Perfomance counters on\n");
+#endif
+#ifdef CONFIG_NET_CLS_POLICE
+       printk("    OLD policer on \n");
+#endif
+#ifdef CONFIG_NET_CLS_IND
+       printk("    input device check on \n");
+#endif
+#ifdef CONFIG_NET_CLS_ACT
+       printk("    Actions configured \n");
+#endif
        return register_tcf_proto_ops(&cls_u32_ops);
 }
 
index 575ca50..19ff1b9 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/kmod.h>
+#include <linux/list.h>
 
 #include <net/sock.h>
 #include <net/pkt_sched.h>
@@ -195,7 +196,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
 {
        struct Qdisc *q;
 
-       for (q = dev->qdisc_list; q; q = q->next) {
+       list_for_each_entry(q, &dev->qdisc_list, list) {
                if (q->handle == handle)
                        return q;
        }
@@ -306,8 +307,7 @@ dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)
        if (dev->flags & IFF_UP)
                dev_deactivate(dev);
 
-       write_lock(&qdisc_tree_lock);
-       spin_lock_bh(&dev->queue_lock);
+       qdisc_lock_tree(dev);
        if (qdisc && qdisc->flags&TCQ_F_INGRES) {
                oqdisc = dev->qdisc_ingress;
                /* Prune old scheduler */
@@ -334,8 +334,7 @@ dev_graft_qdisc(struct net_device *dev, struct Qdisc *qdisc)
                dev->qdisc = &noop_qdisc;
        }
 
-       spin_unlock_bh(&dev->queue_lock);
-       write_unlock(&qdisc_tree_lock);
+       qdisc_unlock_tree(dev);
 
        if (dev->flags & IFF_UP)
                dev_activate(dev);
@@ -390,7 +389,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
 {
        int err;
        struct rtattr *kind = tca[TCA_KIND-1];
-       struct Qdisc *sch = NULL;
+       void *p = NULL;
+       struct Qdisc *sch;
        struct Qdisc_ops *ops;
        int size;
 
@@ -408,12 +408,18 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
        if (ops == NULL)
                goto err_out;
 
-       size = sizeof(*sch) + ops->priv_size;
+       /* ensure that the Qdisc and the private data are 32-byte aligned */
+       size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST);
+       size += ops->priv_size + QDISC_ALIGN_CONST;
 
-       sch = kmalloc(size, GFP_KERNEL);
+       p = kmalloc(size, GFP_KERNEL);
        err = -ENOBUFS;
-       if (!sch)
+       if (!p)
                goto err_out;
+       memset(p, 0, size);
+       sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST)
+                              & ~QDISC_ALIGN_CONST);
+       sch->padded = (char *)sch - (char *)p;
 
        /* Grrr... Resolve race condition with module unload */
 
@@ -421,8 +427,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
        if (ops != qdisc_lookup_ops(kind))
                goto err_out;
 
-       memset(sch, 0, size);
-
+       INIT_LIST_HEAD(&sch->list);
        skb_queue_head_init(&sch->q);
 
        if (handle == TC_H_INGRESS)
@@ -432,6 +437,7 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
        sch->enqueue = ops->enqueue;
        sch->dequeue = ops->dequeue;
        sch->dev = dev;
+       dev_hold(dev);
        atomic_set(&sch->refcnt, 1);
        sch->stats_lock = &dev->queue_lock;
        if (handle == 0) {
@@ -454,10 +460,10 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
         * before we set a netdevice's qdisc pointer to sch */
        smp_wmb();
        if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS-1])) == 0) {
-               write_lock(&qdisc_tree_lock);
-               sch->next = dev->qdisc_list;
-               dev->qdisc_list = sch;
-               write_unlock(&qdisc_tree_lock);
+               qdisc_lock_tree(dev);
+               list_add_tail(&sch->list, &dev->qdisc_list);
+               qdisc_unlock_tree(dev);
+
 #ifdef CONFIG_NET_ESTIMATOR
                if (tca[TCA_RATE-1])
                        qdisc_new_estimator(&sch->stats, sch->stats_lock,
@@ -469,8 +475,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
 
 err_out:
        *errp = err;
-       if (sch)
-               kfree(sch);
+       if (p)
+               kfree(p);
        return NULL;
 }
 
@@ -752,7 +758,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid,
        nlh->nlmsg_flags = flags;
        tcm = NLMSG_DATA(nlh);
        tcm->tcm_family = AF_UNSPEC;
-       tcm->tcm_ifindex = q->dev ? q->dev->ifindex : 0;
+       tcm->tcm_ifindex = q->dev->ifindex;
        tcm->tcm_parent = clid;
        tcm->tcm_handle = q->handle;
        tcm->tcm_info = atomic_read(&q->refcnt);
@@ -813,18 +819,21 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
                        continue;
                if (idx > s_idx)
                        s_q_idx = 0;
-               read_lock(&qdisc_tree_lock);
-               for (q = dev->qdisc_list, q_idx = 0; q;
-                    q = q->next, q_idx++) {
-                       if (q_idx < s_q_idx)
+               read_lock_bh(&qdisc_tree_lock);
+               q_idx = 0;
+               list_for_each_entry(q, &dev->qdisc_list, list) {
+                       if (q_idx < s_q_idx) {
+                               q_idx++;
                                continue;
+                       }
                        if (tc_fill_qdisc(skb, q, 0, NETLINK_CB(cb->skb).pid,
                                          cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) {
-                               read_unlock(&qdisc_tree_lock);
+                               read_unlock_bh(&qdisc_tree_lock);
                                goto done;
                        }
+                       q_idx++;
                }
-               read_unlock(&qdisc_tree_lock);
+               read_unlock_bh(&qdisc_tree_lock);
        }
 
 done:
@@ -969,7 +978,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q,
        nlh->nlmsg_flags = flags;
        tcm = NLMSG_DATA(nlh);
        tcm->tcm_family = AF_UNSPEC;
-       tcm->tcm_ifindex = q->dev ? q->dev->ifindex : 0;
+       tcm->tcm_ifindex = q->dev->ifindex;
        tcm->tcm_parent = q->handle;
        tcm->tcm_handle = q->handle;
        tcm->tcm_info = 0;
@@ -1033,13 +1042,16 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
                return 0;
 
        s_t = cb->args[0];
-
-       read_lock(&qdisc_tree_lock);
-       for (q=dev->qdisc_list, t=0; q; q = q->next, t++) {
-               if (t < s_t) continue;
-               if (!q->ops->cl_ops) continue;
-               if (tcm->tcm_parent && TC_H_MAJ(tcm->tcm_parent) != q->handle)
+       t = 0;
+
+       read_lock_bh(&qdisc_tree_lock);
+       list_for_each_entry(q, &dev->qdisc_list, list) {
+               if (t < s_t || !q->ops->cl_ops ||
+                   (tcm->tcm_parent &&
+                    TC_H_MAJ(tcm->tcm_parent) != q->handle)) {
+                       t++;
                        continue;
+               }
                if (t > s_t)
                        memset(&cb->args[1], 0, sizeof(cb->args)-sizeof(cb->args[0]));
                arg.w.fn = qdisc_class_dump;
@@ -1052,8 +1064,9 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
                cb->args[1] = arg.w.count;
                if (arg.w.stop)
                        break;
+               t++;
        }
-       read_unlock(&qdisc_tree_lock);
+       read_unlock_bh(&qdisc_tree_lock);
 
        cb->args[0] = t;
 
@@ -1088,7 +1101,7 @@ static struct file_operations psched_fops = {
 };     
 #endif
 
-#if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
 int psched_tod_diff(int delta_sec, int bound)
 {
        int delta;
@@ -1103,42 +1116,34 @@ int psched_tod_diff(int delta_sec, int bound)
 EXPORT_SYMBOL(psched_tod_diff);
 #endif
 
-psched_time_t psched_time_base;
-
-#if PSCHED_CLOCK_SOURCE == PSCHED_CPU
+#ifdef CONFIG_NET_SCH_CLK_CPU
 psched_tdiff_t psched_clock_per_hz;
 int psched_clock_scale;
 EXPORT_SYMBOL(psched_clock_per_hz);
 EXPORT_SYMBOL(psched_clock_scale);
-#endif
 
-#ifdef PSCHED_WATCHER
-PSCHED_WATCHER psched_time_mark;
+psched_time_t psched_time_base;
+cycles_t psched_time_mark;
 EXPORT_SYMBOL(psched_time_mark);
 EXPORT_SYMBOL(psched_time_base);
 
+/*
+ * Periodically adjust psched_time_base to avoid overflow
+ * with 32-bit get_cycles(). Safe up to 4GHz CPU.
+ */
 static void psched_tick(unsigned long);
-
 static struct timer_list psched_timer = TIMER_INITIALIZER(psched_tick, 0, 0);
 
 static void psched_tick(unsigned long dummy)
 {
-#if PSCHED_CLOCK_SOURCE == PSCHED_CPU
-       psched_time_t dummy_stamp;
-       PSCHED_GET_TIME(dummy_stamp);
-       /* It is OK up to 4GHz cpu */
-       psched_timer.expires = jiffies + 1*HZ;
-#else
-       unsigned long now = jiffies;
-       psched_time_base += ((u64)(now-psched_time_mark))<<PSCHED_JSCALE;
-       psched_time_mark = now;
-       psched_timer.expires = now + 60*60*HZ;
-#endif
-       add_timer(&psched_timer);
+       if (sizeof(cycles_t) == sizeof(u32)) {
+               psched_time_t dummy_stamp;
+               PSCHED_GET_TIME(dummy_stamp);
+               psched_timer.expires = jiffies + 1*HZ;
+               add_timer(&psched_timer);
+       }
 }
-#endif
 
-#if PSCHED_CLOCK_SOURCE == PSCHED_CPU
 int __init psched_calibrate_clock(void)
 {
        psched_time_t stamp, stamp1;
@@ -1147,9 +1152,7 @@ int __init psched_calibrate_clock(void)
        long rdelay;
        unsigned long stop;
 
-#ifdef PSCHED_WATCHER
        psched_tick(0);
-#endif
        stop = jiffies + HZ/10;
        PSCHED_GET_TIME(stamp);
        do_gettimeofday(&tv);
@@ -1179,15 +1182,12 @@ static int __init pktsched_init(void)
 {
        struct rtnetlink_link *link_p;
 
-#if PSCHED_CLOCK_SOURCE == PSCHED_CPU
+#ifdef CONFIG_NET_SCH_CLK_CPU
        if (psched_calibrate_clock() < 0)
                return -1;
-#elif PSCHED_CLOCK_SOURCE == PSCHED_JIFFIES
+#elif defined(CONFIG_NET_SCH_CLK_JIFFIES)
        psched_tick_per_us = HZ<<PSCHED_JSCALE;
        psched_us_per_tick = 1000000;
-#ifdef PSCHED_WATCHER
-       psched_tick(0);
-#endif
 #endif
 
        link_p = rtnetlink_links[PF_UNSPEC];
index c43a6e0..ca08449 100644 (file)
@@ -56,7 +56,7 @@ extern struct socket *sockfd_lookup(int fd, int *err); /* @@@ fix this */
  */
 
 
-#define PRIV(sch) ((struct atm_qdisc_data *) (sch)->data)
+#define PRIV(sch) qdisc_priv(sch)
 #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)->user_back))
 
 
@@ -104,9 +104,10 @@ static int find_flow(struct atm_qdisc_data *qdisc,struct atm_flow_data *flow)
 static __inline__ struct atm_flow_data *lookup_flow(struct Qdisc *sch,
     u32 classid)
 {
+       struct atm_qdisc_data *p = PRIV(sch);
        struct atm_flow_data *flow;
 
-        for (flow = PRIV(sch)->flows; flow; flow = flow->next)
+        for (flow = p->flows; flow; flow = flow->next)
                if (flow->classid == classid) break;
        return flow;
 }
index 2d48488..01dfcb1 100644 (file)
@@ -241,7 +241,7 @@ cbq_reclassify(struct sk_buff *skb, struct cbq_class *this)
 static struct cbq_class *
 cbq_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *head = &q->link;
        struct cbq_class **defmap;
        struct cbq_class *cl = NULL;
@@ -344,7 +344,7 @@ fallback:
 
 static __inline__ void cbq_activate_class(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        int prio = cl->cpriority;
        struct cbq_class *cl_tail;
 
@@ -368,7 +368,7 @@ static __inline__ void cbq_activate_class(struct cbq_class *cl)
 
 static void cbq_deactivate_class(struct cbq_class *this)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(this->qdisc);
        int prio = this->cpriority;
        struct cbq_class *cl;
        struct cbq_class *cl_prev = q->active[prio];
@@ -419,7 +419,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
 static int
 cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        int len = skb->len;
        int ret = NET_XMIT_SUCCESS;
        struct cbq_class *cl = cbq_classify(skb, sch,&ret);
@@ -466,7 +466,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 static int
 cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl;
        int ret;
 
@@ -500,7 +500,7 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
 
 static void cbq_ovl_classic(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now);
 
        if (!cl->delayed) {
@@ -554,7 +554,7 @@ static void cbq_ovl_classic(struct cbq_class *cl)
 
 static void cbq_ovl_rclassic(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        struct cbq_class *this = cl;
 
        do {
@@ -573,7 +573,7 @@ static void cbq_ovl_rclassic(struct cbq_class *cl)
 
 static void cbq_ovl_delay(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        psched_tdiff_t delay = PSCHED_TDIFF(cl->undertime, q->now);
 
        if (!cl->delayed) {
@@ -609,7 +609,7 @@ static void cbq_ovl_delay(struct cbq_class *cl)
 
 static void cbq_ovl_lowprio(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
 
        cl->penalized = jiffies + cl->penalty;
 
@@ -678,7 +678,7 @@ static unsigned long cbq_undelay_prio(struct cbq_sched_data *q, int prio)
 static void cbq_undelay(unsigned long arg)
 {
        struct Qdisc *sch = (struct Qdisc*)arg;
-       struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        long delay = 0;
        unsigned pmask;
 
@@ -715,7 +715,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
 {
        int len = skb->len;
        struct Qdisc *sch = child->__parent;
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = q->rx_class;
 
        q->rx_class = NULL;
@@ -863,7 +863,7 @@ cbq_update(struct cbq_sched_data *q)
 static __inline__ struct cbq_class *
 cbq_under_limit(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        struct cbq_class *this_cl = cl;
 
        if (cl->tparent == NULL)
@@ -903,7 +903,7 @@ cbq_under_limit(struct cbq_class *cl)
 static __inline__ struct sk_buff *
 cbq_dequeue_prio(struct Qdisc *sch, int prio)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl_tail, *cl_prev, *cl;
        struct sk_buff *skb;
        int deficit;
@@ -1006,7 +1006,7 @@ next_class:
 static __inline__ struct sk_buff *
 cbq_dequeue_1(struct Qdisc *sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct sk_buff *skb;
        unsigned activemask;
 
@@ -1025,7 +1025,7 @@ static struct sk_buff *
 cbq_dequeue(struct Qdisc *sch)
 {
        struct sk_buff *skb;
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        psched_time_t now;
        psched_tdiff_t incr;
 
@@ -1150,7 +1150,7 @@ static void cbq_normalize_quanta(struct cbq_sched_data *q, int prio)
 
 static void cbq_sync_defmap(struct cbq_class *cl)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
        struct cbq_class *split = cl->split;
        unsigned h;
        int i;
@@ -1216,7 +1216,7 @@ static void cbq_change_defmap(struct cbq_class *cl, u32 splitid, u32 def, u32 ma
 static void cbq_unlink_class(struct cbq_class *this)
 {
        struct cbq_class *cl, **clp;
-       struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(this->qdisc);
 
        for (clp = &q->classes[cbq_hash(this->classid)]; (cl = *clp) != NULL; clp = &cl->next) {
                if (cl == this) {
@@ -1249,7 +1249,7 @@ static void cbq_unlink_class(struct cbq_class *this)
 
 static void cbq_link_class(struct cbq_class *this)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)this->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(this->qdisc);
        unsigned h = cbq_hash(this->classid);
        struct cbq_class *parent = this->tparent;
 
@@ -1270,7 +1270,7 @@ static void cbq_link_class(struct cbq_class *this)
 
 static unsigned int cbq_drop(struct Qdisc* sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl, *cl_head;
        int prio;
        unsigned int len;
@@ -1293,7 +1293,7 @@ static unsigned int cbq_drop(struct Qdisc* sch)
 static void
 cbq_reset(struct Qdisc* sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl;
        int prio;
        unsigned h;
@@ -1363,7 +1363,7 @@ static void cbq_addprio(struct cbq_sched_data *q, struct cbq_class *cl)
 
 static int cbq_set_wrr(struct cbq_class *cl, struct tc_cbq_wrropt *wrr)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)cl->qdisc->data;
+       struct cbq_sched_data *q = qdisc_priv(cl->qdisc);
 
        if (wrr->allot)
                cl->allot = wrr->allot;
@@ -1432,7 +1432,7 @@ static int cbq_set_fopt(struct cbq_class *cl, struct tc_cbq_fopt *fopt)
 
 static int cbq_init(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct rtattr *tb[TCA_CBQ_MAX];
        struct tc_ratespec *r;
 
@@ -1623,7 +1623,7 @@ rtattr_failure:
 
 static int cbq_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        unsigned char    *b = skb->tail;
        struct rtattr *rta;
 
@@ -1650,7 +1650,7 @@ static int
 cbq_dump_class(struct Qdisc *sch, unsigned long arg,
               struct sk_buff *skb, struct tcmsg *tcm)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data*)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = (struct cbq_class*)arg;
        unsigned char    *b = skb->tail;
        struct rtattr *rta;
@@ -1726,7 +1726,7 @@ cbq_leaf(struct Qdisc *sch, unsigned long arg)
 
 static unsigned long cbq_get(struct Qdisc *sch, u32 classid)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = cbq_class_lookup(q, classid);
 
        if (cl) {
@@ -1760,7 +1760,7 @@ static void cbq_destroy_class(struct cbq_class *cl)
 static void
 cbq_destroy(struct Qdisc* sch)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl;
        unsigned h;
 
@@ -1791,7 +1791,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg)
 
        if (--cl->refcnt == 0) {
 #ifdef CONFIG_NET_CLS_POLICE
-               struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+               struct cbq_sched_data *q = qdisc_priv(sch);
 
                spin_lock_bh(&sch->dev->queue_lock);
                if (q->rx_class == cl)
@@ -1808,7 +1808,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t
                 unsigned long *arg)
 {
        int err;
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = (struct cbq_class*)*arg;
        struct rtattr *opt = tca[TCA_OPTIONS-1];
        struct rtattr *tb[TCA_CBQ_MAX];
@@ -2004,7 +2004,7 @@ failure:
 
 static int cbq_delete(struct Qdisc *sch, unsigned long arg)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = (struct cbq_class*)arg;
 
        if (cl->filters || cl->children || cl == &q->link)
@@ -2042,7 +2042,7 @@ static int cbq_delete(struct Qdisc *sch, unsigned long arg)
 
 static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *cl = (struct cbq_class *)arg;
 
        if (cl == NULL)
@@ -2054,7 +2054,7 @@ static struct tcf_proto **cbq_find_tcf(struct Qdisc *sch, unsigned long arg)
 static unsigned long cbq_bind_filter(struct Qdisc *sch, unsigned long parent,
                                     u32 classid)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        struct cbq_class *p = (struct cbq_class*)parent;
        struct cbq_class *cl = cbq_class_lookup(q, classid);
 
@@ -2076,7 +2076,7 @@ static void cbq_unbind_filter(struct Qdisc *sch, unsigned long arg)
 
 static void cbq_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 {
-       struct cbq_sched_data *q = (struct cbq_sched_data *)sch->data;
+       struct cbq_sched_data *q = qdisc_priv(sch);
        unsigned h;
 
        if (arg->stop)
index 672650c..82117f9 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/init.h>
 #include <linux/rcupdate.h>
+#include <linux/list.h>
 #include <net/sock.h>
 #include <net/pkt_sched.h>
 
    The idea is the following:
    - enqueue, dequeue are serialized via top level device
      spinlock dev->queue_lock.
-   - tree walking is protected by read_lock(qdisc_tree_lock)
+   - tree walking is protected by read_lock_bh(qdisc_tree_lock)
      and this lock is used only in process context.
-   - updates to tree are made only under rtnl semaphore,
-     hence this lock may be made without local bh disabling.
+   - updates to tree are made under rtnl semaphore or
+     from softirq context (__qdisc_destroy rcu-callback)
+     hence this lock needs local bh disabling.
 
    qdisc_tree_lock must be grabbed BEFORE dev->queue_lock!
  */
 rwlock_t qdisc_tree_lock = RW_LOCK_UNLOCKED;
 
+void qdisc_lock_tree(struct net_device *dev)
+{
+       write_lock_bh(&qdisc_tree_lock);
+       spin_lock_bh(&dev->queue_lock);
+}
+
+void qdisc_unlock_tree(struct net_device *dev)
+{
+       spin_unlock_bh(&dev->queue_lock);
+       write_unlock_bh(&qdisc_tree_lock);
+}
+
 /* 
    dev->queue_lock serializes queue accesses for this device
    AND dev->qdisc pointer itself.
@@ -271,10 +285,9 @@ static const u8 prio2band[TC_PRIO_MAX+1] =
 static int
 pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
 {
-       struct sk_buff_head *list;
+       struct sk_buff_head *list = qdisc_priv(qdisc);
 
-       list = ((struct sk_buff_head*)qdisc->data) +
-               prio2band[skb->priority&TC_PRIO_MAX];
+       list += prio2band[skb->priority&TC_PRIO_MAX];
 
        if (list->qlen < qdisc->dev->tx_queue_len) {
                __skb_queue_tail(list, skb);
@@ -292,7 +305,7 @@ static struct sk_buff *
 pfifo_fast_dequeue(struct Qdisc* qdisc)
 {
        int prio;
-       struct sk_buff_head *list = ((struct sk_buff_head*)qdisc->data);
+       struct sk_buff_head *list = qdisc_priv(qdisc);
        struct sk_buff *skb;
 
        for (prio = 0; prio < 3; prio++, list++) {
@@ -308,10 +321,9 @@ pfifo_fast_dequeue(struct Qdisc* qdisc)
 static int
 pfifo_fast_requeue(struct sk_buff *skb, struct Qdisc* qdisc)
 {
-       struct sk_buff_head *list;
+       struct sk_buff_head *list = qdisc_priv(qdisc);
 
-       list = ((struct sk_buff_head*)qdisc->data) +
-               prio2band[skb->priority&TC_PRIO_MAX];
+       list += prio2band[skb->priority&TC_PRIO_MAX];
 
        __skb_queue_head(list, skb);
        qdisc->q.qlen++;
@@ -322,7 +334,7 @@ static void
 pfifo_fast_reset(struct Qdisc* qdisc)
 {
        int prio;
-       struct sk_buff_head *list = ((struct sk_buff_head*)qdisc->data);
+       struct sk_buff_head *list = qdisc_priv(qdisc);
 
        for (prio=0; prio < 3; prio++)
                skb_queue_purge(list+prio);
@@ -347,9 +359,7 @@ rtattr_failure:
 static int pfifo_fast_init(struct Qdisc *qdisc, struct rtattr *opt)
 {
        int i;
-       struct sk_buff_head *list;
-
-       list = ((struct sk_buff_head*)qdisc->data);
+       struct sk_buff_head *list = qdisc_priv(qdisc);
 
        for (i=0; i<3; i++)
                skb_queue_head_init(list+i);
@@ -373,19 +383,30 @@ static struct Qdisc_ops pfifo_fast_ops = {
 
 struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
 {
+       void *p;
        struct Qdisc *sch;
-       int size = sizeof(*sch) + ops->priv_size;
+       int size;
+
+       /* ensure that the Qdisc and the private data are 32-byte aligned */
+       size = ((sizeof(*sch) + QDISC_ALIGN_CONST) & ~QDISC_ALIGN_CONST);
+       size += ops->priv_size + QDISC_ALIGN_CONST;
 
-       sch = kmalloc(size, GFP_KERNEL);
-       if (!sch)
+       p = kmalloc(size, GFP_KERNEL);
+       if (!p)
                return NULL;
-       memset(sch, 0, size);
+       memset(p, 0, size);
 
+       sch = (struct Qdisc *)(((unsigned long)p + QDISC_ALIGN_CONST) 
+                              & ~QDISC_ALIGN_CONST);
+       sch->padded = (char *)sch - (char *)p;
+
+       INIT_LIST_HEAD(&sch->list);
        skb_queue_head_init(&sch->q);
        sch->ops = ops;
        sch->enqueue = ops->enqueue;
        sch->dequeue = ops->dequeue;
        sch->dev = dev;
+       dev_hold(dev);
        sch->stats_lock = &dev->queue_lock;
        atomic_set(&sch->refcnt, 1);
        /* enqueue is accessed locklessly - make sure it's visible
@@ -394,7 +415,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops)
        if (!ops->init || ops->init(sch, NULL) == 0)
                return sch;
 
-       kfree(sch);
+       kfree(p);
        return NULL;
 }
 
@@ -419,40 +440,29 @@ static void __qdisc_destroy(struct rcu_head *head)
 #ifdef CONFIG_NET_ESTIMATOR
        qdisc_kill_estimator(&qdisc->stats);
 #endif
+       write_lock(&qdisc_tree_lock);
        if (ops->reset)
                ops->reset(qdisc);
        if (ops->destroy)
                ops->destroy(qdisc);
+       write_unlock(&qdisc_tree_lock);
        module_put(ops->owner);
 
+       dev_put(qdisc->dev);
        if (!(qdisc->flags&TCQ_F_BUILTIN))
-               kfree(qdisc);
+               kfree((char *) qdisc - qdisc->padded);
 }
 
 /* Under dev->queue_lock and BH! */
 
 void qdisc_destroy(struct Qdisc *qdisc)
 {
-       struct net_device *dev = qdisc->dev;
-
        if (!atomic_dec_and_test(&qdisc->refcnt))
                return;
-
-       if (dev) {
-               struct Qdisc *q, **qp;
-               for (qp = &qdisc->dev->qdisc_list; (q=*qp) != NULL; qp = &q->next) {
-                       if (q == qdisc) {
-                               *qp = q->next;
-                               break;
-                       }
-               }
-       }
-
+       list_del(&qdisc->list);
        call_rcu(&qdisc->q_rcu, __qdisc_destroy);
-
 }
 
-
 void dev_activate(struct net_device *dev)
 {
        /* No queueing discipline is attached to device;
@@ -469,18 +479,15 @@ void dev_activate(struct net_device *dev)
                                printk(KERN_INFO "%s: activation failed\n", dev->name);
                                return;
                        }
-
-                       write_lock(&qdisc_tree_lock);
-                       qdisc->next = dev->qdisc_list;
-                       dev->qdisc_list = qdisc;
-                       write_unlock(&qdisc_tree_lock);
-
+                       write_lock_bh(&qdisc_tree_lock);
+                       list_add_tail(&qdisc->list, &dev->qdisc_list);
+                       write_unlock_bh(&qdisc_tree_lock);
                } else {
                        qdisc =  &noqueue_qdisc;
                }
-               write_lock(&qdisc_tree_lock);
+               write_lock_bh(&qdisc_tree_lock);
                dev->qdisc_sleeping = qdisc;
-               write_unlock(&qdisc_tree_lock);
+               write_unlock_bh(&qdisc_tree_lock);
        }
 
        spin_lock_bh(&dev->queue_lock);
@@ -513,13 +520,11 @@ void dev_deactivate(struct net_device *dev)
 
 void dev_init_scheduler(struct net_device *dev)
 {
-       write_lock(&qdisc_tree_lock);
-       spin_lock_bh(&dev->queue_lock);
+       qdisc_lock_tree(dev);
        dev->qdisc = &noop_qdisc;
-       spin_unlock_bh(&dev->queue_lock);
        dev->qdisc_sleeping = &noop_qdisc;
-       dev->qdisc_list = NULL;
-       write_unlock(&qdisc_tree_lock);
+       INIT_LIST_HEAD(&dev->qdisc_list);
+       qdisc_unlock_tree(dev);
 
        dev_watchdog_init(dev);
 }
@@ -528,8 +533,7 @@ void dev_shutdown(struct net_device *dev)
 {
        struct Qdisc *qdisc;
 
-       write_lock(&qdisc_tree_lock);
-       spin_lock_bh(&dev->queue_lock);
+       qdisc_lock_tree(dev);
        qdisc = dev->qdisc_sleeping;
        dev->qdisc = &noop_qdisc;
        dev->qdisc_sleeping = &noop_qdisc;
@@ -540,11 +544,8 @@ void dev_shutdown(struct net_device *dev)
                qdisc_destroy(qdisc);
         }
 #endif
-       BUG_TRAP(dev->qdisc_list == NULL);
        BUG_TRAP(!timer_pending(&dev->watchdog_timer));
-       dev->qdisc_list = NULL;
-       spin_unlock_bh(&dev->queue_lock);
-       write_unlock(&qdisc_tree_lock);
+       qdisc_unlock_tree(dev);
 }
 
 EXPORT_SYMBOL(__netdev_watchdog_up);
@@ -554,4 +555,5 @@ EXPORT_SYMBOL(qdisc_create_dflt);
 EXPORT_SYMBOL(qdisc_destroy);
 EXPORT_SYMBOL(qdisc_reset);
 EXPORT_SYMBOL(qdisc_restart);
-EXPORT_SYMBOL(qdisc_tree_lock);
+EXPORT_SYMBOL(qdisc_lock_tree);
+EXPORT_SYMBOL(qdisc_unlock_tree);
index 1861ab1..375c6c2 100644 (file)
@@ -106,7 +106,7 @@ gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
        psched_time_t now;
        struct gred_sched_data *q=NULL;
-       struct gred_sched *t= (struct gred_sched *)sch->data;
+       struct gred_sched *t= qdisc_priv(sch);
        unsigned long   qave=0; 
        int i=0;
 
@@ -215,7 +215,7 @@ static int
 gred_requeue(struct sk_buff *skb, struct Qdisc* sch)
 {
        struct gred_sched_data *q;
-       struct gred_sched *t= (struct gred_sched *)sch->data;
+       struct gred_sched *t= qdisc_priv(sch);
        q= t->tab[(skb->tc_index&0xf)];
 /* error checking here -- probably unnecessary */
        PSCHED_SET_PASTPERFECT(q->qidlestart);
@@ -231,7 +231,7 @@ gred_dequeue(struct Qdisc* sch)
 {
        struct sk_buff *skb;
        struct gred_sched_data *q;
-       struct gred_sched *t= (struct gred_sched *)sch->data;
+       struct gred_sched *t= qdisc_priv(sch);
 
        skb = __skb_dequeue(&sch->q);
        if (skb) {
@@ -264,7 +264,7 @@ static unsigned int gred_drop(struct Qdisc* sch)
        struct sk_buff *skb;
 
        struct gred_sched_data *q;
-       struct gred_sched *t= (struct gred_sched *)sch->data;
+       struct gred_sched *t= qdisc_priv(sch);
 
        skb = __skb_dequeue_tail(&sch->q);
        if (skb) {
@@ -300,7 +300,7 @@ static void gred_reset(struct Qdisc* sch)
 {
        int i;
        struct gred_sched_data *q;
-       struct gred_sched *t= (struct gred_sched *)sch->data;
+       struct gred_sched *t= qdisc_priv(sch);
 
        __skb_queue_purge(&sch->q);
 
@@ -323,7 +323,7 @@ static void gred_reset(struct Qdisc* sch)
 
 static int gred_change(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct gred_sched *table = (struct gred_sched *)sch->data;
+       struct gred_sched *table = qdisc_priv(sch);
        struct gred_sched_data *q;
        struct tc_gred_qopt *ctl;
        struct tc_gred_sopt *sopt;
@@ -469,7 +469,7 @@ static int gred_change(struct Qdisc *sch, struct rtattr *opt)
 
 static int gred_init(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct gred_sched *table = (struct gred_sched *)sch->data;
+       struct gred_sched *table = qdisc_priv(sch);
        struct tc_gred_sopt *sopt;
        struct rtattr *tb[TCA_GRED_STAB];
        struct rtattr *tb2[TCA_GRED_DPS];
@@ -502,7 +502,7 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
        struct rtattr *rta;
        struct tc_gred_qopt *opt = NULL ;
        struct tc_gred_qopt *dst;
-       struct gred_sched *table = (struct gred_sched *)sch->data;
+       struct gred_sched *table = qdisc_priv(sch);
        struct gred_sched_data *q;
        int i;
        unsigned char    *b = skb->tail;
@@ -593,7 +593,7 @@ rtattr_failure:
 
 static void gred_destroy(struct Qdisc *sch)
 {
-       struct gred_sched *table = (struct gred_sched *)sch->data;
+       struct gred_sched *table = qdisc_priv(sch);
        int i;
 
        for (i = 0;i < table->DPs; i++) {
index ce91e23..84ef3ab 100644 (file)
@@ -193,7 +193,7 @@ struct hfsc_sched
 /*
  * macros
  */
-#if PSCHED_CLOCK_SOURCE == PSCHED_GETTIMEOFDAY
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
 #include <linux/time.h>
 #undef PSCHED_GET_TIME
 #define PSCHED_GET_TIME(stamp)                                         \
@@ -429,10 +429,10 @@ actlist_get_minvt(struct hfsc_class *cl, u64 cur_time)
  *     ism: (psched_us/byte) << ISM_SHIFT
  *     dx: psched_us
  *
- * Time source resolution
- *  PSCHED_JIFFIES: for 48<=HZ<=1534 resolution is between 0.63us and 1.27us.
- *  PSCHED_CPU: resolution is between 0.5us and 1us.
- *  PSCHED_GETTIMEOFDAY: resolution is exactly 1us.
+ * Clock source resolution (CONFIG_NET_SCH_CLK_*)
+ *  JIFFIES: for 48<=HZ<=1534 resolution is between 0.63us and 1.27us.
+ *  CPU: resolution is between 0.5us and 1us.
+ *  GETTIMEOFDAY: resolution is exactly 1us.
  *
  * sm and ism are scaled in order to keep effective digits.
  * SM_SHIFT and ISM_SHIFT are selected to keep at least 4 effective
@@ -1016,7 +1016,7 @@ hfsc_hash(u32 h)
 static inline struct hfsc_class *
 hfsc_find_class(u32 classid, struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
 
        list_for_each_entry(cl, &q->clhash[hfsc_hash(classid)], hlist) {
@@ -1061,7 +1061,7 @@ static int
 hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
                   struct rtattr **tca, unsigned long *arg)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl = (struct hfsc_class *)*arg;
        struct hfsc_class *parent = NULL;
        struct rtattr *opt = tca[TCA_OPTIONS-1];
@@ -1204,7 +1204,7 @@ hfsc_destroy_filters(struct tcf_proto **fl)
 static void
 hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
 
        hfsc_destroy_filters(&cl->filter_list);
        qdisc_destroy(cl->qdisc);
@@ -1218,7 +1218,7 @@ hfsc_destroy_class(struct Qdisc *sch, struct hfsc_class *cl)
 static int
 hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl = (struct hfsc_class *)arg;
 
        if (cl->level > 0 || cl->filter_cnt > 0 || cl == &q->root)
@@ -1240,7 +1240,7 @@ hfsc_delete_class(struct Qdisc *sch, unsigned long arg)
 static struct hfsc_class *
 hfsc_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        struct tcf_result res;
        struct tcf_proto *tcf;
@@ -1381,7 +1381,7 @@ hfsc_unbind_tcf(struct Qdisc *sch, unsigned long arg)
 static struct tcf_proto **
 hfsc_tcf_chain(struct Qdisc *sch, unsigned long arg)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl = (struct hfsc_class *)arg;
 
        if (cl == NULL)
@@ -1489,7 +1489,7 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
 static void
 hfsc_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        unsigned int i;
 
@@ -1523,7 +1523,7 @@ hfsc_watchdog(unsigned long arg)
 static void
 hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        u64 next_time = 0;
        long delay;
@@ -1545,7 +1545,7 @@ hfsc_schedule_watchdog(struct Qdisc *sch, u64 cur_time)
 static int
 hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct tc_hfsc_qopt *qopt;
        unsigned int i;
 
@@ -1585,7 +1585,7 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt)
 static int
 hfsc_change_qdisc(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct tc_hfsc_qopt *qopt;
 
        if (opt == NULL || RTA_PAYLOAD(opt) < sizeof(*qopt))
@@ -1632,7 +1632,7 @@ hfsc_reset_class(struct hfsc_class *cl)
 static void
 hfsc_reset_qdisc(struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        unsigned int i;
 
@@ -1651,7 +1651,7 @@ hfsc_reset_qdisc(struct Qdisc *sch)
 static void
 hfsc_destroy_qdisc(struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl, *next;
        unsigned int i;
 
@@ -1666,7 +1666,7 @@ hfsc_destroy_qdisc(struct Qdisc *sch)
 static int
 hfsc_dump_qdisc(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        unsigned char *b = skb->tail;
        struct tc_hfsc_qopt qopt;
 
@@ -1730,7 +1730,7 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 static struct sk_buff *
 hfsc_dequeue(struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        struct sk_buff *skb;
        u64 cur_time;
@@ -1799,7 +1799,7 @@ hfsc_dequeue(struct Qdisc *sch)
 static int
 hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
 
        __skb_queue_head(&q->requeue, skb);
        sch->q.qlen++;
@@ -1809,7 +1809,7 @@ hfsc_requeue(struct sk_buff *skb, struct Qdisc *sch)
 static unsigned int
 hfsc_drop(struct Qdisc *sch)
 {
-       struct hfsc_sched *q = (struct hfsc_sched *)sch->data;
+       struct hfsc_sched *q = qdisc_priv(sch);
        struct hfsc_class *cl;
        unsigned int len;
 
index 65797b3..d07dfd8 100644 (file)
@@ -76,7 +76,7 @@
 #define HTB_HYSTERESIS 1/* whether to use mode hysteresis for speedup */
 #define HTB_QLOCK(S) spin_lock_bh(&(S)->dev->queue_lock)
 #define HTB_QUNLOCK(S) spin_unlock_bh(&(S)->dev->queue_lock)
-#define HTB_VER 0x30010        /* major must be matched with number suplied by TC as version */
+#define HTB_VER 0x30011        /* major must be matched with number suplied by TC as version */
 
 #if HTB_VER >> 16 != TC_HTB_PROTOVER
 #error "Mismatched sch_htb.c and pkt_sch.h"
@@ -172,6 +172,11 @@ struct htb_class
            struct htb_class_inner {
                    struct rb_root feed[TC_HTB_NUMPRIO]; /* feed trees */
                    struct rb_node *ptr[TC_HTB_NUMPRIO]; /* current class ptr */
+            /* When class changes from state 1->2 and disconnects from 
+               parent's feed then we lost ptr value and start from the
+              first child again. Here we store classid of the
+              last valid ptr (used when ptr is NULL). */
+              u32 last_ptr_id[TC_HTB_NUMPRIO];
            } inner;
     } un;
     struct rb_node node[TC_HTB_NUMPRIO]; /* node for self or feed tree */
@@ -218,6 +223,7 @@ struct htb_sched
     struct rb_root row[TC_HTB_MAXDEPTH][TC_HTB_NUMPRIO];
     int row_mask[TC_HTB_MAXDEPTH];
     struct rb_node *ptr[TC_HTB_MAXDEPTH][TC_HTB_NUMPRIO];
+    u32 last_ptr_id[TC_HTB_MAXDEPTH][TC_HTB_NUMPRIO];
 
     /* self wait list - roots of wait PQs per row */
     struct rb_root wait_pq[TC_HTB_MAXDEPTH];
@@ -267,7 +273,7 @@ static __inline__ int htb_hash(u32 h)
 /* find class in global hash table using given handle */
 static __inline__ struct htb_class *htb_find(u32 handle, struct Qdisc *sch)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct list_head *p;
        if (TC_H_MAJ(handle) != sch->handle) 
                return NULL;
@@ -300,7 +306,7 @@ static inline u32 htb_classid(struct htb_class *cl)
 
 static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch, int *qres)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl;
        struct tcf_result res;
        struct tcf_proto *tcf;
@@ -592,8 +598,13 @@ static void htb_deactivate_prios(struct htb_sched *q, struct htb_class *cl)
                        int prio = ffz(~m);
                        m &= ~(1 << prio);
                        
-                       if (p->un.inner.ptr[prio] == cl->node+prio)
-                               htb_next_rb_node(p->un.inner.ptr + prio);
+                       if (p->un.inner.ptr[prio] == cl->node+prio) {
+                               /* we are removing child which is pointed to from
+                                  parent feed - forget the pointer but remember
+                                  classid */
+                               p->un.inner.last_ptr_id[prio] = cl->classid;
+                               p->un.inner.ptr[prio] = NULL;
+                       }
                        
                        htb_safe_rb_erase(cl->node + prio,p->un.inner.feed + prio);
                        
@@ -712,7 +723,7 @@ htb_deactivate(struct htb_sched *q,struct htb_class *cl)
 static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
     int ret = NET_XMIT_SUCCESS;
-    struct htb_sched *q = (struct htb_sched *)sch->data;
+    struct htb_sched *q = qdisc_priv(sch);
     struct htb_class *cl = htb_classify(skb,sch,&ret);
 
 
@@ -759,7 +770,7 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 /* TODO: requeuing packet charges it to policers again !! */
 static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
-    struct htb_sched *q = (struct htb_sched *)sch->data;
+    struct htb_sched *q = qdisc_priv(sch);
     int ret =  NET_XMIT_SUCCESS;
     struct htb_class *cl = htb_classify(skb,sch, &ret);
     struct sk_buff *tskb;
@@ -800,7 +811,7 @@ static void htb_timer(unsigned long arg)
 static void htb_rate_timer(unsigned long arg)
 {
        struct Qdisc *sch = (struct Qdisc*)arg;
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct list_head *p;
 
        /* lock queue so that we can muck with it */
@@ -856,8 +867,13 @@ static void htb_charge_class(struct htb_sched *q,struct htb_class *cl,
                        if (net_ratelimit())
                                printk(KERN_ERR "HTB: bad diff in charge, cl=%X diff=%lX now=%Lu then=%Lu j=%lu\n",
                                       cl->classid, diff,
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
+                                      q->now.tv_sec * 1000000ULL + q->now.tv_usec,
+                                      cl->t_c.tv_sec * 1000000ULL + cl->t_c.tv_usec,
+#else
                                       (unsigned long long) q->now,
                                       (unsigned long long) cl->t_c,
+#endif
                                       q->jiffies);
                        diff = 1000;
                }
@@ -927,8 +943,13 @@ static long htb_do_events(struct htb_sched *q,int level)
                        if (net_ratelimit())
                                printk(KERN_ERR "HTB: bad diff in events, cl=%X diff=%lX now=%Lu then=%Lu j=%lu\n",
                                       cl->classid, diff,
+#ifdef CONFIG_NET_SCH_CLK_GETTIMEOFDAY
+                                      q->now.tv_sec * 1000000ULL + q->now.tv_usec,
+                                      cl->t_c.tv_sec * 1000000ULL + cl->t_c.tv_usec,
+#else
                                       (unsigned long long) q->now,
                                       (unsigned long long) cl->t_c,
+#endif
                                       q->jiffies);
                        diff = 1000;
                }
@@ -942,25 +963,56 @@ static long htb_do_events(struct htb_sched *q,int level)
        return HZ/10;
 }
 
+/* Returns class->node+prio from id-tree where classe's id is >= id. NULL
+   is no such one exists. */
+static struct rb_node *
+htb_id_find_next_upper(int prio,struct rb_node *n,u32 id)
+{
+       struct rb_node *r = NULL;
+       while (n) {
+               struct htb_class *cl = rb_entry(n,struct htb_class,node[prio]);
+               if (id == cl->classid) return n;
+               
+               if (id > cl->classid) {
+                       n = n->rb_right;
+               } else {
+                       r = n;
+                       n = n->rb_left;
+               }
+       }
+       return r;
+}
+
 /**
  * htb_lookup_leaf - returns next leaf class in DRR order
  *
  * Find leaf where current feed pointers points to.
  */
 static struct htb_class *
-htb_lookup_leaf(struct rb_root *tree,int prio,struct rb_node **pptr)
+htb_lookup_leaf(HTB_ARGQ struct rb_root *tree,int prio,struct rb_node **pptr,u32 *pid)
 {
        int i;
        struct {
                struct rb_node *root;
                struct rb_node **pptr;
+               u32 *pid;
        } stk[TC_HTB_MAXDEPTH],*sp = stk;
        
        BUG_TRAP(tree->rb_node);
        sp->root = tree->rb_node;
        sp->pptr = pptr;
+       sp->pid = pid;
 
        for (i = 0; i < 65535; i++) {
+               HTB_DBG(4,2,"htb_lleaf ptr=%p pid=%X\n",*sp->pptr,*sp->pid);
+               
+               if (!*sp->pptr && *sp->pid) { 
+                       /* ptr was invalidated but id is valid - try to recover 
+                          the original or next ptr */
+                       *sp->pptr = htb_id_find_next_upper(prio,sp->root,*sp->pid);
+               }
+               *sp->pid = 0; /* ptr is valid now so that remove this hint as it
+                                can become out of date quickly */
                if (!*sp->pptr) { /* we are at right end; rewind & go up */
                        *sp->pptr = sp->root;
                        while ((*sp->pptr)->rb_left) 
@@ -978,6 +1030,7 @@ htb_lookup_leaf(struct rb_root *tree,int prio,struct rb_node **pptr)
                                return cl;
                        (++sp)->root = cl->un.inner.feed[prio].rb_node;
                        sp->pptr = cl->un.inner.ptr+prio;
+                       sp->pid = cl->un.inner.last_ptr_id+prio;
                }
        }
        BUG_TRAP(0);
@@ -992,7 +1045,8 @@ htb_dequeue_tree(struct htb_sched *q,int prio,int level)
        struct sk_buff *skb = NULL;
        struct htb_class *cl,*start;
        /* look initial class up in the row */
-       start = cl = htb_lookup_leaf (q->row[level]+prio,prio,q->ptr[level]+prio);
+       start = cl = htb_lookup_leaf (HTB_PASSQ q->row[level]+prio,prio,
+                       q->ptr[level]+prio,q->last_ptr_id[level]+prio);
        
        do {
 next:
@@ -1013,8 +1067,9 @@ next:
                        if ((q->row_mask[level] & (1 << prio)) == 0)
                                return NULL; 
                        
-                       next = htb_lookup_leaf (q->row[level]+prio,
-                                       prio,q->ptr[level]+prio);
+                       next = htb_lookup_leaf (HTB_PASSQ q->row[level]+prio,
+                                       prio,q->ptr[level]+prio,q->last_ptr_id[level]+prio);
+
                        if (cl == start) /* fix start if we just deleted it */
                                start = next;
                        cl = next;
@@ -1029,7 +1084,9 @@ next:
                }
                q->nwc_hit++;
                htb_next_rb_node((level?cl->parent->un.inner.ptr:q->ptr[0])+prio);
-               cl = htb_lookup_leaf (q->row[level]+prio,prio,q->ptr[level]+prio);
+               cl = htb_lookup_leaf (HTB_PASSQ q->row[level]+prio,prio,q->ptr[level]+prio,
+                               q->last_ptr_id[level]+prio);
+
        } while (cl != start);
 
        if (likely(skb != NULL)) {
@@ -1050,7 +1107,7 @@ next:
 
 static void htb_delay_by(struct Qdisc *sch,long delay)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        if (delay <= 0) delay = 1;
        if (unlikely(delay > 5*HZ)) {
                if (net_ratelimit())
@@ -1067,7 +1124,7 @@ static void htb_delay_by(struct Qdisc *sch,long delay)
 static struct sk_buff *htb_dequeue(struct Qdisc *sch)
 {
        struct sk_buff *skb = NULL;
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        int level;
        long min_delay;
 #ifdef HTB_DEBUG
@@ -1137,7 +1194,7 @@ fin:
 /* try to drop from each class (by prio) until one succeed */
 static unsigned int htb_drop(struct Qdisc* sch)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        int prio;
 
        for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) {
@@ -1162,7 +1219,7 @@ static unsigned int htb_drop(struct Qdisc* sch)
 /* always caled under BH & queue lock */
 static void htb_reset(struct Qdisc* sch)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        int i;
        HTB_DBG(0,1,"htb_reset sch=%p, handle=%X\n",sch,sch->handle);
 
@@ -1200,7 +1257,7 @@ static void htb_reset(struct Qdisc* sch)
 
 static int htb_init(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct htb_sched *q = (struct htb_sched*)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct rtattr *tb[TCA_HTB_INIT];
        struct tc_htb_glob *gopt;
        int i;
@@ -1255,7 +1312,7 @@ static int htb_init(struct Qdisc *sch, struct rtattr *opt)
 
 static int htb_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct htb_sched *q = (struct htb_sched*)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        unsigned char    *b = skb->tail;
        struct rtattr *rta;
        struct tc_htb_glob gopt;
@@ -1290,7 +1347,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg,
        struct sk_buff *skb, struct tcmsg *tcm)
 {
 #ifdef HTB_DEBUG
-       struct htb_sched *q = (struct htb_sched*)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
 #endif
        struct htb_class *cl = (struct htb_class*)arg;
        unsigned char    *b = skb->tail;
@@ -1348,7 +1405,7 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
                sch_tree_lock(sch);
                if ((*old = xchg(&cl->un.leaf.q, new)) != NULL) {
                        if (cl->prio_activity)
-                               htb_deactivate ((struct htb_sched*)sch->data,cl);
+                               htb_deactivate (qdisc_priv(sch),cl);
 
                        /* TODO: is it correct ? Why CBQ doesn't do it ? */
                        sch->q.qlen -= (*old)->q.qlen;  
@@ -1369,7 +1426,7 @@ static struct Qdisc * htb_leaf(struct Qdisc *sch, unsigned long arg)
 static unsigned long htb_get(struct Qdisc *sch, u32 classid)
 {
 #ifdef HTB_DEBUG
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
 #endif
        struct htb_class *cl = htb_find(classid,sch);
        HTB_DBG(0,1,"htb_get clid=%X q=%p cl=%p ref=%d\n",classid,q,cl,cl?cl->refcnt:0);
@@ -1390,7 +1447,7 @@ static void htb_destroy_filters(struct tcf_proto **fl)
 
 static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        HTB_DBG(0,1,"htb_destrycls clid=%X ref=%d\n", cl?cl->classid:0,cl?cl->refcnt:0);
        if (!cl->level) {
                BUG_TRAP(cl->un.leaf.q);
@@ -1425,7 +1482,7 @@ static void htb_destroy_class(struct Qdisc* sch,struct htb_class *cl)
 /* always caled under BH & queue lock */
 static void htb_destroy(struct Qdisc* sch)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        HTB_DBG(0,1,"htb_destroy q=%p\n",q);
 
        del_timer_sync (&q->timer);
@@ -1447,7 +1504,7 @@ static void htb_destroy(struct Qdisc* sch)
 
 static int htb_delete(struct Qdisc *sch, unsigned long arg)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = (struct htb_class*)arg;
        HTB_DBG(0,1,"htb_delete q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0);
 
@@ -1474,7 +1531,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg)
 static void htb_put(struct Qdisc *sch, unsigned long arg)
 {
 #ifdef HTB_DEBUG
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
 #endif
        struct htb_class *cl = (struct htb_class*)arg;
        HTB_DBG(0,1,"htb_put q=%p cl=%X ref=%d\n",q,cl?cl->classid:0,cl?cl->refcnt:0);
@@ -1487,7 +1544,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                u32 parentid, struct rtattr **tca, unsigned long *arg)
 {
        int err = -EINVAL;
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = (struct htb_class*)*arg,*parent;
        struct rtattr *opt = tca[TCA_OPTIONS-1];
        struct qdisc_rate_table *rtab = NULL, *ctab = NULL;
@@ -1613,7 +1670,7 @@ failure:
 
 static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = (struct htb_class *)arg;
        struct tcf_proto **fl = cl ? &cl->filter_list : &q->filter_list;
        HTB_DBG(0,2,"htb_tcf q=%p clid=%X fref=%d fl=%p\n",q,cl?cl->classid:0,cl?cl->filter_cnt:q->filter_cnt,*fl);
@@ -1623,7 +1680,7 @@ static struct tcf_proto **htb_find_tcf(struct Qdisc *sch, unsigned long arg)
 static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent,
        u32 classid)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = htb_find (classid,sch);
        HTB_DBG(0,2,"htb_bind q=%p clid=%X cl=%p fref=%d\n",q,classid,cl,cl?cl->filter_cnt:q->filter_cnt);
        /*if (cl && !cl->level) return 0;
@@ -1644,7 +1701,7 @@ static unsigned long htb_bind_filter(struct Qdisc *sch, unsigned long parent,
 
 static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        struct htb_class *cl = (struct htb_class *)arg;
        HTB_DBG(0,2,"htb_unbind q=%p cl=%p fref=%d\n",q,cl,cl?cl->filter_cnt:q->filter_cnt);
        if (cl) 
@@ -1655,7 +1712,7 @@ static void htb_unbind_filter(struct Qdisc *sch, unsigned long arg)
 
 static void htb_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 {
-       struct htb_sched *q = (struct htb_sched *)sch->data;
+       struct htb_sched *q = qdisc_priv(sch);
        int i;
 
        if (arg->stop)
index 3ec741a..30f2176 100644 (file)
@@ -40,7 +40,7 @@
 #endif
 
 
-#define PRIV(sch) ((struct ingress_qdisc_data *) (sch)->data)
+#define PRIV(sch) qdisc_priv(sch)
 
 
 /* Thanks to Doron Oz for this hack
index a13d219..6961f08 100644 (file)
@@ -49,7 +49,7 @@ struct prio_sched_data
 
 struct Qdisc *prio_classify(struct sk_buff *skb, struct Qdisc *sch,int *r)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        u32 band = skb->priority;
        struct tcf_result res;
 
@@ -151,7 +151,7 @@ static struct sk_buff *
 prio_dequeue(struct Qdisc* sch)
 {
        struct sk_buff *skb;
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        int prio;
        struct Qdisc *qdisc;
 
@@ -169,7 +169,7 @@ prio_dequeue(struct Qdisc* sch)
 
 static unsigned int prio_drop(struct Qdisc* sch)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        int prio;
        unsigned int len;
        struct Qdisc *qdisc;
@@ -189,7 +189,7 @@ static void
 prio_reset(struct Qdisc* sch)
 {
        int prio;
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
 
        for (prio=0; prio<q->bands; prio++)
                qdisc_reset(q->queues[prio]);
@@ -200,7 +200,7 @@ static void
 prio_destroy(struct Qdisc* sch)
 {
        int prio;
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        struct tcf_proto *tp;
 
        while ((tp = q->filter_list) != NULL) {
@@ -208,15 +208,13 @@ prio_destroy(struct Qdisc* sch)
                tcf_destroy(tp);
        }
 
-       for (prio=0; prio<q->bands; prio++) {
+       for (prio=0; prio<q->bands; prio++)
                qdisc_destroy(q->queues[prio]);
-               q->queues[prio] = &noop_qdisc;
-       }
 }
 
 static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        struct tc_prio_qopt *qopt = RTA_DATA(opt);
        int i;
 
@@ -261,7 +259,7 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
 
 static int prio_init(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        int i;
 
        for (i=0; i<TCQ_PRIO_BANDS; i++)
@@ -280,7 +278,7 @@ static int prio_init(struct Qdisc *sch, struct rtattr *opt)
 
 static int prio_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        unsigned char    *b = skb->tail;
        struct tc_prio_qopt opt;
 
@@ -297,7 +295,7 @@ rtattr_failure:
 static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
                      struct Qdisc **old)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        unsigned long band = arg - 1;
 
        if (band >= q->bands)
@@ -319,7 +317,7 @@ static int prio_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 static struct Qdisc *
 prio_leaf(struct Qdisc *sch, unsigned long arg)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        unsigned long band = arg - 1;
 
        if (band >= q->bands)
@@ -330,7 +328,7 @@ prio_leaf(struct Qdisc *sch, unsigned long arg)
 
 static unsigned long prio_get(struct Qdisc *sch, u32 classid)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        unsigned long band = TC_H_MIN(classid);
 
        if (band - 1 >= q->bands)
@@ -352,7 +350,7 @@ static void prio_put(struct Qdisc *q, unsigned long cl)
 static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr **tca, unsigned long *arg)
 {
        unsigned long cl = *arg;
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
 
        if (cl - 1 > q->bands)
                return -ENOENT;
@@ -361,7 +359,7 @@ static int prio_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr
 
 static int prio_delete(struct Qdisc *sch, unsigned long cl)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        if (cl - 1 > q->bands)
                return -ENOENT;
        return 0;
@@ -371,7 +369,7 @@ static int prio_delete(struct Qdisc *sch, unsigned long cl)
 static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb,
                           struct tcmsg *tcm)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
 
        if (cl - 1 > q->bands)
                return -ENOENT;
@@ -383,7 +381,7 @@ static int prio_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *
 
 static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
        int prio;
 
        if (arg->stop)
@@ -404,7 +402,7 @@ static void prio_walk(struct Qdisc *sch, struct qdisc_walker *arg)
 
 static struct tcf_proto ** prio_find_tcf(struct Qdisc *sch, unsigned long cl)
 {
-       struct prio_sched_data *q = (struct prio_sched_data *)sch->data;
+       struct prio_sched_data *q = qdisc_priv(sch);
 
        if (cl)
                return NULL;
index 9e6c85c..5630abb 100644 (file)
@@ -180,7 +180,7 @@ static int red_ecn_mark(struct sk_buff *skb)
 static int
 red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
 
        psched_time_t now;
 
@@ -303,7 +303,7 @@ drop:
 static int
 red_requeue(struct sk_buff *skb, struct Qdisc* sch)
 {
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
 
        PSCHED_SET_PASTPERFECT(q->qidlestart);
 
@@ -316,7 +316,7 @@ static struct sk_buff *
 red_dequeue(struct Qdisc* sch)
 {
        struct sk_buff *skb;
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
 
        skb = __skb_dequeue(&sch->q);
        if (skb) {
@@ -330,7 +330,7 @@ red_dequeue(struct Qdisc* sch)
 static unsigned int red_drop(struct Qdisc* sch)
 {
        struct sk_buff *skb;
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
 
        skb = __skb_dequeue_tail(&sch->q);
        if (skb) {
@@ -347,7 +347,7 @@ static unsigned int red_drop(struct Qdisc* sch)
 
 static void red_reset(struct Qdisc* sch)
 {
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
 
        __skb_queue_purge(&sch->q);
        sch->stats.backlog = 0;
@@ -358,7 +358,7 @@ static void red_reset(struct Qdisc* sch)
 
 static int red_change(struct Qdisc *sch, struct rtattr *opt)
 {
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
        struct rtattr *tb[TCA_RED_STAB];
        struct tc_red_qopt *ctl;
 
@@ -407,7 +407,7 @@ rtattr_failure:
 
 static int red_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct red_sched_data *q = (struct red_sched_data *)sch->data;
+       struct red_sched_data *q = qdisc_priv(sch);
        unsigned char    *b = skb->tail;
        struct rtattr *rta;
        struct tc_red_qopt opt;
@@ -434,10 +434,6 @@ rtattr_failure:
        return -1;
 }
 
-static void red_destroy(struct Qdisc *sch)
-{
-}
-
 static struct Qdisc_ops red_qdisc_ops = {
        .next           =       NULL,
        .cl_ops         =       NULL,
@@ -449,7 +445,6 @@ static struct Qdisc_ops red_qdisc_ops = {
        .drop           =       red_drop,
        .init           =       red_init,
        .reset          =       red_reset,
-       .destroy        =       red_destroy,
        .change         =       red_change,
        .dump           =       red_dump,
        .owner          =       THIS_MODULE,
index e1eaf63..a1df304 100644 (file)
@@ -137,7 +137,7 @@ struct tbf_sched_data
 
 static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        int ret;
 
        if (skb->len > q->max_size) {
@@ -163,7 +163,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
 static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        int ret;
 
        if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
@@ -174,7 +174,7 @@ static int tbf_requeue(struct sk_buff *skb, struct Qdisc* sch)
 
 static unsigned int tbf_drop(struct Qdisc* sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        unsigned int len;
 
        if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
@@ -194,7 +194,7 @@ static void tbf_watchdog(unsigned long arg)
 
 static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        struct sk_buff *skb;
 
        skb = q->qdisc->dequeue(q->qdisc);
@@ -261,7 +261,7 @@ static struct sk_buff *tbf_dequeue(struct Qdisc* sch)
 
 static void tbf_reset(struct Qdisc* sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
 
        qdisc_reset(q->qdisc);
        sch->q.qlen = 0;
@@ -300,7 +300,7 @@ static struct Qdisc *tbf_create_dflt_qdisc(struct net_device *dev, u32 limit)
 static int tbf_change(struct Qdisc* sch, struct rtattr *opt)
 {
        int err = -EINVAL;
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        struct rtattr *tb[TCA_TBF_PTAB];
        struct tc_tbf_qopt *qopt;
        struct qdisc_rate_table *rtab = NULL;
@@ -366,7 +366,7 @@ done:
 
 static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
 
        if (opt == NULL)
                return -EINVAL;
@@ -383,7 +383,7 @@ static int tbf_init(struct Qdisc* sch, struct rtattr *opt)
 
 static void tbf_destroy(struct Qdisc *sch)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
 
        del_timer(&q->wd_timer);
 
@@ -393,12 +393,11 @@ static void tbf_destroy(struct Qdisc *sch)
                qdisc_put_rtab(q->R_tab);
 
        qdisc_destroy(q->qdisc);
-       q->qdisc = &noop_qdisc;
 }
 
 static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        unsigned char    *b = skb->tail;
        struct rtattr *rta;
        struct tc_tbf_qopt opt;
@@ -427,7 +426,7 @@ rtattr_failure:
 static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
                          struct sk_buff *skb, struct tcmsg *tcm)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data*)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
 
        if (cl != 1)    /* only one class */
                return -ENOENT;
@@ -441,7 +440,7 @@ static int tbf_dump_class(struct Qdisc *sch, unsigned long cl,
 static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
                     struct Qdisc **old)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
 
        if (new == NULL)
                new = &noop_qdisc;
@@ -457,7 +456,7 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 
 static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg)
 {
-       struct tbf_sched_data *q = (struct tbf_sched_data *)sch->data;
+       struct tbf_sched_data *q = qdisc_priv(sch);
        return q->qdisc;
 }
 
index 1a2ac8b..16b718f 100644 (file)
@@ -879,7 +879,7 @@ static void sctp_assoc_bh_rcv(struct sctp_association *asoc)
                if (sctp_chunk_is_data(chunk))
                        asoc->peer.last_data_from = chunk->transport;
                else
-                       SCTP_INC_STATS(SctpInCtrlChunks);
+                       SCTP_INC_STATS(SCTP_MIB_INCTRLCHUNKS);
 
                if (chunk->transport)
                        chunk->transport->last_time_heard = jiffies;
@@ -1093,6 +1093,7 @@ static inline int sctp_peer_needs_update(struct sctp_association *asoc)
        case SCTP_STATE_ESTABLISHED:
        case SCTP_STATE_SHUTDOWN_PENDING:
        case SCTP_STATE_SHUTDOWN_RECEIVED:
+       case SCTP_STATE_SHUTDOWN_SENT:
                if ((asoc->rwnd > asoc->a_rwnd) &&
                    ((asoc->rwnd - asoc->a_rwnd) >=
                     min_t(__u32, (asoc->base.sk->sk_rcvbuf >> 1), asoc->pmtu)))
index 67f3afd..cdcd427 100644 (file)
@@ -215,7 +215,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
        offset = 0;
 
        if ((whole > 1) || (whole && over))
-               SCTP_INC_STATS_USER(SctpFragUsrMsgs);
+               SCTP_INC_STATS_USER(SCTP_MIB_FRAGUSRMSGS);
 
        /* Create chunks for all the full sized DATA chunks. */
        for (i=0, len=first_len; i < whole; i++) {
index 5f9a99c..c0b7738 100644 (file)
@@ -369,7 +369,7 @@ static void sctp_endpoint_bh_rcv(struct sctp_endpoint *ep)
                if (asoc && sctp_chunk_is_data(chunk))
                        asoc->peer.last_data_from = chunk->transport;
                else
-                       SCTP_INC_STATS(SctpInCtrlChunks);
+                       SCTP_INC_STATS(SCTP_MIB_INCTRLCHUNKS);
 
                if (chunk->transport)
                        chunk->transport->last_time_heard = jiffies;
index 1adfd8c..09e6df2 100644 (file)
@@ -107,7 +107,7 @@ void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        skb->nh.raw = saveip;
        skb->h.raw = savesctp;
        if (!sk) {
-               ICMP6_INC_STATS_BH(idev, Icmp6InErrors);
+               ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INERRORS);
                goto out;
        }
 
@@ -177,7 +177,7 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
                          __FUNCTION__, skb, skb->len,
                          NIP6(fl.fl6_src), NIP6(fl.fl6_dst));
 
-       SCTP_INC_STATS(SctpOutSCTPPacks);
+       SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
 
        return ip6_xmit(sk, skb, &fl, np->opt, ipfragok);
 }
index 10017a7..14009b0 100644 (file)
@@ -496,7 +496,7 @@ out:
        return err;
 no_route:
        kfree_skb(nskb);
-       IP_INC_STATS_BH(OutNoRoutes);
+       IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
 
        /* FIXME: Returning the 'err' will effect all the associations
         * associated with a socket, although only one of the paths of the
index f3c56f1..13fda77 100644 (file)
@@ -349,15 +349,15 @@ int sctp_outq_tail(struct sctp_outq *q, struct sctp_chunk *chunk)
 
                        sctp_outq_tail_data(q, chunk);
                        if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
-                               SCTP_INC_STATS(SctpOutUnorderChunks);
+                               SCTP_INC_STATS(SCTP_MIB_OUTUNORDERCHUNKS);
                        else
-                               SCTP_INC_STATS(SctpOutOrderChunks);
+                               SCTP_INC_STATS(SCTP_MIB_OUTORDERCHUNKS);
                        q->empty = 0;
                        break;
                };
        } else {
                __skb_queue_tail(&q->control, (struct sk_buff *) chunk);
-               SCTP_INC_STATS(SctpOutCtrlChunks);
+               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
        }
 
        if (error < 0)
@@ -525,10 +525,10 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
                               int rtx_timeout, int *start_timer)
 {
        struct list_head *lqueue;
-       struct list_head *lchunk;
+       struct list_head *lchunk, *lchunk1;
        struct sctp_transport *transport = pkt->transport;
        sctp_xmit_t status;
-       struct sctp_chunk *chunk;
+       struct sctp_chunk *chunk, *chunk1;
        struct sctp_association *asoc;
        int error = 0;
 
@@ -615,6 +615,12 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
                         * the transmitted list.
                         */
                        list_add_tail(lchunk, &transport->transmitted);
+
+                       /* Mark the chunk as ineligible for fast retransmit 
+                        * after it is retransmitted.
+                        */
+                       chunk->fast_retransmit = 0;
+
                        *start_timer = 1;
                        q->empty = 0;
 
@@ -622,6 +628,18 @@ static int sctp_outq_flush_rtx(struct sctp_outq *q, struct sctp_packet *pkt,
                        lchunk = sctp_list_dequeue(lqueue);
                        break;
                };
+
+               /* If we are here due to a retransmit timeout or a fast
+                * retransmit and if there are any chunks left in the retransmit
+                * queue that could not fit in the PMTU sized packet, they need                  * to be marked as ineligible for a subsequent fast retransmit.
+                */
+               if (rtx_timeout && !lchunk) {
+                       list_for_each(lchunk1, lqueue) {
+                               chunk1 = list_entry(lchunk1, struct sctp_chunk,
+                                                   transmitted_list);
+                               chunk1->fast_retransmit = 0;
+                       }
+               }
        }
 
        return error;
@@ -1725,6 +1743,6 @@ static void sctp_generate_fwdtsn(struct sctp_outq *q, __u32 ctsn)
 
        if (ftsn_chunk) {
                __skb_queue_tail(&q->control, (struct sk_buff *)ftsn_chunk);
-               SCTP_INC_STATS(SctpOutCtrlChunks);
+               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
        }
 }
index 30b79d8..16a57cf 100644 (file)
@@ -808,7 +808,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
                          NIPQUAD(((struct rtable *)skb->dst)->rt_src),
                          NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
 
-       SCTP_INC_STATS(SctpOutSCTPPacks);
+       SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
        return ip_queue_xmit(skb, ipfragok);
 }
 
index bd27e0e..c2ca732 100644 (file)
@@ -1846,9 +1846,8 @@ int sctp_process_init(struct sctp_association *asoc, sctp_cid_t cid,
                if (unlikely(!idr_pre_get(&sctp_assocs_id, gfp)))
                        goto clean_up;
                spin_lock_bh(&sctp_assocs_id_lock);
-               error = idr_get_new(&sctp_assocs_id,
-                                   (void *)asoc,
-                                   &assoc_id);
+               error = idr_get_new_above(&sctp_assocs_id, (void *)asoc, 1,
+                                         &assoc_id);
                spin_unlock_bh(&sctp_assocs_id_lock);
                if (error == -EAGAIN)
                        goto retry;
index 4eaa1c1..addb95d 100644 (file)
@@ -148,8 +148,8 @@ sctp_disposition_t sctp_sf_do_4_C(const struct sctp_endpoint *ep,
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
 
-       SCTP_INC_STATS(SctpShutdowns);
-       SCTP_DEC_STATS(SctpCurrEstab);
+       SCTP_INC_STATS(SCTP_MIB_SHUTDOWNS);
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
 
        sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
 
@@ -245,7 +245,7 @@ sctp_disposition_t sctp_sf_do_5_1B_init(const struct sctp_endpoint *ep,
                        if (packet) {
                                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                                SCTP_PACKET(packet));
-                               SCTP_INC_STATS(SctpOutCtrlChunks);
+                               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
                                return SCTP_DISPOSITION_CONSUME;
                        } else {
                                return SCTP_DISPOSITION_NOMEM;
@@ -404,7 +404,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
                sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                                SCTP_STATE(SCTP_STATE_CLOSED));
-               SCTP_INC_STATS(SctpAborteds);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
                sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
                return SCTP_DISPOSITION_DELETE_TCB;
        }
@@ -415,7 +415,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
                              (sctp_init_chunk_t *)chunk->chunk_hdr, chunk,
                              &err_chunk)) {
 
-               SCTP_INC_STATS(SctpAborteds);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
 
                /* This chunk contains fatal error. It is to be discarded.
                 * Send an ABORT, with causes if there is any.
@@ -432,7 +432,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
                        if (packet) {
                                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                                SCTP_PACKET(packet));
-                               SCTP_INC_STATS(SctpOutCtrlChunks);
+                               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
                                sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                                                SCTP_STATE(SCTP_STATE_CLOSED));
                                sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB,
@@ -472,8 +472,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
         */
        sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
-       sctp_add_cmd_sf(commands, SCTP_CMD_COUNTER_RESET,
-                       SCTP_COUNTER(SCTP_COUNTER_INIT_ERROR));
        sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE));
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
@@ -587,8 +585,8 @@ sctp_disposition_t sctp_sf_do_5_1D_ce(const struct sctp_endpoint *ep,
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc));
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_ESTABLISHED));
-       SCTP_INC_STATS(SctpCurrEstab);
-       SCTP_INC_STATS(SctpPassiveEstabs);
+       SCTP_INC_STATS(SCTP_MIB_CURRESTAB);
+       SCTP_INC_STATS(SCTP_MIB_PASSIVEESTABS);
        sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL());
 
        if (new_asoc->autoclose)
@@ -674,6 +672,15 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(const struct sctp_endpoint *ep,
        if (!sctp_vtag_verify(chunk, asoc))
                return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
 
+       /* Reset init error count upon receipt of COOKIE-ACK,
+        * to avoid problems with the managemement of this
+        * counter in stale cookie situations when a transition back
+        * from the COOKIE-ECHOED state to the COOKIE-WAIT
+        * state is performed.
+        */
+       sctp_add_cmd_sf(commands, SCTP_CMD_COUNTER_RESET,
+                       SCTP_COUNTER(SCTP_COUNTER_INIT_ERROR));
+
        /* RFC 2960 5.1 Normal Establishment of an Association
         *
         * E) Upon reception of the COOKIE ACK, endpoint "A" will move
@@ -684,8 +691,8 @@ sctp_disposition_t sctp_sf_do_5_1E_ca(const struct sctp_endpoint *ep,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE));
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_ESTABLISHED));
-       SCTP_INC_STATS(SctpCurrEstab);
-       SCTP_INC_STATS(SctpActiveEstabs);
+       SCTP_INC_STATS(SCTP_MIB_CURRESTAB);
+       SCTP_INC_STATS(SCTP_MIB_ACTIVEESTABS);
        sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL());
        if (asoc->autoclose)
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_START,
@@ -757,8 +764,8 @@ sctp_disposition_t sctp_sf_sendbeat_8_3(const struct sctp_endpoint *ep,
                /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_DELETE_TCB;
        }
 
@@ -960,7 +967,7 @@ static int sctp_sf_send_restart_abort(union sctp_addr *ssa,
                goto out;
        sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, SCTP_PACKET(pkt));
 
-       SCTP_INC_STATS(SctpOutCtrlChunks);
+       SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
 
        /* Discard the rest of the inbound packet. */
        sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL());
@@ -1163,7 +1170,7 @@ static sctp_disposition_t sctp_sf_do_unexpected_init(
                        if (packet) {
                                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                                SCTP_PACKET(packet));
-                               SCTP_INC_STATS(SctpOutCtrlChunks);
+                               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
                                retval = SCTP_DISPOSITION_CONSUME;
                        } else {
                                retval = SCTP_DISPOSITION_NOMEM;
@@ -1501,7 +1508,7 @@ static sctp_disposition_t sctp_sf_do_dupcook_b(const struct sctp_endpoint *ep,
        sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_ESTABLISHED));
-       SCTP_INC_STATS(SctpCurrEstab);
+       SCTP_INC_STATS(SCTP_MIB_CURRESTAB);
        sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START, SCTP_NULL());
 
        repl = sctp_make_cookie_ack(new_asoc, chunk);
@@ -1585,7 +1592,7 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE));
                sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                                SCTP_STATE(SCTP_STATE_ESTABLISHED));
-               SCTP_INC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_CURRESTAB);
                sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_START,
                                SCTP_NULL());
 
@@ -1872,8 +1879,6 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep,
        time_t stale;
        sctp_cookie_preserve_param_t bht;
        sctp_errhdr_t *err;
-       struct list_head *pos;
-       struct sctp_transport *t;
        struct sctp_chunk *reply;
        struct sctp_bind_addr *bp;
        int attempts;
@@ -1920,20 +1925,27 @@ sctp_disposition_t sctp_sf_do_5_2_6_stale(const struct sctp_endpoint *ep,
        /* Clear peer's init_tag cached in assoc as we are sending a new INIT */
        sctp_add_cmd_sf(commands, SCTP_CMD_CLEAR_INIT_TAG, SCTP_NULL());
 
+       /* Stop pending T3-rtx and heartbeat timers */
+       sctp_add_cmd_sf(commands, SCTP_CMD_T3_RTX_TIMERS_STOP, SCTP_NULL());
+       sctp_add_cmd_sf(commands, SCTP_CMD_HB_TIMERS_STOP, SCTP_NULL());
+
+       /* Delete non-primary peer ip addresses since we are transitioning
+        * back to the COOKIE-WAIT state
+        */
+       sctp_add_cmd_sf(commands, SCTP_CMD_DEL_NON_PRIMARY, SCTP_NULL());
+
+       /* If we've sent any data bundled with COOKIE-ECHO we will need to 
+        * resend 
+        */
+       sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, 
+                       SCTP_TRANSPORT(asoc->peer.primary_path));
+
        /* Cast away the const modifier, as we want to just
         * rerun it through as a sideffect.
         */
        sctp_add_cmd_sf(commands, SCTP_CMD_COUNTER_INC,
                        SCTP_COUNTER(SCTP_COUNTER_INIT_ERROR));
 
-       /* If we've sent any data bundled with COOKIE-ECHO we need to
-        * resend.
-        */
-       list_for_each(pos, &asoc->peer.transport_addr_list) {
-               t = list_entry(pos, struct sctp_transport, transports);
-               sctp_add_cmd_sf(commands, SCTP_CMD_RETRAN, SCTP_TRANSPORT(t));
-       }
-
        sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_COOKIE));
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
@@ -2001,8 +2013,8 @@ sctp_disposition_t sctp_sf_do_9_1_abort(const struct sctp_endpoint *ep,
 
        /* ASSOC_FAILED will DELETE_TCB. */
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED, SCTP_U32(error));
-       SCTP_INC_STATS(SctpAborteds);
-       SCTP_DEC_STATS(SctpCurrEstab);
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
 
        return SCTP_DISPOSITION_ABORT;
 }
@@ -2027,7 +2039,7 @@ sctp_disposition_t sctp_sf_cookie_wait_abort(const struct sctp_endpoint *ep,
 
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
-       SCTP_INC_STATS(SctpAborteds);
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
        sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
                        SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
 
@@ -2321,12 +2333,7 @@ sctp_disposition_t sctp_sf_eat_data_6_2(const struct sctp_endpoint *ep,
                                        sctp_cmd_seq_t *commands)
 {
        struct sctp_chunk *chunk = arg;
-       sctp_datahdr_t *data_hdr;
-       struct sctp_chunk *err;
-       size_t datalen;
-       sctp_verb_t deliver;
-       int tmp;
-       __u32 tsn;
+       int error;
 
        if (!sctp_vtag_verify(chunk, asoc)) {
                sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
@@ -2334,158 +2341,22 @@ sctp_disposition_t sctp_sf_eat_data_6_2(const struct sctp_endpoint *ep,
                return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
         }
 
-       data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data;
-       skb_pull(chunk->skb, sizeof(sctp_datahdr_t));
-
-       tsn = ntohl(data_hdr->tsn);
-       SCTP_DEBUG_PRINTK("eat_data: TSN 0x%x.\n", tsn);
-
-       /* ASSERT:  Now skb->data is really the user data.  */
-
-       /* Process ECN based congestion.
-        *
-        * Since the chunk structure is reused for all chunks within
-        * a packet, we use ecn_ce_done to track if we've already
-        * done CE processing for this packet.
-        *
-        * We need to do ECN processing even if we plan to discard the
-        * chunk later.
-        */
-
-       if (!chunk->ecn_ce_done) {
-               struct sctp_af *af;
-               chunk->ecn_ce_done = 1;
-
-               af = sctp_get_af_specific(
-                       ipver2af(chunk->skb->nh.iph->version));
-
-               if (af && af->is_ce(chunk->skb) && asoc->peer.ecn_capable) {
-                       /* Do real work as sideffect. */
-                       sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE,
-                                       SCTP_U32(tsn));
-               }
-       }
-
-       tmp = sctp_tsnmap_check(&asoc->peer.tsn_map, tsn);
-       if (tmp < 0) {
-               /* The TSN is too high--silently discard the chunk and
-                * count on it getting retransmitted later.
-                */
+       error = sctp_eat_data(asoc, chunk, commands );
+       switch (error) {
+       case SCTP_IERROR_NO_ERROR:
+               break;
+       case SCTP_IERROR_HIGH_TSN:
+       case SCTP_IERROR_BAD_STREAM:
                goto discard_noforce;
-       } else if (tmp > 0) {
-               /* This is a duplicate.  Record it.  */
-               sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_DUP, SCTP_U32(tsn));
+       case SCTP_IERROR_DUP_TSN:
+       case SCTP_IERROR_IGNORE_TSN:
                goto discard_force;
+       case SCTP_IERROR_NO_DATA:
+               goto consume;
+       default:
+               BUG();
        }
 
-       /* This is a new TSN.  */
-
-       /* Discard if there is no room in the receive window.
-        * Actually, allow a little bit of overflow (up to a MTU).
-        */
-       datalen = ntohs(chunk->chunk_hdr->length);
-       datalen -= sizeof(sctp_data_chunk_t);
-
-       deliver = SCTP_CMD_CHUNK_ULP;
-
-       /* Think about partial delivery. */
-       if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) {
-
-               /* Even if we don't accept this chunk there is
-                * memory pressure.
-                */
-               sctp_add_cmd_sf(commands, SCTP_CMD_PART_DELIVER, SCTP_NULL());
-       }
-
-        /* Spill over rwnd a little bit.  Note: While allowed, this spill over
-        * seems a bit troublesome in that frag_point varies based on
-        * PMTU.  In cases, such as loopback, this might be a rather
-        * large spill over.
-        */
-       if (!asoc->rwnd || asoc->rwnd_over ||
-           (datalen > asoc->rwnd + asoc->frag_point)) {
-
-               /* If this is the next TSN, consider reneging to make
-                * room.   Note: Playing nice with a confused sender.  A
-                * malicious sender can still eat up all our buffer
-                * space and in the future we may want to detect and
-                * do more drastic reneging.
-                */
-               if (sctp_tsnmap_has_gap(&asoc->peer.tsn_map) &&
-                   (sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map) + 1) == tsn) {
-                       SCTP_DEBUG_PRINTK("Reneging for tsn:%u\n", tsn);
-                       deliver = SCTP_CMD_RENEGE;
-               } else {
-                       SCTP_DEBUG_PRINTK("Discard tsn: %u len: %Zd, "
-                                         "rwnd: %d\n", tsn, datalen,
-                                         asoc->rwnd);
-                       goto discard_force;
-               }
-       }
-
-       /*
-        * Section 3.3.10.9 No User Data (9)
-        *
-        * Cause of error
-        * ---------------
-        * No User Data:  This error cause is returned to the originator of a
-        * DATA chunk if a received DATA chunk has no user data.
-        */
-       if (unlikely(0 == datalen)) {
-               err = sctp_make_abort_no_data(asoc, chunk, tsn);
-               if (err) {
-                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
-                                       SCTP_CHUNK(err));
-               }
-               /* We are going to ABORT, so we might as well stop
-                * processing the rest of the chunks in the packet.
-                */
-               sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
-               sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
-                               SCTP_U32(SCTP_ERROR_NO_DATA));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
-               return SCTP_DISPOSITION_CONSUME;
-       }
-
-       /* If definately accepting the DATA chunk, record its TSN, otherwise
-        * wait for renege processing.
-        */
-       if (SCTP_CMD_CHUNK_ULP == deliver)
-               sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
-
-       /* Note: Some chunks may get overcounted (if we drop) or overcounted
-        * if we renege and the chunk arrives again.
-        */
-       if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
-               SCTP_INC_STATS(SctpInUnorderChunks);
-       else
-               SCTP_INC_STATS(SctpInOrderChunks);
-
-       /* RFC 2960 6.5 Stream Identifier and Stream Sequence Number
-        *
-        * If an endpoint receive a DATA chunk with an invalid stream
-        * identifier, it shall acknowledge the reception of the DATA chunk
-        * following the normal procedure, immediately send an ERROR chunk
-        * with cause set to "Invalid Stream Identifier" (See Section 3.3.10)
-        * and discard the DATA chunk.
-        */
-       if (ntohs(data_hdr->stream) >= asoc->c.sinit_max_instreams) {
-               err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
-                                        &data_hdr->stream,
-                                        sizeof(data_hdr->stream));
-               if (err)
-                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
-                                       SCTP_CHUNK(err));
-               goto discard_noforce;
-       }
-
-       /* Send the data up to the user.  Note:  Schedule  the
-        * SCTP_CMD_CHUNK_ULP cmd before the SCTP_CMD_GEN_SACK, as the SACK
-        * chunk needs the updated rwnd.
-        */
-       sctp_add_cmd_sf(commands, deliver, SCTP_CHUNK(chunk));
-
        if (asoc->autoclose) {
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_AUTOCLOSE));
@@ -2551,6 +2422,9 @@ discard_noforce:
                                SCTP_TO(SCTP_EVENT_TIMEOUT_SACK));
        }
        return SCTP_DISPOSITION_DISCARD;
+consume:
+       return SCTP_DISPOSITION_CONSUME;
+       
 }
 
 /*
@@ -2576,11 +2450,7 @@ sctp_disposition_t sctp_sf_eat_data_fast_4_4(const struct sctp_endpoint *ep,
                                     sctp_cmd_seq_t *commands)
 {
        struct sctp_chunk *chunk = arg;
-       sctp_datahdr_t *data_hdr;
-       struct sctp_chunk *err;
-       size_t datalen;
-       int tmp;
-       __u32 tsn;
+       int error;
 
        if (!sctp_vtag_verify(chunk, asoc)) {
                sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG,
@@ -2588,110 +2458,22 @@ sctp_disposition_t sctp_sf_eat_data_fast_4_4(const struct sctp_endpoint *ep,
                return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
        }
 
-       data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *) chunk->skb->data;
-       skb_pull(chunk->skb, sizeof(sctp_datahdr_t));
-
-       tsn = ntohl(data_hdr->tsn);
-
-       SCTP_DEBUG_PRINTK("eat_data: TSN 0x%x.\n", tsn);
-
-       /* ASSERT:  Now skb->data is really the user data.  */
-
-       /* Process ECN based congestion.
-        *
-        * Since the chunk structure is reused for all chunks within
-        * a packet, we use ecn_ce_done to track if we've already
-        * done CE processing for this packet.
-        *
-        * We need to do ECN processing even if we plan to discard the
-        * chunk later.
-        */
-       if (!chunk->ecn_ce_done) {
-               struct sctp_af *af;
-               chunk->ecn_ce_done = 1;
-
-               af = sctp_get_af_specific(
-                       ipver2af(chunk->skb->nh.iph->version));
-
-               if (af && af->is_ce(chunk->skb) && asoc->peer.ecn_capable) {
-                       /* Do real work as sideffect. */
-                       sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE,
-                                       SCTP_U32(tsn));
-               }
-       }
-
-       tmp = sctp_tsnmap_check(&asoc->peer.tsn_map, tsn);
-       if (tmp < 0) {
-               /* The TSN is too high--silently discard the chunk and
-                * count on it getting retransmitted later.
-                */
-               goto gen_shutdown;
-       } else if (tmp > 0) {
-               /* This is a duplicate.  Record it.  */
-               sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_DUP, SCTP_U32(tsn));
-               goto gen_shutdown;
-       }
-
-       /* This is a new TSN.  */
-
-       datalen = ntohs(chunk->chunk_hdr->length);
-       datalen -= sizeof(sctp_data_chunk_t);
-
-       /*
-        * Section 3.3.10.9 No User Data (9)
-        *
-        * Cause of error
-        * ---------------
-        * No User Data:  This error cause is returned to the originator of a
-        * DATA chunk if a received DATA chunk has no user data.
-        */
-       if (unlikely(0 == datalen)) {
-               err = sctp_make_abort_no_data(asoc, chunk, tsn);
-               if (err) {
-                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
-                                       SCTP_CHUNK(err));
-               }
-               /* We are going to ABORT, so we might as well stop
-                * processing the rest of the chunks in the packet.
-                */
-               sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
-               sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
-                               SCTP_U32(SCTP_ERROR_NO_DATA));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
-               return SCTP_DISPOSITION_CONSUME;
-       }
-
-       /* We are accepting this DATA chunk. */
-
-       /* Record the fact that we have received this TSN.  */
-       sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
-
-       if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
-               SCTP_INC_STATS(SctpInUnorderChunks);
-       else
-               SCTP_INC_STATS(SctpInOrderChunks);
-
-       /* RFC 2960 6.5 Stream Identifier and Stream Sequence Number
-        *
-        * If an endpoint receive a DATA chunk with an invalid stream
-        * identifier, it shall acknowledge the reception of the DATA chunk
-        * following the normal procedure, immediately send an ERROR chunk
-        * with cause set to "Invalid Stream Identifier" (See Section 3.3.10)
-        * and discard the DATA chunk.
-        */
-       if (ntohs(data_hdr->stream) >= asoc->c.sinit_max_instreams) {
-               err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
-                                        &data_hdr->stream,
-                                        sizeof(data_hdr->stream));
-               if (err) {
-                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
-                                       SCTP_CHUNK(err));
-               }
+       error = sctp_eat_data(asoc, chunk, commands );
+       switch (error) {
+       case SCTP_IERROR_NO_ERROR:
+       case SCTP_IERROR_HIGH_TSN:
+       case SCTP_IERROR_DUP_TSN:
+       case SCTP_IERROR_IGNORE_TSN:
+       case SCTP_IERROR_BAD_STREAM:
+               break;
+       case SCTP_IERROR_NO_DATA:
+               goto consume;
+       default:
+               BUG();
        }
 
        /* Go a head and force a SACK, since we are shutting down. */
-gen_shutdown:
+
        /* Implementor's Guide.
         *
         * While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately
@@ -2707,6 +2489,8 @@ gen_shutdown:
                sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART,
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
        }
+
+consume:
        return SCTP_DISPOSITION_CONSUME;
 }
 
@@ -2832,7 +2616,7 @@ sctp_disposition_t sctp_sf_tabort_8_4_8(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                SCTP_PACKET(packet));
 
-               SCTP_INC_STATS(SctpOutCtrlChunks);
+               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
 
                return SCTP_DISPOSITION_CONSUME;
        }
@@ -2929,8 +2713,8 @@ sctp_disposition_t sctp_sf_do_9_2_final(const struct sctp_endpoint *ep,
 
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
-       SCTP_INC_STATS(SctpShutdowns);
-       SCTP_DEC_STATS(SctpCurrEstab);
+       SCTP_INC_STATS(SCTP_MIB_SHUTDOWNS);
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
        sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply));
 
        /* ...and remove all record of the association. */
@@ -2971,7 +2755,7 @@ sctp_disposition_t sctp_sf_ootb(const struct sctp_endpoint *ep,
        __u8 *ch_end;
        int ootb_shut_ack = 0;
 
-       SCTP_INC_STATS(SctpOutOfBlues);
+       SCTP_INC_STATS(SCTP_MIB_OUTOFBLUES);
 
        ch = (sctp_chunkhdr_t *) chunk->chunk_hdr;
        do {
@@ -3040,7 +2824,7 @@ sctp_disposition_t sctp_sf_shut_8_4_5(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                SCTP_PACKET(packet));
 
-               SCTP_INC_STATS(SctpOutCtrlChunks);
+               SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
 
                return SCTP_DISPOSITION_CONSUME;
        }
@@ -3176,8 +2960,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_ASCONF_ACK));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_ABORT;
        }
 
@@ -3202,8 +2986,8 @@ sctp_disposition_t sctp_sf_do_asconf_ack(const struct sctp_endpoint *ep,
                sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_ASCONF_ACK));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_ABORT;
        }
 
@@ -3797,8 +3581,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort(
        sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                        SCTP_U32(SCTP_ERROR_USER_ABORT));
 
-       SCTP_INC_STATS(SctpAborteds);
-       SCTP_DEC_STATS(SctpCurrEstab);
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+       SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
 
        return retval;
 }
@@ -3855,7 +3639,7 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_shutdown(
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
 
-       SCTP_INC_STATS(SctpShutdowns);
+       SCTP_INC_STATS(SCTP_MIB_SHUTDOWNS);
 
        sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL());
 
@@ -3928,7 +3712,7 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort(
        sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
                        SCTP_STATE(SCTP_STATE_CLOSED));
 
-       SCTP_INC_STATS(SctpAborteds);
+       SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
 
        /* Even if we can't send the ABORT due to low memory delete the
         * TCB.  This is a departure from our typical NOMEM handling.
@@ -4288,8 +4072,8 @@ sctp_disposition_t sctp_sf_do_6_3_3_rtx(const struct sctp_endpoint *ep,
                /* CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_DELETE_TCB;
        }
 
@@ -4458,8 +4242,8 @@ sctp_disposition_t sctp_sf_t2_timer_expire(const struct sctp_endpoint *ep,
                /* Note:  CMD_ASSOC_FAILED calls CMD_DELETE_TCB. */
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_DEC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_DELETE_TCB;
        }
 
@@ -4532,8 +4316,8 @@ sctp_disposition_t sctp_sf_t4_timer_expire(
                                SCTP_TO(SCTP_EVENT_TIMEOUT_T4_RTO));
                sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
                                SCTP_U32(SCTP_ERROR_NO_ERROR));
-               SCTP_INC_STATS(SctpAborteds);
-               SCTP_INC_STATS(SctpCurrEstab);
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_INC_STATS(SCTP_MIB_CURRESTAB);
                return SCTP_DISPOSITION_ABORT;
        }
 
@@ -4709,7 +4493,7 @@ struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk)
        num_blocks = ntohs(sack->num_gap_ack_blocks);
        num_dup_tsns = ntohs(sack->num_dup_tsns);
        len = sizeof(struct sctp_sackhdr);
-       len = (num_blocks + num_dup_tsns) * sizeof(__u32);
+       len += (num_blocks + num_dup_tsns) * sizeof(__u32);
        if (len > chunk->skb->len)
                return NULL;
 
@@ -4843,8 +4627,176 @@ void sctp_send_stale_cookie_err(const struct sctp_endpoint *ep,
                        sctp_packet_append_chunk(packet, err_chunk);
                        sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
                                        SCTP_PACKET(packet));
-                       SCTP_INC_STATS(SctpOutCtrlChunks);
+                       SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
                } else
                        sctp_chunk_free (err_chunk);
        }
 }
+
+
+/* Process a data chunk */
+int sctp_eat_data(const struct sctp_association *asoc,
+                 struct sctp_chunk *chunk,
+                 sctp_cmd_seq_t *commands)
+{
+       sctp_datahdr_t *data_hdr;
+       struct sctp_chunk *err;
+       size_t datalen;
+       sctp_verb_t deliver;
+       int tmp;
+       __u32 tsn;
+
+       data_hdr = chunk->subh.data_hdr = (sctp_datahdr_t *)chunk->skb->data;
+       skb_pull(chunk->skb, sizeof(sctp_datahdr_t));
+
+       tsn = ntohl(data_hdr->tsn);
+       SCTP_DEBUG_PRINTK("eat_data: TSN 0x%x.\n", tsn);
+
+       /* ASSERT:  Now skb->data is really the user data.  */
+
+       /* Process ECN based congestion.
+        *
+        * Since the chunk structure is reused for all chunks within
+        * a packet, we use ecn_ce_done to track if we've already
+        * done CE processing for this packet.
+        *
+        * We need to do ECN processing even if we plan to discard the
+        * chunk later.
+        */
+
+       if (!chunk->ecn_ce_done) {
+               struct sctp_af *af;
+               chunk->ecn_ce_done = 1;
+
+               af = sctp_get_af_specific(
+                       ipver2af(chunk->skb->nh.iph->version));
+
+               if (af && af->is_ce(chunk->skb) && asoc->peer.ecn_capable) {
+                       /* Do real work as sideffect. */
+                       sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE,
+                                       SCTP_U32(tsn));
+               }
+       }
+
+       tmp = sctp_tsnmap_check(&asoc->peer.tsn_map, tsn);
+       if (tmp < 0) {
+               /* The TSN is too high--silently discard the chunk and
+                * count on it getting retransmitted later.
+                */
+               return SCTP_IERROR_HIGH_TSN;
+       } else if (tmp > 0) {
+               /* This is a duplicate.  Record it.  */
+               sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_DUP, SCTP_U32(tsn));
+               return SCTP_IERROR_DUP_TSN;
+       }
+
+       /* This is a new TSN.  */
+
+       /* Discard if there is no room in the receive window.
+        * Actually, allow a little bit of overflow (up to a MTU).
+        */
+       datalen = ntohs(chunk->chunk_hdr->length);
+       datalen -= sizeof(sctp_data_chunk_t);
+
+       deliver = SCTP_CMD_CHUNK_ULP;
+
+       /* Think about partial delivery. */
+       if ((datalen >= asoc->rwnd) && (!asoc->ulpq.pd_mode)) {
+
+               /* Even if we don't accept this chunk there is
+                * memory pressure.
+                */
+               sctp_add_cmd_sf(commands, SCTP_CMD_PART_DELIVER, SCTP_NULL());
+       }
+
+        /* Spill over rwnd a little bit.  Note: While allowed, this spill over
+        * seems a bit troublesome in that frag_point varies based on
+        * PMTU.  In cases, such as loopback, this might be a rather
+        * large spill over.
+        */
+       if (!asoc->rwnd || asoc->rwnd_over ||
+           (datalen > asoc->rwnd + asoc->frag_point)) {
+
+               /* If this is the next TSN, consider reneging to make
+                * room.   Note: Playing nice with a confused sender.  A
+                * malicious sender can still eat up all our buffer
+                * space and in the future we may want to detect and
+                * do more drastic reneging.
+                */
+               if (sctp_tsnmap_has_gap(&asoc->peer.tsn_map) &&
+                   (sctp_tsnmap_get_ctsn(&asoc->peer.tsn_map) + 1) == tsn) {
+                       SCTP_DEBUG_PRINTK("Reneging for tsn:%u\n", tsn);
+                       deliver = SCTP_CMD_RENEGE;
+               } else {
+                       SCTP_DEBUG_PRINTK("Discard tsn: %u len: %Zd, "
+                                         "rwnd: %d\n", tsn, datalen,
+                                         asoc->rwnd);
+                       return SCTP_IERROR_IGNORE_TSN;
+               }
+       }
+
+       /*
+        * Section 3.3.10.9 No User Data (9)
+        *
+        * Cause of error
+        * ---------------
+        * No User Data:  This error cause is returned to the originator of a
+        * DATA chunk if a received DATA chunk has no user data.
+        */
+       if (unlikely(0 == datalen)) {
+               err = sctp_make_abort_no_data(asoc, chunk, tsn);
+               if (err) {
+                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+                                       SCTP_CHUNK(err));
+               }
+               /* We are going to ABORT, so we might as well stop
+                * processing the rest of the chunks in the packet.
+                */
+               sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET,SCTP_NULL());
+               sctp_add_cmd_sf(commands, SCTP_CMD_ASSOC_FAILED,
+                               SCTP_U32(SCTP_ERROR_NO_DATA));
+               SCTP_INC_STATS(SCTP_MIB_ABORTEDS);
+               SCTP_DEC_STATS(SCTP_MIB_CURRESTAB);
+               return SCTP_IERROR_NO_DATA;
+       }
+
+       /* If definately accepting the DATA chunk, record its TSN, otherwise
+        * wait for renege processing.
+        */
+       if (SCTP_CMD_CHUNK_ULP == deliver)
+               sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_TSN, SCTP_U32(tsn));
+
+       /* Note: Some chunks may get overcounted (if we drop) or overcounted
+        * if we renege and the chunk arrives again.
+        */
+       if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED)
+               SCTP_INC_STATS(SCTP_MIB_INUNORDERCHUNKS);
+       else
+               SCTP_INC_STATS(SCTP_MIB_INORDERCHUNKS);
+
+       /* RFC 2960 6.5 Stream Identifier and Stream Sequence Number
+        *
+        * If an endpoint receive a DATA chunk with an invalid stream
+        * identifier, it shall acknowledge the reception of the DATA chunk
+        * following the normal procedure, immediately send an ERROR chunk
+        * with cause set to "Invalid Stream Identifier" (See Section 3.3.10)
+        * and discard the DATA chunk.
+        */
+       if (ntohs(data_hdr->stream) >= asoc->c.sinit_max_instreams) {
+               err = sctp_make_op_error(asoc, chunk, SCTP_ERROR_INV_STRM,
+                                        &data_hdr->stream,
+                                        sizeof(data_hdr->stream));
+               if (err)
+                       sctp_add_cmd_sf(commands, SCTP_CMD_REPLY,
+                                       SCTP_CHUNK(err));
+               return SCTP_IERROR_BAD_STREAM;
+       }
+
+       /* Send the data up to the user.  Note:  Schedule  the
+        * SCTP_CMD_CHUNK_ULP cmd before the SCTP_CMD_GEN_SACK, as the SACK
+        * chunk needs the updated rwnd.
+        */
+       sctp_add_cmd_sf(commands, deliver, SCTP_CHUNK(chunk));
+
+       return SCTP_IERROR_NO_ERROR;
+}
index 1921e9b..698a2c5 100644 (file)
@@ -1697,6 +1697,32 @@ static int sctp_setsockopt_peer_addr_params(struct sock *sk,
        if (copy_from_user(&params, optval, optlen))
                return -EFAULT;
 
+       /*
+        * API 7. Socket Options (setting the default value for the endpoint)
+        * All options that support specific settings on an association by
+        * filling in either an association id variable or a sockaddr_storage
+        * SHOULD also support setting of the same value for the entire endpoint
+        * (i.e. future associations). To accomplish this the following logic is
+        * used when setting one of these options:
+
+        * c) If neither the sockaddr_storage or association identification is
+        *    set i.e. the sockaddr_storage is set to all 0's (INADDR_ANY) and
+        *    the association identification is 0, the settings are a default
+        *    and to be applied to the endpoint (all future associations).
+        */
+
+       /* update default value for endpoint (all future associations) */
+       if (!params.spp_assoc_id && 
+           sctp_is_any(( union sctp_addr *)&params.spp_address)) {
+               if (params.spp_hbinterval)
+                       sctp_sk(sk)->paddrparam.spp_hbinterval =
+                                               params.spp_hbinterval;
+               if (sctp_max_retrans_path)
+                       sctp_sk(sk)->paddrparam.spp_pathmaxrxt =
+                                               params.spp_pathmaxrxt;
+               return 0;
+       }
+
        trans = sctp_addr_id2transport(sk, &params.spp_address,
                                       params.spp_assoc_id);
        if (!trans)
@@ -2864,6 +2890,17 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
        if (copy_from_user(&params, optval, len))
                return -EFAULT;
 
+       /* If no association id is specified retrieve the default value
+        * for the endpoint that will be used for all future associations
+        */
+       if (!params.spp_assoc_id &&
+           sctp_is_any(( union sctp_addr *)&params.spp_address)) {
+               params.spp_hbinterval = sctp_sk(sk)->paddrparam.spp_hbinterval;
+               params.spp_pathmaxrxt = sctp_sk(sk)->paddrparam.spp_pathmaxrxt;
+
+               goto done;
+       }
+
        trans = sctp_addr_id2transport(sk, &params.spp_address,
                                       params.spp_assoc_id);
        if (!trans)
@@ -2883,6 +2920,7 @@ static int sctp_getsockopt_peer_addr_params(struct sock *sk, int len,
         */
        params.spp_pathmaxrxt = trans->error_threshold;
 
+done:
        if (copy_to_user(optval, &params, len))
                return -EFAULT;
 
index cb99cf2..350a97e 100644 (file)
@@ -334,7 +334,7 @@ static struct sctp_ulpevent *sctp_make_reassembled_event(struct sk_buff *f_frag,
        };
 
        event = sctp_skb2event(f_frag);
-       SCTP_INC_STATS(SctpReasmUsrMsgs);
+       SCTP_INC_STATS(SCTP_MIB_REASMUSRMSGS);
 
        return event;
 }
index 200268d..22be11e 100644 (file)
@@ -68,6 +68,7 @@
 #include <linux/netdevice.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <net/tux.h>
 #include <linux/wanrouter.h>
 #include <linux/if_bridge.h>
 #include <linux/init.h>
@@ -122,7 +123,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
  *     in the operation structures but are done directly via the socketcall() multiplexor.
  */
 
-static struct file_operations socket_file_ops = {
+struct file_operations socket_file_ops = {
        .owner =        THIS_MODULE,
        .llseek =       no_llseek,
        .aio_read =     sock_aio_read,
@@ -364,52 +365,63 @@ static struct dentry_operations sockfs_dentry_operations = {
  *     but we take care of internal coherence yet.
  */
 
-int sock_map_fd(struct socket *sock)
+struct file * sock_map_file(struct socket *sock)
 {
-       int fd;
+       struct file *file;
        struct qstr this;
        char name[32];
 
-       /*
-        *      Find a file descriptor suitable for return to the user. 
-        */
+       file = get_empty_filp();
 
-       fd = get_unused_fd();
-       if (fd >= 0) {
-               struct file *file = get_empty_filp();
+       if (!file)
+               return ERR_PTR(-ENFILE);
 
-               if (!file) {
-                       put_unused_fd(fd);
-                       fd = -ENFILE;
-                       goto out;
-               }
-
-               sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino);
-               this.name = name;
-               this.len = strlen(name);
-               this.hash = SOCK_INODE(sock)->i_ino;
+       sprintf(name, "[%lu]", SOCK_INODE(sock)->i_ino);
+       this.name = name;
+       this.len = strlen(name);
+       this.hash = SOCK_INODE(sock)->i_ino;
 
-               file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this);
-               if (!file->f_dentry) {
-                       put_filp(file);
-                       put_unused_fd(fd);
-                       fd = -ENOMEM;
-                       goto out;
-               }
-               file->f_dentry->d_op = &sockfs_dentry_operations;
-               d_add(file->f_dentry, SOCK_INODE(sock));
-               file->f_vfsmnt = mntget(sock_mnt);
-               file->f_mapping = file->f_dentry->d_inode->i_mapping;
-
-               sock->file = file;
-               file->f_op = SOCK_INODE(sock)->i_fop = &socket_file_ops;
-               file->f_mode = 3;
-               file->f_flags = O_RDWR;
-               file->f_pos = 0;
-               fd_install(fd, file);
+       file->f_dentry = d_alloc(sock_mnt->mnt_sb->s_root, &this);
+       if (!file->f_dentry) {
+               put_filp(file);
+               return ERR_PTR(-ENOMEM);
        }
+       file->f_dentry->d_op = &sockfs_dentry_operations;
+       d_add(file->f_dentry, SOCK_INODE(sock));
+       file->f_vfsmnt = mntget(sock_mnt);
+file->f_mapping = file->f_dentry->d_inode->i_mapping;
+
+       if (sock->file)
+               BUG();
+       sock->file = file;
+       file->f_op = SOCK_INODE(sock)->i_fop = &socket_file_ops;
+       file->f_mode = FMODE_READ | FMODE_WRITE;
+       file->f_flags = O_RDWR;
+       file->f_pos = 0;
+
+       return file;
+}
 
-out:
+int sock_map_fd(struct socket *sock)
+{
+       int fd;
+       struct file *file;
+       /*
+        *      Find a file descriptor suitable for return to the user. 
+        */
+  
+       fd = get_unused_fd();
+       if (fd < 0)
+               return fd;
+  
+       file = sock_map_file(sock);
+       if (IS_ERR(file)) {
+               put_unused_fd(fd);
+               return PTR_ERR(file);
+       }
+       fd_install(fd, file);
+  
        return fd;
 }
 
@@ -574,6 +586,23 @@ int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
        return ret;
 }
 
+int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
+                  struct kvec *vec, size_t num, size_t size)
+{
+       mm_segment_t oldfs = get_fs();
+       int result;
+
+       set_fs(KERNEL_DS);
+       /*
+        * the following is safe, since for compiler definitions of kvec and
+        * iovec are identical, yielding the same in-core layout and alignment
+        */
+       msg->msg_iov = (struct iovec *)vec,
+       msg->msg_iovlen = num;
+       result = sock_sendmsg(sock, msg, size);
+       set_fs(oldfs);
+       return result;
+}
 
 static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock, 
                                 struct msghdr *msg, size_t size, int flags)
@@ -618,6 +647,25 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg,
        return ret;
 }
 
+int kernel_recvmsg(struct socket *sock, struct msghdr *msg, 
+                  struct kvec *vec, size_t num,
+                  size_t size, int flags)
+{
+       mm_segment_t oldfs = get_fs();
+       int result;
+
+       set_fs(KERNEL_DS);
+       /*
+        * the following is safe, since for compiler definitions of kvec and
+        * iovec are identical, yielding the same in-core layout and alignment
+        */
+       msg->msg_iov = (struct iovec *)vec,
+       msg->msg_iovlen = num;
+       result = sock_recvmsg(sock, msg, size, flags);
+       set_fs(oldfs);
+       return result;
+}
+
 static void sock_aio_dtor(struct kiocb *iocb)
 {
        kfree(iocb->private);
@@ -715,9 +763,6 @@ ssize_t sock_sendpage(struct file *file, struct page *page,
        struct socket *sock;
        int flags;
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        sock = SOCKET_I(file->f_dentry->d_inode);
 
        flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
@@ -1031,6 +1076,8 @@ static int sock_fasync(int fd, struct file *filp, int on)
        }
 
 out:
+       if (sock->sk != sk)
+               BUG();
        release_sock(sock->sk);
        return 0;
 }
@@ -2067,6 +2114,51 @@ void __init sock_init(void)
 #endif
 }
 
+int tux_Dprintk;
+int tux_TDprintk;
+
+#ifdef CONFIG_TUX_MODULE
+
+asmlinkage long (*sys_tux_ptr) (unsigned int action, user_req_t *u_info) = NULL;
+
+struct module *tux_module = NULL;
+spinlock_t tux_module_lock = SPIN_LOCK_UNLOCKED;
+
+asmlinkage long sys_tux (unsigned int action, user_req_t *u_info)
+{
+       int ret;
+
+       if (current->tux_info)
+               return sys_tux_ptr(action, u_info);
+
+       ret = -ENOSYS;
+       spin_lock(&tux_module_lock);
+       if (!tux_module)
+               goto out_unlock;
+       if (!try_module_get(tux_module))
+               goto out_unlock;
+       spin_unlock(&tux_module_lock);
+
+       if (!sys_tux_ptr)
+               TUX_BUG();
+       ret = sys_tux_ptr(action, u_info);
+
+       spin_lock(&tux_module_lock);
+       module_put(tux_module);
+out_unlock:
+       spin_unlock(&tux_module_lock);
+
+       return ret;
+}
+
+EXPORT_SYMBOL_GPL(tux_module);
+EXPORT_SYMBOL_GPL(tux_module_lock);
+EXPORT_SYMBOL_GPL(sys_tux_ptr);
+
+EXPORT_SYMBOL_GPL(tux_Dprintk);
+EXPORT_SYMBOL_GPL(tux_TDprintk);
+
+#endif
 #ifdef CONFIG_PROC_FS
 void socket_seq_show(struct seq_file *seq)
 {
@@ -2100,3 +2192,5 @@ EXPORT_SYMBOL(sock_sendmsg);
 EXPORT_SYMBOL(sock_unregister);
 EXPORT_SYMBOL(sock_wake_async);
 EXPORT_SYMBOL(sockfd_lookup);
+EXPORT_SYMBOL(kernel_sendmsg);
+EXPORT_SYMBOL(kernel_recvmsg);
index 60bca99..e32f2a7 100644 (file)
@@ -417,7 +417,7 @@ out_sleep:
 
 static ssize_t
 gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
-               char *dst, size_t buflen)
+               char __user *dst, size_t buflen)
 {
        char *data = (char *)msg->data + msg->copied;
        ssize_t mlen = msg->len;
@@ -439,7 +439,7 @@ gss_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
 #define MSG_BUF_MAXSIZE 1024
 
 static ssize_t
-gss_pipe_downcall(struct file *filp, const char *src, size_t mlen)
+gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
 {
        struct xdr_netobj obj = {
                .len    = mlen,
@@ -697,7 +697,7 @@ gss_marshal(struct rpc_task *task, u32 *p, int ruid)
        struct rpc_rqst *req = task->tk_rqstp;
        u32             maj_stat = 0;
        struct xdr_netobj mic;
-       struct iovec    iov;
+       struct kvec     iov;
        struct xdr_buf  verf_buf;
        u32             service;
 
@@ -774,7 +774,7 @@ gss_validate(struct rpc_task *task, u32 *p)
                                                gc_base);
        struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
        u32             seq, qop_state;
-       struct iovec    iov;
+       struct kvec     iov;
        struct xdr_buf  verf_buf;
        struct xdr_netobj mic;
        u32             flav,len;
@@ -830,7 +830,7 @@ gss_wrap_req_integ(struct gss_cl_ctx *ctx,
        u32             *integ_len = NULL;
        struct xdr_netobj mic;
        u32             offset, *q;
-       struct iovec    *iov;
+       struct kvec     *iov;
        u32             maj_stat = 0;
        int             status = -EIO;
 
index 8cb95ca..5822ab2 100644 (file)
@@ -503,7 +503,7 @@ static inline u32 round_up_to_quad(u32 i)
 }
 
 static inline int
-svc_safe_getnetobj(struct iovec *argv, struct xdr_netobj *o)
+svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o)
 {
        int l;
 
@@ -520,7 +520,7 @@ svc_safe_getnetobj(struct iovec *argv, struct xdr_netobj *o)
 }
 
 static inline int
-svc_safe_putnetobj(struct iovec *resv, struct xdr_netobj *o)
+svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o)
 {
        u32 *p;
 
@@ -548,8 +548,8 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci,
        struct xdr_buf          rpchdr;
        struct xdr_netobj       checksum;
        u32                     flavor = 0;
-       struct iovec            *argv = &rqstp->rq_arg.head[0];
-       struct iovec            iov;
+       struct kvec             *argv = &rqstp->rq_arg.head[0];
+       struct kvec             iov;
 
        /* data to compute the checksum over: */
        iov.iov_base = rpcstart;
@@ -595,7 +595,7 @@ gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq)
        struct xdr_buf          verf_data;
        struct xdr_netobj       mic;
        u32                     *p;
-       struct iovec            iov;
+       struct kvec             iov;
 
        svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_GSS));
        xdr_seq = htonl(seq);
@@ -743,8 +743,8 @@ struct gss_svc_data {
 static int
 svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp)
 {
-       struct iovec    *argv = &rqstp->rq_arg.head[0];
-       struct iovec    *resv = &rqstp->rq_res.head[0];
+       struct kvec     *argv = &rqstp->rq_arg.head[0];
+       struct kvec     *resv = &rqstp->rq_res.head[0];
        u32             crlen;
        struct xdr_netobj tmpobj;
        struct gss_svc_data *svcdata = rqstp->rq_auth_data;
@@ -952,7 +952,7 @@ svcauth_gss_release(struct svc_rqst *rqstp)
        struct xdr_buf *resbuf = &rqstp->rq_res;
        struct xdr_buf integ_buf;
        struct xdr_netobj mic;
-       struct iovec *resv;
+       struct kvec *resv;
        u32 *p;
        int integ_offset, integ_len;
        int stat = -EINVAL;
index e84acd0..bb54be8 100644 (file)
@@ -582,9 +582,6 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
        struct cache_detail *cd = PDE(filp->f_dentry->d_inode)->data;
        int err;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (count == 0)
                return 0;
 
@@ -662,9 +659,6 @@ cache_write(struct file *filp, const char __user *buf, size_t count,
        int err;
        struct cache_detail *cd = PDE(filp->f_dentry->d_inode)->data;
 
-       if (ppos != &filp->f_pos)
-               return -ESPIPE;
-
        if (count == 0)
                return 0;
        if (count >= sizeof(write_buf))
@@ -751,6 +745,7 @@ cache_open(struct inode *inode, struct file *filp)
 {
        struct cache_reader *rp = NULL;
 
+       nonseekable_open(inode, filp);
        if (filp->f_mode & FMODE_READ) {
                struct cache_detail *cd = PDE(inode)->data;
 
@@ -1212,6 +1207,7 @@ static ssize_t write_flush(struct file * file, const char __user * buf,
 }
 
 static struct file_operations cache_flush_operations = {
+       .open           = nonseekable_open,
        .read           = read_flush,
        .write          = write_flush,
 };
index ad353ae..d2d8e9b 100644 (file)
@@ -450,9 +450,8 @@ svc_recv_available(struct svc_sock *svsk)
  * Generic recvfrom routine.
  */
 static int
-svc_recvfrom(struct svc_rqst *rqstp, struct iovec *iov, int nr, int buflen)
+svc_recvfrom(struct svc_rqst *rqstp, struct kvec *iov, int nr, int buflen)
 {
-       mm_segment_t    oldfs;
        struct msghdr   msg;
        struct socket   *sock;
        int             len, alen;
@@ -462,16 +461,12 @@ svc_recvfrom(struct svc_rqst *rqstp, struct iovec *iov, int nr, int buflen)
 
        msg.msg_name    = &rqstp->rq_addr;
        msg.msg_namelen = sizeof(rqstp->rq_addr);
-       msg.msg_iov     = iov;
-       msg.msg_iovlen  = nr;
        msg.msg_control = NULL;
        msg.msg_controllen = 0;
 
        msg.msg_flags   = MSG_DONTWAIT;
 
-       oldfs = get_fs(); set_fs(KERNEL_DS);
-       len = sock_recvmsg(sock, &msg, buflen, MSG_DONTWAIT);
-       set_fs(oldfs);
+       len = kernel_recvmsg(sock, &msg, iov, nr, buflen, MSG_DONTWAIT);
 
        /* sock_recvmsg doesn't fill in the name/namelen, so we must..
         * possibly we should cache this in the svc_sock structure
@@ -898,7 +893,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
        struct svc_sock *svsk = rqstp->rq_sock;
        struct svc_serv *serv = svsk->sk_server;
        int             len;
-       struct iovec vec[RPCSVC_MAXPAGES];
+       struct kvec vec[RPCSVC_MAXPAGES];
        int pnum, vlen;
 
        dprintk("svc: tcp_recv %p data %d conn %d close %d\n",
@@ -942,7 +937,7 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
         */
        if (svsk->sk_tcplen < 4) {
                unsigned long   want = 4 - svsk->sk_tcplen;
-               struct iovec    iov;
+               struct kvec     iov;
 
                iov.iov_base = ((char *) &svsk->sk_reclen) + svsk->sk_tcplen;
                iov.iov_len  = want;
@@ -1056,8 +1051,8 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
        int sent;
        u32 reclen;
 
-       /* Set up the first element of the reply iovec.
-        * Any other iovecs that may be in use have been taken
+       /* Set up the first element of the reply kvec.
+        * Any other kvecs that may be in use have been taken
         * care of by the server implementation itself.
         */
        reclen = htonl(0x80000000|((xbufp->len ) - 4));
index e69a7fb..1b9616a 100644 (file)
@@ -58,14 +58,14 @@ rpc_unregister_sysctl(void)
 
 static int
 proc_dodebug(ctl_table *table, int write, struct file *file,
-                               void __user *buffer, size_t *lenp)
+                               void __user *buffer, size_t *lenp, loff_t *ppos)
 {
        char            tmpbuf[20], c, *s;
        char __user *p;
        unsigned int    value;
        size_t          left, len;
 
-       if ((file->f_pos && !write) || !*lenp) {
+       if ((*ppos && !write) || !*lenp) {
                *lenp = 0;
                return 0;
        }
@@ -115,7 +115,7 @@ proc_dodebug(ctl_table *table, int write, struct file *file,
 
 done:
        *lenp -= left;
-       file->f_pos += *lenp;
+       *ppos += *lenp;
        return 0;
 }
 
index 5fbbe60..a7ab07f 100644 (file)
@@ -1296,21 +1296,6 @@ xprt_transmit(struct rpc_task *task)
 /*
  * Reserve an RPC call slot.
  */
-void
-xprt_reserve(struct rpc_task *task)
-{
-       struct rpc_xprt *xprt = task->tk_xprt;
-
-       task->tk_status = -EIO;
-       if (!xprt->shutdown) {
-               spin_lock(&xprt->xprt_lock);
-               do_xprt_reserve(task);
-               spin_unlock(&xprt->xprt_lock);
-               if (task->tk_rqstp)
-                       del_timer_sync(&xprt->timer);
-       }
-}
-
 static inline void
 do_xprt_reserve(struct rpc_task *task)
 {
@@ -1332,6 +1317,21 @@ do_xprt_reserve(struct rpc_task *task)
        rpc_sleep_on(&xprt->backlog, task, NULL, NULL);
 }
 
+void
+xprt_reserve(struct rpc_task *task)
+{
+       struct rpc_xprt *xprt = task->tk_xprt;
+
+       task->tk_status = -EIO;
+       if (!xprt->shutdown) {
+               spin_lock(&xprt->xprt_lock);
+               do_xprt_reserve(task);
+               spin_unlock(&xprt->xprt_lock);
+               if (task->tk_rqstp)
+                       del_timer_sync(&xprt->timer);
+       }
+}
+
 /*
  * Allocate a 'unique' XID
  */
diff --git a/net/tux/Kconfig b/net/tux/Kconfig
new file mode 100644 (file)
index 0000000..8b6d624
--- /dev/null
@@ -0,0 +1,25 @@
+
+config TUX
+       tristate "TUX: Threaded linUX application protocol accelerator layer"
+       default y if INET=y
+       select ZLIB_DEFLATE
+       help
+         This is the TUX content-accelerator/server
+
+menu "TUX options"
+       depends on TUX
+
+config TUX_EXTCGI
+       bool "External CGI module"
+       default y
+
+config TUX_EXTENDED_LOG
+       bool "extended TUX logging format"
+       default n
+
+config TUX_DEBUG
+       bool "debug TUX"
+       default n
+
+endmenu
+
diff --git a/net/tux/Makefile b/net/tux/Makefile
new file mode 100644 (file)
index 0000000..fc0bbd0
--- /dev/null
@@ -0,0 +1,12 @@
+#
+# Makefile for TUX
+#
+
+obj-$(CONFIG_TUX) += tux.o
+
+tux-y := accept.o input.o userspace.o cachemiss.o output.o \
+       redirect.o postpone.o logger.o proto_http.o proto_ftp.o \
+       proc.o main.o mod.o abuf.o times.o directory.o gzip.o
+
+tux-$(subst m,y,$(CONFIG_TUX_EXTCGI)) += cgi.o extcgi.o
+
diff --git a/net/tux/abuf.c b/net/tux/abuf.c
new file mode 100644 (file)
index 0000000..7447e69
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * abuf.c: async buffer-sending
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+char * get_abuf (tux_req_t *req, unsigned int max_size)
+{
+       threadinfo_t *ti = req->ti;
+       struct page *page;
+       char *buf;
+       unsigned int offset;
+       unsigned int left;
+
+       if (req->abuf.page || req->abuf.buf || req->abuf.size)
+               TUX_BUG();
+
+       if (max_size > PAGE_SIZE)
+               BUG();
+       offset = ti->header_offset;
+       if (offset > PAGE_SIZE)
+               TUX_BUG();
+       left = PAGE_SIZE - offset;
+       if (!max_size)
+               BUG();
+       page = ti->header_cache;
+       if ((left < max_size) || !page) {
+               while (!(page = alloc_pages(GFP_KERNEL, 0))) {
+                       if (net_ratelimit())
+                               printk(KERN_WARNING "tux: OOM in get_abuf()!\n");
+                       current->state = TASK_UNINTERRUPTIBLE;
+                       schedule_timeout(1);
+               }
+
+               if (ti->header_cache)
+                       __free_page(ti->header_cache);
+               ti->header_cache = page;
+               ti->header_offset = 0;
+               offset = 0;
+       }
+       buf = page_address(page) + offset;
+
+       if (!page)
+               BUG();
+       req->abuf.page = page;
+       req->abuf.buf = buf;
+       req->abuf.size = 0;
+       req->abuf.offset = offset;
+       req->abuf.flags = 0;
+       get_page(req->abuf.page);
+
+       return buf;
+}
+
+static void do_send_abuf (tux_req_t *req, int cachemiss);
+
+void send_abuf (tux_req_t *req, unsigned int size, unsigned long flags)
+{
+       threadinfo_t *ti = req->ti;
+
+       Dprintk("send_abuf(req: %p, sock: %p): %p(%p), size:%d, off:%d, flags:%08lx\n", req, req->sock, req->abuf.page, req->abuf.buf, size, req->abuf.offset, flags);
+
+       ti->header_offset += size;
+       if (ti->header_offset > PAGE_SIZE)
+               TUX_BUG();
+       if (req->abuf.offset + req->abuf.size > PAGE_SIZE)
+               TUX_BUG();
+
+       req->abuf.flags = flags | MSG_NOSIGNAL;
+       req->abuf.size = size;
+
+       add_tux_atom(req, do_send_abuf);
+}
+
+static void do_send_abuf (tux_req_t *req, int cachemiss)
+{
+       int ret;
+
+       if (req->magic != TUX_MAGIC)
+               TUX_BUG();
+       if (!req->sock)
+               TUX_BUG();
+       tcp_sk(req->sock->sk)->nonagle = 2;
+
+repeat:
+       Dprintk("do_send_abuf(%p,%d): %p(%p), size:%d, off:%d, flags:%08lx\n",
+                       req, cachemiss,
+                       req->abuf.page, req->abuf.buf, req->abuf.size,
+                       req->abuf.offset, req->abuf.flags);
+
+       if (tux_zerocopy_header)
+               ret = tcp_sendpage(req->sock, req->abuf.page,
+                       req->abuf.offset, req->abuf.size, req->abuf.flags);
+       else {
+               mm_segment_t oldmm;
+               oldmm = get_fs(); set_fs(KERNEL_DS);
+               ret = send_sync_buf(req, req->sock, req->abuf.buf,
+                       req->abuf.size, req->abuf.flags);
+               set_fs(oldmm);
+       }
+
+
+       Dprintk("do_send_abuf: ret: %d\n", ret);
+       if (!ret)
+               TUX_BUG();
+
+       if (ret < 0) {
+               if (ret != -EAGAIN) {
+                       TDprintk("ret: %d, req->error = TUX_ERROR_CONN_CLOSE.\n", ret);
+                       req->error = TUX_ERROR_CONN_CLOSE;
+                       req->atom_idx = 0;
+                       req->in_file.f_pos = 0;
+                       __free_page(req->abuf.page);
+                       memset(&req->abuf, 0, sizeof(req->abuf));
+                       zap_request(req, cachemiss);
+                       return;
+               }
+               add_tux_atom(req, do_send_abuf);
+               if (add_output_space_event(req, req->sock)) {
+                       del_tux_atom(req);
+                       goto repeat;
+               }
+               return;
+       }
+
+       req->abuf.buf += ret;
+       req->abuf.offset += ret;
+       req->abuf.size -= ret;
+
+       if ((int)req->abuf.size < 0)
+               TUX_BUG();
+       if (req->abuf.size > 0)
+               goto repeat;
+
+       Dprintk("DONE do_send_abuf: %p(%p), size:%d, off:%d, flags:%08lx\n",
+                       req->abuf.page, req->abuf.buf, req->abuf.size,
+                       req->abuf.offset, req->abuf.flags);
+
+       __free_page(req->abuf.page);
+
+       memset(&req->abuf, 0, sizeof(req->abuf));
+
+       add_req_to_workqueue(req);
+}
+
+void __send_async_message (tux_req_t *req, const char *message,
+                               int status, unsigned int size, int push)
+{
+       unsigned int flags;
+       char *buf;
+
+       Dprintk("TUX: sending %d reply (%d bytes)!\n", status, size);
+       Dprintk("request %p, reply: %s\n", req, message);
+       if (!size)
+               TUX_BUG();
+       buf = get_abuf(req, size);
+       memcpy(buf, message, size);
+
+       req->status = status;
+       flags = MSG_DONTWAIT;
+       if (!push)
+               flags |= MSG_MORE;
+       send_abuf(req, size, flags);
+       add_req_to_workqueue(req);
+}
diff --git a/net/tux/accept.c b/net/tux/accept.c
new file mode 100644 (file)
index 0000000..4e6fcc0
--- /dev/null
@@ -0,0 +1,859 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * accept.c: accept new connections, allocate requests
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+unsigned int tux_ack_pingpong = 1;
+unsigned int tux_push_all = 0;
+unsigned int tux_zerocopy_parse = 1;
+
+static int __idle_event (tux_req_t *req);
+static int __output_space_event (tux_req_t *req);
+
+struct socket * start_listening(tux_socket_t *listen, int nr)
+{
+       struct sockaddr_in sin;
+       struct socket *sock = NULL;
+       struct sock *sk;
+       struct tcp_opt *tp;
+       int err;
+       u16 port = listen->port;
+       u32 addr = listen->ip;
+       tux_proto_t *proto = listen->proto;
+
+       /* Create a listening socket: */
+
+       err = sock_create(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
+       if (err) {
+               printk(KERN_ERR "TUX: error %d creating socket.\n", err);
+               goto error;
+       }
+
+       /* Bind the socket: */
+
+       sin.sin_family = AF_INET;
+       sin.sin_addr.s_addr = htonl(addr);
+       sin.sin_port = htons(port);
+
+       sk = sock->sk;
+       sk->sk_reuse = 1;
+       sock_set_flag(sk, SOCK_URGINLINE);
+
+       err = sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
+       if (err) {
+               printk(KERN_ERR "TUX: error %d binding socket. This means that probably some other process is (or was a short time ago) using addr %s://%d.%d.%d.%d:%d.\n", 
+                       err, proto->name, HIPQUAD(addr), port);
+               goto error;
+       }
+
+       tp = tcp_sk(sk);
+       Dprintk("listen sk accept_queue: %p/%p.\n",
+               tp->accept_queue, tp->accept_queue_tail);
+       tp->ack.pingpong = tux_ack_pingpong;
+
+       sock_reset_flag(sk, SOCK_LINGER);
+       sk->sk_lingertime = 0;
+       tp->linger2 = tux_keepalive_timeout * HZ;
+
+       if (proto->defer_accept && !tux_keepalive_timeout && tux_defer_accept)
+               tp->defer_accept = 1;
+
+       /* Now, start listening on the socket */
+
+       err = sock->ops->listen(sock, tux_max_backlog);
+       if (err) {
+               printk(KERN_ERR "TUX: error %d listening on socket.\n", err);
+               goto error;
+       }
+
+       printk(KERN_NOTICE "TUX: thread %d listens on %s://%d.%d.%d.%d:%d.\n",
+               nr, proto->name, HIPQUAD(addr), port);
+       return sock;
+
+error:
+       if (sock)
+               sock_release(sock);
+       return NULL;
+}
+
+static inline void __kfree_req (tux_req_t *req, threadinfo_t * ti)
+{
+       list_del(&req->all);
+       DEBUG_DEL_LIST(&req->all);
+       ti->nr_requests--;
+       kfree(req);
+}
+
+int flush_freequeue (threadinfo_t * ti)
+{
+       struct list_head *tmp;
+       unsigned long flags;
+       tux_req_t *req;
+       int count = 0;
+
+       spin_lock_irqsave(&ti->free_requests_lock,flags);
+       while (ti->nr_free_requests) {
+               ti->nr_free_requests--;
+               tmp = ti->free_requests.next;
+               req = list_entry(tmp, tux_req_t, free);
+               list_del(tmp);
+               DEBUG_DEL_LIST(tmp);
+               DEC_STAT(nr_free_pending);
+               __kfree_req(req, ti);
+               count++;
+       }
+       spin_unlock_irqrestore(&ti->free_requests_lock,flags);
+
+       return count;
+}
+
+static tux_req_t * kmalloc_req (threadinfo_t * ti)
+{
+       struct list_head *tmp;
+       unsigned long flags;
+       tux_req_t *req;
+
+       spin_lock_irqsave(&ti->free_requests_lock, flags);
+       if (ti->nr_free_requests) {
+               ti->nr_free_requests--;
+               tmp = ti->free_requests.next;
+               req = list_entry(tmp, tux_req_t, free);
+               list_del(tmp);
+               DEBUG_DEL_LIST(tmp);
+               DEC_STAT(nr_free_pending);
+               req->magic = TUX_MAGIC;
+               spin_unlock_irqrestore(&ti->free_requests_lock, flags);
+       } else {
+               spin_unlock_irqrestore(&ti->free_requests_lock, flags);
+               req = tux_kmalloc(sizeof(*req));
+               ti->nr_requests++;
+               memset (req, 0, sizeof(*req));
+               list_add(&req->all, &ti->all_requests);
+       }
+       req->magic = TUX_MAGIC;
+       INC_STAT(nr_allocated);
+       init_waitqueue_entry(&req->sleep, current);
+       init_waitqueue_entry(&req->ftp_sleep, current);
+       INIT_LIST_HEAD(&req->work);
+       INIT_LIST_HEAD(&req->free);
+       INIT_LIST_HEAD(&req->lru);
+       req->ti = ti;
+       req->total_bytes = 0;
+       SET_TIMESTAMP(req->accept_timestamp);
+       req->first_timestamp = jiffies;
+       req->fd = -1;
+       init_timer(&req->keepalive_timer);
+       init_timer(&req->output_timer);
+
+       Dprintk("allocated NEW req %p.\n", req);
+       return req;
+}
+
+void kfree_req (tux_req_t *req)
+{
+       threadinfo_t * ti = req->ti;
+       unsigned long flags;
+
+       Dprintk("freeing req %p.\n", req);
+
+       if (req->magic != TUX_MAGIC)
+               TUX_BUG();
+       spin_lock_irqsave(&ti->free_requests_lock,flags);
+       req->magic = 0;
+       DEC_STAT(nr_allocated);
+       if (req->sock || req->dentry || req->private)
+               TUX_BUG();
+       if (ti->nr_free_requests > tux_max_free_requests)
+               __kfree_req(req, ti);
+       else {
+               req->error = 0;
+               ti->nr_free_requests++;
+
+               // the free requests queue is LIFO
+               list_add(&req->free, &ti->free_requests);
+               INC_STAT(nr_free_pending);
+       }
+       spin_unlock_irqrestore(&ti->free_requests_lock,flags);
+}
+
+static void __add_req_to_workqueue (tux_req_t *req)
+{
+       threadinfo_t *ti = req->ti;
+
+       if (!list_empty(&req->work))
+               TUX_BUG();
+       Dprintk("work-queueing request %p at %p/%p.\n", req, __builtin_return_address(0), __builtin_return_address(1));
+       if (connection_too_fast(req))
+               list_add_tail(&req->work, &ti->work_pending);
+       else
+               list_add(&req->work, &ti->work_pending);
+       INC_STAT(nr_work_pending);
+       wake_up_process(ti->thread);
+       return;
+}
+
+void add_req_to_workqueue (tux_req_t *req)
+{
+       unsigned long flags;
+       threadinfo_t *ti = req->ti;
+
+       spin_lock_irqsave(&ti->work_lock, flags);
+       __add_req_to_workqueue(req);
+       spin_unlock_irqrestore(&ti->work_lock, flags);
+}
+
+void del_output_timer (tux_req_t *req)
+{
+#if CONFIG_SMP
+       if (!spin_is_locked(&req->ti->work_lock))
+               TUX_BUG();
+#endif
+       if (!list_empty(&req->lru)) {
+               list_del(&req->lru);
+               DEBUG_DEL_LIST(&req->lru);
+               req->ti->nr_lru--;
+       }
+       Dprintk("del output timeout for req %p.\n", req);
+       del_timer(&req->output_timer);
+}
+
+static void output_timeout_fn (unsigned long data);
+
+#define OUTPUT_TIMEOUT HZ
+
+static void add_output_timer (tux_req_t *req)
+{
+       struct timer_list *timer = &req->output_timer;
+
+       timer->data = (unsigned long) req;
+       timer->function = &output_timeout_fn;
+       mod_timer(timer, jiffies + OUTPUT_TIMEOUT);
+}
+
+static void output_timeout_fn (unsigned long data)
+{
+       tux_req_t *req = (tux_req_t *)data;
+
+       if (connection_too_fast(req)) {
+               add_output_timer(req);
+//             mod_timer(&req->output_timer, jiffies + OUTPUT_TIMEOUT);
+               return;
+       }
+       output_space_event(req);
+}
+
+void output_timeout (tux_req_t *req)
+{
+       Dprintk("output timeout for req %p.\n", req);
+       if (test_and_set_bit(0, &req->wait_output_space))
+               TUX_BUG();
+       INC_STAT(nr_output_space_pending);
+       add_output_timer(req);
+}
+
+void __del_keepalive_timer (tux_req_t *req)
+{
+#if CONFIG_SMP
+       if (!spin_is_locked(&req->ti->work_lock))
+               TUX_BUG();
+#endif
+       if (!list_empty(&req->lru)) {
+               list_del(&req->lru);
+               DEBUG_DEL_LIST(&req->lru);
+               req->ti->nr_lru--;
+       }
+       Dprintk("del keepalive timeout for req %p.\n", req);
+       del_timer(&req->keepalive_timer);
+}
+
+static void keepalive_timeout_fn (unsigned long data)
+{
+       tux_req_t *req = (tux_req_t *)data;
+
+#if CONFIG_TUX_DEBUG
+       Dprintk("req %p timed out after %d sec!\n", req, tux_keepalive_timeout);
+       if (tux_Dprintk)
+               print_req(req);
+#endif
+       Dprintk("req->error = TUX_ERROR_CONN_TIMEOUT!\n");
+       req->error = TUX_ERROR_CONN_TIMEOUT;
+       if (!idle_event(req))
+               output_space_event(req);
+}
+
+void __add_keepalive_timer (tux_req_t *req)
+{
+       struct timer_list *timer = &req->keepalive_timer;
+
+       if (!tux_keepalive_timeout)
+               TUX_BUG();
+#if CONFIG_SMP
+       if (!spin_is_locked(&req->ti->work_lock))
+               TUX_BUG();
+#endif
+
+       if (!list_empty(&req->lru))
+               TUX_BUG();
+       if (req->ti->nr_lru > tux_max_keepalives) {
+               struct list_head *head, *last;
+               tux_req_t *last_req;
+
+               head = &req->ti->lru;
+               last = head->prev;
+               if (last == head)
+                       TUX_BUG();
+               last_req = list_entry(last, tux_req_t, lru);
+               list_del(last);
+               DEBUG_DEL_LIST(last);
+               req->ti->nr_lru--;
+
+               Dprintk("LRU-aging req %p!\n", last_req);
+               last_req->error = TUX_ERROR_CONN_TIMEOUT;
+               if (!__idle_event(last_req))
+                       __output_space_event(last_req);
+       }
+       list_add(&req->lru, &req->ti->lru);
+       req->ti->nr_lru++;
+
+       timer->expires = jiffies + tux_keepalive_timeout * HZ;
+       timer->data = (unsigned long) req;
+       timer->function = &keepalive_timeout_fn;
+       add_timer(timer);
+}
+
+static int __output_space_event (tux_req_t *req)
+{
+       if (!req || (req->magic != TUX_MAGIC))
+               TUX_BUG();
+
+       if (!test_and_clear_bit(0, &req->wait_output_space)) {
+               Dprintk("output space ready event at <%p>, on non-idle %p.\n", __builtin_return_address(0), req);
+               return 0;
+       }
+
+       Dprintk("output space ready event at <%p>, %p was waiting!\n", __builtin_return_address(0), req);
+       DEC_STAT(nr_output_space_pending);
+
+       del_keepalive_timer(req);
+       del_output_timer(req);
+
+       __add_req_to_workqueue(req);
+       return 1;
+}
+
+int output_space_event (tux_req_t *req)
+{
+       int ret;
+       unsigned long flags;
+
+       spin_lock_irqsave(&req->ti->work_lock, flags);
+       ret = __output_space_event(req);
+       spin_unlock_irqrestore(&req->ti->work_lock, flags);
+
+       return ret;
+}
+
+static int __idle_event (tux_req_t *req)
+{
+       struct tcp_opt *tp;
+       threadinfo_t *ti;
+
+       if (!req || (req->magic != TUX_MAGIC))
+               TUX_BUG();
+       ti = req->ti;
+
+       if (!test_and_clear_bit(0, &req->idle_input)) {
+               Dprintk("data ready event at <%p>, on non-idle %p.\n", __builtin_return_address(0), req);
+               return 0;
+       }
+
+       Dprintk("data ready event at <%p>, %p was idle!\n", __builtin_return_address(0), req);
+       del_keepalive_timer(req);
+       del_output_timer(req);
+       DEC_STAT(nr_idle_input_pending);
+
+       tp = tcp_sk(req->sock->sk);
+
+       tp->ack.pingpong = tux_ack_pingpong;
+       SET_TIMESTAMP(req->accept_timestamp);
+
+       __add_req_to_workqueue(req);
+
+       return 1;
+}
+
+int idle_event (tux_req_t *req)
+{
+       int ret;
+       unsigned long flags;
+
+       spin_lock_irqsave(&req->ti->work_lock, flags);
+       ret = __idle_event(req);
+       spin_unlock_irqrestore(&req->ti->work_lock, flags);
+
+       return ret;
+}
+
+#define HANDLE_CALLBACK_1(callback, tux_name, real_name, param...)     \
+       tux_req_t *req;                                 \
+                                                       \
+       read_lock(&sk->sk_callback_lock);               \
+       req = sk->sk_user_data;                         \
+                                                       \
+       Dprintk("callback "#callback"(%p) req %p.\n",   \
+               sk->sk_##callback, req);                \
+                                                       \
+       if (!req) {                                     \
+               if (sk->sk_##callback == tux_name) {    \
+                       printk("BUG: "#callback" "#tux_name" "#real_name" no req!"); \
+                       TUX_BUG();                      \
+               }                                       \
+               read_unlock(&sk->sk_callback_lock);     \
+               if (sk->sk_##callback)                  \
+                       sk->sk_##callback(param);       \
+               return;                                 \
+       }                                               \
+
+#define HANDLE_CALLBACK_2(callback, tux_name, real_name, param...)     \
+       Dprintk(#tux_name"() on %p.\n", req);           \
+       if (req->magic != TUX_MAGIC)                    \
+               TUX_BUG();                              \
+       if (req->real_name)                             \
+               req->real_name(param);
+
+#define HANDLE_CALLBACK(callback, tux_name, real_name, param...)       \
+       HANDLE_CALLBACK_1(callback,tux_name,real_name,param)    \
+       HANDLE_CALLBACK_2(callback,tux_name,real_name,param)
+
+static void tux_data_ready (struct sock *sk, int len)
+{
+       HANDLE_CALLBACK_1(data_ready, tux_data_ready, real_data_ready, sk, len);
+
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_write_space (struct sock *sk)
+{
+       HANDLE_CALLBACK(write_space, tux_write_space, real_write_space, sk);
+
+       Dprintk("sk->sk_wmem_queued: %d, sk->sk_sndbuf: %d.\n",
+               sk->sk_wmem_queued, sk->sk_sndbuf);
+
+       if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
+               clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
+               if (!idle_event(req))
+                       output_space_event(req);
+       }
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_error_report (struct sock *sk)
+{
+       HANDLE_CALLBACK(error_report, tux_error_report, real_error_report, sk);
+
+       req->error = TUX_ERROR_CONN_CLOSE;
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_state_change (struct sock *sk)
+{
+       HANDLE_CALLBACK(state_change, tux_state_change, real_state_change, sk);
+
+       if (req->sock && req->sock->sk &&
+                               (req->sock->sk->sk_state > TCP_ESTABLISHED)) {
+               Dprintk("req %p changed to TCP non-established!\n", req);
+               Dprintk("req->sock: %p\n", req->sock);
+               if (req->sock)
+                       Dprintk("req->sock->sk: %p\n", req->sock->sk);
+               if (req->sock && req->sock->sk)
+                       Dprintk("TCP state: %d\n", req->sock->sk->sk_state);
+               Dprintk("req->error = TUX_ERROR_CONN_CLOSE!\n");
+               req->error = TUX_ERROR_CONN_CLOSE;
+       }
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_destruct (struct sock *sk)
+{
+       BUG();
+}
+
+static void tux_ftp_data_ready (struct sock *sk, int len)
+{
+       HANDLE_CALLBACK_1(data_ready, tux_ftp_data_ready,
+                               ftp_real_data_ready, sk, len);
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_ftp_write_space (struct sock *sk)
+{
+       HANDLE_CALLBACK_1(write_space, tux_ftp_write_space,
+                               ftp_real_write_space, sk);
+
+       Dprintk("sk->sk_wmem_queued: %d, sk->sk_sndbuf: %d.\n",
+               sk->sk_wmem_queued, sk->sk_sndbuf);
+
+       if (sk_stream_wspace(sk) >= sk->sk_sndbuf/10*8) {
+               clear_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
+               if (!idle_event(req))
+                       output_space_event(req);
+       }
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_ftp_error_report (struct sock *sk)
+{
+       HANDLE_CALLBACK(error_report, tux_ftp_error_report,
+               ftp_real_error_report, sk);
+
+       TDprintk("req %p sock %p got TCP errors on FTP data connection!\n", req, sk);
+       TDprintk("req->error = TUX_ERROR_CONN_CLOSE!\n");
+       req->error = TUX_ERROR_CONN_CLOSE;
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_ftp_state_change (struct sock *sk)
+{
+       HANDLE_CALLBACK(state_change, tux_ftp_state_change,
+                       ftp_real_state_change, sk);
+
+       if (req->sock && req->sock->sk &&
+                       (req->sock->sk->sk_state > TCP_ESTABLISHED)) {
+               Dprintk("req %p FTP control sock changed to TCP non-established!\n", req);
+               Dprintk("req->sock: %p\n", req->sock);
+               TDprintk("req->error = TUX_ERROR_CONN_CLOSE!\n");
+
+               req->error = TUX_ERROR_CONN_CLOSE;
+       }
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_ftp_create_child (struct sock *sk, struct sock *newsk)
+{
+       HANDLE_CALLBACK(create_child, tux_ftp_create_child,
+                       ftp_real_create_child, sk, newsk);
+
+       newsk->sk_user_data = NULL;
+       newsk->sk_data_ready = req->ftp_real_data_ready;
+       newsk->sk_state_change = req->ftp_real_state_change;
+       newsk->sk_write_space = req->ftp_real_write_space;
+       newsk->sk_error_report = req->ftp_real_error_report;
+       newsk->sk_create_child = req->ftp_real_create_child;
+       newsk->sk_destruct = req->ftp_real_destruct;
+
+       if (!idle_event(req))
+               output_space_event(req);
+       read_unlock(&sk->sk_callback_lock);
+}
+
+static void tux_ftp_destruct (struct sock *sk)
+{
+       BUG();
+}
+
+static void link_tux_socket (tux_req_t *req, struct socket *sock)
+{
+       struct sock *sk = sock->sk;
+
+       if (req->sock)
+               TUX_BUG();
+       if (sk->sk_destruct == tux_destruct)
+               TUX_BUG();
+       /*
+        * (No need to lock the socket, we just want to
+        * make sure that events from now on go through
+        * tux_data_ready())
+        */
+       write_lock_irq(&sk->sk_callback_lock);
+
+       req->sock = sock;
+       sk->sk_user_data = req;
+
+       req->real_data_ready = sk->sk_data_ready;
+       req->real_state_change = sk->sk_state_change;
+       req->real_write_space = sk->sk_write_space;
+       req->real_error_report = sk->sk_error_report;
+       req->real_destruct = sk->sk_destruct;
+
+       sk->sk_data_ready = tux_data_ready;
+       sk->sk_state_change = tux_state_change;
+       sk->sk_write_space = tux_write_space;
+       sk->sk_error_report = tux_error_report;
+       sk->sk_destruct = tux_destruct;
+
+       write_unlock_irq(&sk->sk_callback_lock);
+
+       if (req->real_destruct == tux_destruct)
+               TUX_BUG();
+       req->client_addr = inet_sk(sk)->daddr;
+       req->client_port = inet_sk(sk)->dport;
+
+       add_wait_queue(sk->sk_sleep, &req->sleep);
+}
+
+void __link_data_socket (tux_req_t *req, struct socket *sock,
+                                               struct sock *sk)
+{
+       /*
+        * (No need to lock the socket, we just want to
+        * make sure that events from now on go through
+        * tux_data_ready())
+        */
+       write_lock_irq(&sk->sk_callback_lock);
+
+       req->data_sock = sock;
+       sk->sk_user_data = req;
+
+       req->ftp_real_data_ready = sk->sk_data_ready;
+       req->ftp_real_state_change = sk->sk_state_change;
+       req->ftp_real_write_space = sk->sk_write_space;
+       req->ftp_real_error_report = sk->sk_error_report;
+       req->ftp_real_create_child = sk->sk_create_child;
+       req->ftp_real_destruct = sk->sk_destruct;
+
+       sk->sk_data_ready = tux_ftp_data_ready;
+       sk->sk_state_change = tux_ftp_state_change;
+       sk->sk_write_space = tux_ftp_write_space;
+       sk->sk_error_report = tux_ftp_error_report;
+       sk->sk_create_child = tux_ftp_create_child;
+       sk->sk_destruct = tux_ftp_destruct;
+
+       if (req->ftp_real_destruct == tux_ftp_destruct)
+               TUX_BUG();
+
+       write_unlock_irq(&sk->sk_callback_lock);
+
+       add_wait_queue(sk->sk_sleep, &req->ftp_sleep);
+}
+
+void link_tux_data_socket (tux_req_t *req, struct socket *sock)
+{
+       struct sock *sk = sock->sk;
+
+       if (req->data_sock)
+               TUX_BUG();
+       if (sk->sk_destruct == tux_ftp_destruct)
+               TUX_BUG();
+       __link_data_socket(req, sock, sk);
+}
+
+void unlink_tux_socket (tux_req_t *req)
+{
+       struct sock *sk;
+       
+       if (!req->sock || !req->sock->sk)
+               return;
+       sk = req->sock->sk;
+
+       write_lock_irq(&sk->sk_callback_lock);
+       if (!sk->sk_user_data)
+               TUX_BUG();
+       if (req->real_destruct == tux_destruct)
+               TUX_BUG();
+
+       sk->sk_user_data = NULL;
+
+       sk->sk_data_ready = req->real_data_ready;
+       sk->sk_state_change = req->real_state_change;
+       sk->sk_write_space = req->real_write_space;
+       sk->sk_error_report = req->real_error_report;
+       sk->sk_destruct = req->real_destruct;
+
+       if (sk->sk_destruct == tux_destruct)
+               TUX_BUG();
+
+       req->real_data_ready = NULL;
+       req->real_state_change = NULL;
+       req->real_write_space = NULL;
+       req->real_error_report = NULL;
+       req->real_destruct = NULL;
+
+       write_unlock_irq(&sk->sk_callback_lock);
+
+       remove_wait_queue(sk->sk_sleep, &req->sleep);
+}
+
+void unlink_tux_data_socket (tux_req_t *req)
+{
+       struct sock *sk;
+       
+       if (!req->data_sock || !req->data_sock->sk)
+               return;
+       sk = req->data_sock->sk;
+
+       write_lock_irq(&sk->sk_callback_lock);
+
+       if (req->real_destruct == tux_ftp_destruct)
+               TUX_BUG();
+
+       sk->sk_user_data = NULL;
+       sk->sk_data_ready = req->ftp_real_data_ready;
+       sk->sk_state_change = req->ftp_real_state_change;
+       sk->sk_write_space = req->ftp_real_write_space;
+       sk->sk_error_report = req->ftp_real_error_report;
+       sk->sk_create_child = req->ftp_real_create_child;
+       sk->sk_destruct = req->ftp_real_destruct;
+
+       req->ftp_real_data_ready = NULL;
+       req->ftp_real_state_change = NULL;
+       req->ftp_real_write_space = NULL;
+       req->ftp_real_error_report = NULL;
+       req->ftp_real_create_child = NULL;
+       req->ftp_real_destruct = NULL;
+
+       write_unlock_irq(&sk->sk_callback_lock);
+
+       if (sk->sk_destruct == tux_ftp_destruct)
+               TUX_BUG();
+
+       remove_wait_queue(sk->sk_sleep, &req->ftp_sleep);
+}
+
+void add_tux_atom (tux_req_t *req, atom_func_t *atom)
+{
+       Dprintk("adding TUX atom %p to req %p, atom_idx: %d, at %p/%p.\n",
+               atom, req, req->atom_idx, __builtin_return_address(0), __builtin_return_address(1));
+       if (req->atom_idx == MAX_TUX_ATOMS)
+               TUX_BUG();
+       req->atoms[req->atom_idx] = atom;
+       req->atom_idx++;
+}
+
+void del_tux_atom (tux_req_t *req)
+{
+       if (!req->atom_idx)
+               TUX_BUG();
+       req->atom_idx--;
+       Dprintk("removing TUX atom %p to req %p, atom_idx: %d, at %p.\n",
+               req->atoms[req->atom_idx], req, req->atom_idx, __builtin_return_address(0));
+}
+
+void tux_schedule_atom (tux_req_t *req, int cachemiss)
+{
+       if (!list_empty(&req->work))
+               TUX_BUG();
+       if (!req->atom_idx)
+               TUX_BUG();
+       req->atom_idx--;
+       Dprintk("DOING TUX atom %p, req %p, atom_idx: %d, at %p.\n",
+               req->atoms[req->atom_idx], req, req->atom_idx, __builtin_return_address(0));
+       might_sleep();
+       req->atoms[req->atom_idx](req, cachemiss);
+       might_sleep();
+       Dprintk("DONE TUX atom %p, req %p, atom_idx: %d, at %p.\n",
+               req->atoms[req->atom_idx], req, req->atom_idx, __builtin_return_address(0));
+}
+
+/*
+ * Puts newly accepted connections into the inputqueue. This is the
+ * first step in the life of a TUX request.
+ */
+int accept_requests (threadinfo_t *ti)
+{
+       int count = 0, last_count = 0, error, socknr = 0;
+       struct socket *sock, *new_sock;
+       struct tcp_opt *tp1, *tp2;
+       tux_req_t *req;
+
+       if (ti->nr_requests > tux_max_connect)
+               goto out;
+
+repeat:
+       for (socknr = 0; socknr < CONFIG_TUX_NUMSOCKETS; socknr++) {
+               tux_listen_t *tux_listen;
+
+               tux_listen = ti->listen + socknr;
+               sock = tux_listen->sock;
+               if (!sock)
+                       break;
+               if (unlikely(test_thread_flag(TIF_NEED_RESCHED)))
+                       break;
+
+       tp1 = tcp_sk(sock->sk);
+       /*
+        * Quick test to see if there are connections on the queue.
+        * This is cheaper than accept() itself because this saves us
+        * the allocation of a new socket. (Which doesn't seem to be
+        * used anyway)
+        */
+       if (tp1->accept_queue) {
+               tux_proto_t *proto;
+
+               if (!count++)
+                       __set_task_state(current, TASK_RUNNING);
+
+               new_sock = sock_alloc();
+               if (!new_sock)
+                       goto out;
+
+               new_sock->type = sock->type;
+               new_sock->ops = sock->ops;
+
+               error = sock->ops->accept(sock, new_sock, O_NONBLOCK);
+               if (error < 0)
+                       goto err;
+               if (new_sock->sk->sk_state != TCP_ESTABLISHED)
+                       goto err;
+
+               tp2 = tcp_sk(new_sock->sk);
+               tp2->nonagle = 2;
+               tp2->ack.pingpong = tux_ack_pingpong;
+               new_sock->sk->sk_reuse = 1;
+               sock_set_flag(new_sock->sk, SOCK_URGINLINE);
+
+               /* Allocate a request-entry for the connection */
+               req = kmalloc_req(ti);
+               if (!req)
+                       BUG();
+               link_tux_socket(req, new_sock);
+
+               proto = req->proto = tux_listen->proto;
+
+               proto->got_request(req);
+       }
+       }
+       if (count != last_count) {
+               last_count = count;
+               goto repeat;
+       }
+out:
+       return count;
+err:
+       sock_release(new_sock);
+       goto out;
+}
+
diff --git a/net/tux/cachemiss.c b/net/tux/cachemiss.c
new file mode 100644 (file)
index 0000000..f840583
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * cachemiss.c: handle the 'slow IO path' by queueing not-yet-cached
+ * requests to the IO-thread pool. Dynamic load balancing is done
+ * between IO threads, based on the number of requests they have pending.
+ */
+
+#include <net/tux.h>
+#include <linux/delay.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+void queue_cachemiss (tux_req_t *req)
+{
+       iothread_t *iot = req->ti->iot;
+
+       Dprintk("queueing_cachemiss(req:%p) (req->cwd_dentry: %p) at %p:%p.\n",
+               req, req->cwd_dentry, __builtin_return_address(0), __builtin_return_address(1));
+       if (req->idle_input || req->wait_output_space)
+               TUX_BUG();
+       req->had_cachemiss = 1;
+       if (!list_empty(&req->work))
+               TUX_BUG();
+       spin_lock(&iot->async_lock);
+       if (connection_too_fast(req))
+               list_add_tail(&req->work, &iot->async_queue);
+       else
+               list_add(&req->work, &iot->async_queue);
+       iot->nr_async_pending++;
+       INC_STAT(nr_cachemiss_pending);
+       spin_unlock(&iot->async_lock);
+
+       wake_up(&iot->async_sleep);
+}
+
+static tux_req_t * get_cachemiss (iothread_t *iot)
+{
+       struct list_head *tmp;
+       tux_req_t *req = NULL;
+
+       spin_lock(&iot->async_lock);
+       if (!list_empty(&iot->async_queue)) {
+
+               tmp = iot->async_queue.next;
+               req = list_entry(tmp, tux_req_t, work);
+
+               Dprintk("get_cachemiss(%p): got req %p.\n", iot, req);
+               list_del(tmp);
+               DEBUG_DEL_LIST(tmp);
+               iot->nr_async_pending--;
+               DEC_STAT(nr_cachemiss_pending);
+
+               if (req->ti->iot != iot)
+                       TUX_BUG();
+       }
+       spin_unlock(&iot->async_lock);
+       return req;
+}
+
+struct file * tux_open_file (char *filename, int mode)
+{
+       struct file *filp;
+
+       if (!filename)
+               TUX_BUG();
+
+       /* Rule no. 3 -- Does the file exist ? */
+
+       filp = filp_open(filename, mode, 0600);
+
+       if (IS_ERR(filp) || !filp || !filp->f_dentry)
+               goto err;
+
+out:
+       return filp;
+err:
+       Dprintk("filp_open() error: %d.\n", (int)filp);
+       filp = NULL;
+       goto out;
+}
+
+static int cachemiss_thread (void *data)
+{
+       tux_req_t *req;
+       struct k_sigaction *ka;
+       DECLARE_WAITQUEUE(wait, current);
+       iothread_t *iot = data;
+       int nr = iot->ti->cpu, wake_up;
+
+       Dprintk("iot %p/%p got started.\n", iot, current);
+       drop_permissions();
+
+       spin_lock(&iot->async_lock);
+       iot->threads++;
+       sprintf(current->comm, "async IO %d/%d", nr, iot->threads);
+
+
+       spin_lock_irq(&current->sighand->siglock);
+       ka = current->sighand->action + SIGCHLD-1;
+       ka->sa.sa_handler = SIG_IGN;
+       siginitsetinv(&current->blocked, sigmask(SIGCHLD));
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+
+       spin_unlock(&iot->async_lock);
+#if CONFIG_SMP
+       {
+               cpumask_t mask;
+
+               if (cpu_isset(nr, cpu_online_map)) {
+                       cpus_clear(mask);
+                       cpu_set(nr, mask);
+                       set_cpus_allowed(current, mask);
+               }
+
+       }
+#endif
+
+       add_wait_queue_exclusive(&iot->async_sleep, &wait);
+
+       for (;;) {
+               while (!list_empty(&iot->async_queue) &&
+                               (req = get_cachemiss(iot))) {
+
+                       if (!req->atom_idx) {
+                               add_tux_atom(req, flush_request);
+                               add_req_to_workqueue(req);
+                               continue;
+                       }
+                       tux_schedule_atom(req, 1);
+                       if (signal_pending(current))
+                               flush_all_signals();
+               }
+               if (signal_pending(current))
+                       flush_all_signals();
+               if (!list_empty(&iot->async_queue))
+                       continue;
+               if (iot->shutdown) {
+                       Dprintk("iot %p/%p got shutdown!\n", iot, current);
+                       break;
+               }
+               __set_current_state(TASK_INTERRUPTIBLE);
+               if (list_empty(&iot->async_queue)) {
+                       Dprintk("iot %p/%p going to sleep.\n", iot, current);
+                       schedule();
+                       Dprintk("iot %p/%p got woken up.\n", iot, current);
+               }
+               __set_current_state(TASK_RUNNING);
+       }
+
+       remove_wait_queue(&iot->async_sleep, &wait);
+
+       wake_up = 0;
+       spin_lock(&iot->async_lock);
+       if (!--iot->threads)
+               wake_up = 1;
+       spin_unlock(&iot->async_lock);
+       Dprintk("iot %p/%p has finished shutdown!\n", iot, current);
+       if (wake_up) {
+               Dprintk("iot %p/%p waking up master.\n", iot, current);
+               wake_up(&iot->wait_shutdown);
+       }
+
+       return 0;
+}
+
+static void __stop_cachemiss_threads (iothread_t *iot)
+{
+       DECLARE_WAITQUEUE(wait, current);
+
+       Dprintk("stopping async IO threads %p.\n", iot);
+       add_wait_queue(&iot->wait_shutdown, &wait);
+
+       spin_lock(&iot->async_lock);
+       if (iot->shutdown)
+               TUX_BUG();
+       if (!iot->threads)
+               TUX_BUG();
+       iot->shutdown = 1;
+       wake_up_all(&iot->async_sleep);
+       spin_unlock(&iot->async_lock);
+               
+       __set_current_state(TASK_UNINTERRUPTIBLE);
+       Dprintk("waiting for async IO threads %p to exit.\n", iot);
+       schedule();
+       remove_wait_queue(&iot->wait_shutdown, &wait);
+
+       if (iot->threads)
+               TUX_BUG();
+       if (iot->nr_async_pending)
+               TUX_BUG();
+       Dprintk("stopped async IO threads %p.\n", iot);
+}
+
+void stop_cachemiss_threads (threadinfo_t *ti)
+{
+       iothread_t *iot = ti->iot;
+
+       if (!iot)
+               TUX_BUG();
+       if (iot->nr_async_pending)
+               TUX_BUG();
+       __stop_cachemiss_threads(iot);
+       ti->iot = NULL;
+       kfree(iot);
+}
+
+int start_cachemiss_threads (threadinfo_t *ti)
+{
+       int i, pid;
+
+       iothread_t *iot;
+
+       iot = kmalloc(sizeof(*iot), GFP_KERNEL);
+       if (!iot)
+               return -ENOMEM;
+       memset(iot, 0, sizeof(*iot));
+
+       iot->ti = ti;
+       iot->async_lock = SPIN_LOCK_UNLOCKED;
+       iot->nr_async_pending = 0;
+       INIT_LIST_HEAD(&iot->async_queue);
+       init_waitqueue_head(&iot->async_sleep);
+       init_waitqueue_head(&iot->wait_shutdown);
+               
+       for (i = 0; i < NR_IO_THREADS; i++) {
+               pid = kernel_thread(cachemiss_thread, (void *)iot, 0);
+               if (pid < 0) {
+                       printk(KERN_ERR "TUX: error %d creating IO thread!\n",
+                                       pid);
+                       __stop_cachemiss_threads(iot);
+                       kfree(iot);
+                       return pid;
+               }
+       }
+       ti->iot = iot;
+       /*
+        * Wait for all cachemiss threads to start up:
+        */
+       while (iot->threads != NR_IO_THREADS) {
+               __set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ/10);
+       }
+       return 0;
+}
+
diff --git a/net/tux/cgi.c b/net/tux/cgi.c
new file mode 100644 (file)
index 0000000..fda4d38
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * cgi.c: user-space CGI (and other) code execution.
+ */
+
+#define __KERNEL_SYSCALLS__
+#define __KERNEL_SYSCALLS_NO_ERRNO__
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+static int exec_usermode(char *program_path, char *argv[], char *envp[])
+{
+       int i, err;
+
+       err = tux_chroot(tux_cgiroot);
+       if (err) {
+               printk(KERN_ERR "TUX: CGI chroot returned %d, /proc/sys/net/tux/cgiroot is probably set up incorrectly! Aborting CGI execution.\n", err);
+               return err;
+       }
+
+       /* Allow execve args to be in kernel space. */
+       set_fs(KERNEL_DS);
+
+       flush_signals(current);
+       spin_lock_irq(&current->sighand->siglock);
+       flush_signal_handlers(current, 1);
+       spin_unlock_irq(&current->sighand->siglock);
+
+       for (i = 3; i < current->files->max_fds; i++ )
+               if (current->files->fd[i])
+                       tux_close(i);
+
+       err = execve(program_path, argv, envp);
+       if (err < 0)
+               return err;
+       return 0;
+}
+
+static inline long tux_dup(unsigned int fildes)
+{
+       int ret = -EBADF;
+       struct file * file = fget(fildes);
+
+       if (file)
+               ret = dupfd(file, 0);
+       return ret;
+}
+
+static int exec_helper (void * data)
+{
+       exec_param_t *param = data;
+       char **tmp;
+       int ret;
+
+       sprintf(current->comm,"doexec - %d", current->pid);
+#if CONFIG_SMP
+       if (!tux_cgi_inherit_cpu) {
+               
+               cpumask_t cgi_mask, map;
+               
+               mask_to_cpumask(tux_cgi_cpu_mask, &cgi_mask);
+               cpus_and(map, cpu_online_map, cgi_mask);
+       
+               if (!(cpus_empty(map)))
+                       set_cpus_allowed(current, cgi_mask);
+               else
+                       set_cpus_allowed(current, cpu_online_map);
+       }
+#endif
+
+       if (!param)
+               TUX_BUG();
+       Dprintk("doing exec(%s).\n", param->command);
+
+       Dprintk("argv: ");
+       tmp = param->argv;
+       while (*tmp) {
+               Dprintk("{%s} ", *tmp);
+               tmp++;
+       }
+       Dprintk("\n");
+       Dprintk("envp: ");
+       tmp = param->envp;
+       while (*tmp) {
+               Dprintk("{%s} ", *tmp);
+               tmp++;
+       }
+       Dprintk("\n");
+       /*
+        * Set up stdin, stdout and stderr of the external
+        * CGI application.
+        */
+       if (param->pipe_fds) {
+               tux_close(1);
+               tux_close(2);
+               tux_close(4);
+               if (tux_dup(3) != 1)
+                       TUX_BUG();
+               if (tux_dup(5) != 2)
+                       TUX_BUG();
+               tux_close(3);
+               tux_close(5);
+               // do not close on exec.
+#if 0
+               sys_fcntl(0, F_SETFD, 0);
+               sys_fcntl(1, F_SETFD, 0);
+               sys_fcntl(2, F_SETFD, 0);
+#else
+               spin_lock(&current->files->file_lock);
+               FD_CLR(0, current->files->close_on_exec);
+               FD_CLR(1, current->files->close_on_exec);
+               FD_CLR(2, current->files->close_on_exec);
+               spin_unlock(&current->files->file_lock);
+#endif
+       }
+       ret = exec_usermode(param->command, param->argv, param->envp);
+       if (ret < 0)
+               Dprintk("bug: exec() returned %d.\n", ret);
+       else
+               Dprintk("exec()-ed successfully!\n");
+       return 0;
+}
+
+pid_t tux_exec_process (char *command, char **argv,
+                       char **envp, int pipe_fds,
+                               exec_param_t *param, int wait)
+{
+       exec_param_t param_local;
+       pid_t pid;
+       struct k_sigaction *ka;
+
+       ka = current->sighand->action + SIGCHLD-1;
+       ka->sa.sa_handler = SIG_IGN;
+
+       if (!param && wait)
+               param = &param_local;
+
+       param->command = command;
+       param->argv = argv;
+       param->envp = envp;
+       param->pipe_fds = pipe_fds;
+
+repeat_fork:
+       pid = kernel_thread(exec_helper, (void*) param, CLONE_SIGHAND|SIGCHLD);
+       Dprintk("kernel thread created PID %d.\n", pid);
+       if (pid < 0) {
+               printk(KERN_ERR "TUX: could not create new CGI kernel thread due to %d... retrying.\n", pid);
+               current->state = TASK_UNINTERRUPTIBLE;
+               schedule_timeout(HZ);
+               goto repeat_fork;
+       }
+       return pid;
+}
diff --git a/net/tux/directory.c b/net/tux/directory.c
new file mode 100644 (file)
index 0000000..714800e
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * directory.c: directory listing support
+ */
+
+#define __KERNEL_SYSCALLS__
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+char * tux_print_path (tux_req_t *req, struct dentry *dentry, struct vfsmount *mnt, char *buf, unsigned int max_len)
+{
+       char *res;
+       struct dentry *cwd, *root;
+       struct vfsmount *cwd_mnt, *rootmnt;
+
+       cwd = dget(dentry);
+       cwd_mnt = mntget(mnt);
+       root = dget(req->docroot_dentry);
+       rootmnt = mntget(req->docroot_mnt);
+
+       spin_lock(&dcache_lock);
+       res = __d_path(cwd, cwd_mnt, root, rootmnt, buf, max_len);
+       spin_unlock(&dcache_lock);
+
+       dput(cwd);
+       mntput(cwd_mnt);
+       dput(root);
+       mntput(rootmnt);
+
+       return res;
+}
+
+/*
+ * There are filesystems that do not fill in ->d_type correctly.
+ * Determine file-type.
+ */
+static int get_d_type (struct dentry *dentry)
+{
+       unsigned int mode = dentry->d_inode->i_mode;
+
+       if (S_ISREG(mode))
+               return DT_REG;
+       if (S_ISDIR(mode))
+               return DT_DIR;
+       if (S_ISLNK(mode))
+               return DT_LNK;
+       if (S_ISFIFO(mode))
+               return DT_FIFO;
+       if (S_ISSOCK(mode))
+               return DT_SOCK;
+       if (S_ISCHR(mode))
+               return DT_CHR;
+       if (S_ISBLK(mode))
+               return DT_BLK;
+       return 0;
+}
+
+static void do_dir_line (tux_req_t *req, int cachemiss)
+{
+       struct linux_dirent64 *dirp, *dirp0;
+       char string0[MAX_OBJECTNAME_LEN+200], *tmp;
+       int len, curroff, total, str_len = 0;
+       int err, flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       struct nameidata base;
+       struct dentry *dentry = NULL;
+       struct inode *inode = NULL;
+       struct vfsmount *mnt = NULL;
+
+       if (req->proto->check_req_err(req, cachemiss))
+               return;
+
+       tmp = NULL;
+       dirp0 = req->dirp0;
+       curroff = req->curroff;
+       total = req->total;
+
+       dirp = (struct linux_dirent64 *)((char *)dirp0 + curroff);
+       if (!dirp->d_name || !dirp->d_name[0])
+               goto next_dir;
+       /*
+        * Hide .xxxxx files:
+        */
+       if (dirp->d_name[0] == '.')
+               goto next_dir;
+       Dprintk("<%s T:%d (off:%Ld) (len:%d)>\n", dirp->d_name, dirp->d_type, dirp->d_off, dirp->d_reclen);
+       if (tux_hide_unreadable) {
+               switch (dirp->d_type) {
+                       default:
+                               goto next_dir;
+                       case DT_UNKNOWN:
+                       case DT_REG:
+                       case DT_DIR:
+                       case DT_LNK:
+                       /* valid entries - fall through. */
+                               ;
+               }
+       }
+       len = strlen(dirp->d_name);
+       if (len >= MAX_OBJECTNAME_LEN) {
+               dirp->d_name[MAX_OBJECTNAME_LEN] = 0;
+               len = MAX_OBJECTNAME_LEN-1;
+       }
+
+       if (!req->dentry)
+               TUX_BUG();
+
+       base.flags = flag;
+       base.last_type = LAST_ROOT;
+       base.dentry = dget(req->dentry);
+       base.mnt = mntget(req->cwd_mnt);
+
+       switch_docroot(req);
+       err = path_walk(dirp->d_name, &base);
+
+       Dprintk("path_walk() returned %d.\n", err);
+
+       if (err) {
+               if (err == -EWOULDBLOCKIO) {
+                       add_tux_atom(req, do_dir_line);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto next_dir;
+       }
+
+       dentry = base.dentry;
+       mnt = base.mnt;
+       if (!dentry)
+               TUX_BUG();
+       if (IS_ERR(dentry))
+               TUX_BUG();
+       inode = dentry->d_inode;
+       if (!inode)
+               TUX_BUG();
+       if (!dirp->d_type)
+               dirp->d_type = get_d_type(dentry);
+       if (tux_hide_unreadable) {
+               umode_t mode;
+
+               mode = inode->i_mode;
+               if (mode & tux_mode_forbidden)
+                       goto out_dput;
+               if (!(mode & tux_mode_allowed))
+                       goto out_dput;
+
+               err = permission(inode, MAY_READ, NULL);
+               if (err)
+                       goto out_dput;
+               if (dirp->d_type == DT_DIR) {
+                       err = permission(inode, MAY_EXEC, NULL);
+                       if (err)
+                               goto out_dput;
+               }
+       }
+
+       tmp = req->proto->print_dir_line(req, string0, dirp->d_name, len, dirp->d_type, dentry, inode);
+       if (tmp)
+               str_len = tmp-string0;
+out_dput:
+       dput(dentry);
+       mntput(mnt);
+next_dir:
+       curroff += dirp->d_reclen;
+
+       if (tmp && (tmp != string0))
+               Dprintk("writing line (len: %d): <%s>\n", strlen(string0), string0);
+
+       if (curroff < total) {
+               req->dirp0 = dirp0;
+               req->curroff = curroff;
+               add_tux_atom(req, do_dir_line);
+       } else {
+               kfree(dirp0);
+               req->dirp0 = NULL;
+               req->curroff = 0;
+               // falls back to the list_directory atom
+       }
+       if (tmp && (tmp != string0))
+               __send_async_message(req, string0, 200, str_len, 0);
+       else
+               add_req_to_workqueue(req);
+}
+
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
+#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
+
+static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
+                    ino_t ino, unsigned int d_type)
+{
+       struct linux_dirent64 * dirent, d;
+       struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf;
+       int reclen = ROUND_UP64(NAME_OFFSET(dirent) + namlen + 1);
+
+       buf->error = -EINVAL;   /* only used if we fail.. */
+       if (reclen > buf->count)
+               return -EINVAL;
+       dirent = buf->previous;
+       if (dirent) {
+               d.d_off = offset;
+               copy_to_user(&dirent->d_off, &d.d_off, sizeof(d.d_off));
+       }
+       dirent = buf->current_dir;
+       buf->previous = dirent;
+       memset(&d, 0, NAME_OFFSET(&d));
+       d.d_ino = ino;
+       d.d_reclen = reclen;
+       d.d_type = d_type;
+       copy_to_user(dirent, &d, NAME_OFFSET(&d));
+       copy_to_user(dirent->d_name, name, namlen);
+       put_user(0, dirent->d_name + namlen);
+       dirent = (void *)dirent + reclen;
+       buf->current_dir = dirent;
+       buf->count -= reclen;
+       return 0;
+}
+#define DIRENT_SIZE 3000
+
+void list_directory (tux_req_t *req, int cachemiss)
+{
+       struct getdents_callback64 buf;
+       struct linux_dirent64 *dirp0;
+       mm_segment_t oldmm;
+       int total;
+
+       Dprintk("list_directory(%p, %d), dentry: %p.\n", req, cachemiss, req->dentry);
+       if (!req->cwd_dentry)
+               TUX_BUG();
+
+       if (!cachemiss) {
+               add_tux_atom(req, list_directory);
+               queue_cachemiss(req);
+               return;
+       }
+
+       dirp0 = tux_kmalloc(DIRENT_SIZE);
+
+       buf.current_dir = dirp0;
+       buf.previous = NULL;
+       buf.count = DIRENT_SIZE;
+       buf.error = 0;
+
+       oldmm = get_fs(); set_fs(KERNEL_DS);
+       set_fs(KERNEL_DS);
+       total = vfs_readdir(&req->in_file, filldir64, &buf);
+       set_fs(oldmm);
+
+       if (buf.previous)
+               total = DIRENT_SIZE - buf.count;
+
+       Dprintk("total: %d (buf.error: %d, buf.previous %p)\n",
+               total, buf.error, buf.previous);
+
+       if (total < 0) {
+               kfree(dirp0);
+               req_err(req);
+               add_req_to_workqueue(req);
+               return;
+       }
+       if (!total) {
+               kfree(dirp0);
+               req->in_file.f_pos = 0;
+               add_req_to_workqueue(req);
+               return;
+       }
+
+       if (!req->cwd_dentry)
+               TUX_BUG();
+       add_tux_atom(req, list_directory);
+
+       req->dirp0 = dirp0;
+       req->curroff = 0;
+       req->total = total;
+       add_tux_atom(req, do_dir_line);
+
+       add_req_to_workqueue(req);
+}
+
diff --git a/net/tux/extcgi.c b/net/tux/extcgi.c
new file mode 100644 (file)
index 0000000..1d1d1d5
--- /dev/null
@@ -0,0 +1,329 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * extcgi.c: dynamic TUX module which forks and starts an external CGI
+ */
+
+#define __KERNEL_SYSCALLS__
+#define __KERNEL_SYSCALLS_NO_ERRNO__
+
+#include <net/tux.h>
+#include "parser.h"
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+#define MAX_ENVLEN 1000
+#define MAX_CGI_METAVARIABLES 32
+#define CGI_CHUNK_SIZE 1024 
+#define MAX_CGI_COMMAND_LEN 256
+
+#if CONFIG_TUX_DEBUG
+#define PRINT_MESSAGE_LEFT \
+       Dprintk("CGI message left at %s:%d:\n--->{%s}<---\n", \
+               __FILE__, __LINE__, curr)
+#else
+#define PRINT_MESSAGE_LEFT do {} while(0)
+#endif
+
+#define GOTO_INCOMPLETE do { Dprintk("invalid CGI reply at %s:%d.\n", __FILE__, __LINE__); goto invalid; } while (0)
+
+/*
+ * Please acknowledge our hard work by not changing this define, or
+ * at least please acknowledge us by leaving "TUX/2.0 (Linux)" in
+ * the ID string. Thanks! :-)
+ */
+#define CGI_SUCCESS2 "HTTP/1.1 200 OK\r\nConnection: close\r\nServer: TUX/2.0 (Linux)\r\n"
+
+static int handle_cgi_reply (tux_req_t *req)
+{
+       int first = 1;
+       int len, left, total;
+       char *buf, *tmp;
+       mm_segment_t oldmm;
+
+       buf = tux_kmalloc(CGI_CHUNK_SIZE+1);
+       tux_close(3);
+       tux_close(4);
+       tux_close(5);
+       oldmm = get_fs(); set_fs(KERNEL_DS);
+       send_sync_buf(NULL, req->sock, CGI_SUCCESS2, sizeof(CGI_SUCCESS2)-1, MSG_MORE);
+       set_fs(oldmm);
+
+       req->bytes_sent = 0;
+       /*
+        * The new process is the new owner of the socket, it will
+        * close it.
+        */
+repeat:
+       left = CGI_CHUNK_SIZE;
+       len = 0;
+       total = 0;
+       tmp = buf;
+       do {
+               mm_segment_t oldmm;
+
+               tmp += len;
+               total += len;
+               left -= len;
+               if (!left)
+                       break;
+repeat_read:
+               Dprintk("reading %d bytes via read().\n", left);
+               oldmm = get_fs(); set_fs(KERNEL_DS);
+               len = read(2, tmp, left);
+               set_fs(oldmm);
+               Dprintk("got %d bytes from read() (total: %d).\n", len, total);
+               if (len > 0)
+                       tmp[len] = 0;
+               Dprintk("CGI reply: (%d bytes, total %d).\n", len, total);
+               if (len == -ERESTARTSYS) {
+                       flush_all_signals();
+                       goto repeat_read;
+               }
+       } while (len > 0);
+       if (total > CGI_CHUNK_SIZE) {
+               printk(KERN_ERR "TUX: CGI weirdness. total: %d, len: %d, left: %d.\n", total, len, left);
+               TUX_BUG();
+       }
+       Dprintk("CGI done reply chunk: (%d bytes last, total %d).\n", len, total);
+       if (total) {
+               mm_segment_t oldmm;
+
+               oldmm = get_fs(); set_fs(KERNEL_DS);
+               if (!len)
+                       send_sync_buf(NULL, req->sock, buf, total, 0);
+               else
+                       send_sync_buf(NULL, req->sock, buf, total, MSG_MORE);
+               set_fs(oldmm);
+               req->bytes_sent += total;
+       }
+
+       Dprintk("bytes_sent: %d\n", req->bytes_sent);
+       if ((total > 0) && first) {
+               first = 0;
+
+               if (buf[total])
+                       TUX_BUG();
+               tmp = strstr(buf, "\n\n");
+               if (tmp) {
+                       req->bytes_sent -= (tmp-buf) + 2;
+                       Dprintk("new bytes_sent: %d\n", req->bytes_sent);
+               } else {
+                       req->bytes_sent = 0;
+                       req_err(req);
+               }
+       }
+       if (len < 0)
+               Dprintk("sys_read returned with %d.\n", len);
+       else {
+               if (total > 0)
+                       goto repeat;
+       }
+       tux_close(2);
+
+       req->status = 200;
+       add_req_to_workqueue(req);
+       kfree(buf);
+
+       return -1;
+}
+
+static int exec_external_cgi (void *data)
+{
+       exec_param_t param;
+       tux_req_t *req = data;
+       char *envp[MAX_CGI_METAVARIABLES+1], **envp_p;
+       char *argv[] = { "extcgi", NULL};
+       char *envstr, *tmp;
+       unsigned int host;
+       struct k_sigaction *ka;
+       int in_pipe_fds[2], out_pipe_fds[2], err_pipe_fds[2], len, err;
+       char *command;
+       pid_t pid;
+
+       len = strlen(tux_common_docroot);
+       if (req->objectname_len + len + 12 > MAX_CGI_COMMAND_LEN)
+               return -ENOMEM;
+       sprintf(current->comm,"cgimain - %d", current->pid);
+       host = inet_sk(req->sock->sk)->daddr;
+
+       envstr = tux_kmalloc(MAX_ENVLEN);
+       command = tux_kmalloc(MAX_CGI_COMMAND_LEN);
+
+       tmp = envstr;
+       envp_p = envp;
+
+#define WRITE_ENV(str...) \
+       if (envp_p >= envp + MAX_CGI_METAVARIABLES) \
+               TUX_BUG(); \
+       len = sprintf(tmp, str); \
+       *envp_p++ = tmp; \
+       tmp += len + 1; \
+       if (tmp >= envstr + MAX_ENVLEN) \
+               TUX_BUG();
+
+       #define WRITE_ENV_STR(str,field,len)                    \
+       do {                                                    \
+               int offset;                                     \
+                                                               \
+               offset = sizeof(str)-1;                         \
+               err = -EFAULT;                                  \
+               if (tmp - envstr + offset + len >= MAX_ENVLEN)  \
+                       goto out;                               \
+               if (envp_p >= envp + MAX_CGI_METAVARIABLES)     \
+                       TUX_BUG();                              \
+               memcpy(tmp, str, offset);                       \
+               memcpy(tmp + offset, field, len);               \
+               offset += len;                                  \
+               tmp[offset] = 0;                                \
+               *envp_p++ = tmp;                                \
+               tmp += offset + 1;                              \
+       } while (0)
+
+       WRITE_ENV("GATEWAY_INTERFACE=CGI/1.1");
+       WRITE_ENV("CONTENT_LENGTH=%d", req->post_data_len);
+       WRITE_ENV("REMOTE_ADDR=%d.%d.%d.%d", NIPQUAD(host));
+       WRITE_ENV("SERVER_PORT=%d", 80);
+       WRITE_ENV("SERVER_SOFTWARE=TUX/2.0 (Linux)");
+
+#if 1
+       WRITE_ENV("DOCUMENT_ROOT=/");
+       WRITE_ENV("PATH_INFO=/");
+#else
+       WRITE_ENV_STR("DOCUMENT_ROOT=", tux_common_docroot, len);
+       WRITE_ENV_STR("PATH_INFO=", tux_common_docroot, len);
+#endif
+       WRITE_ENV_STR("QUERY_STRING=", req->query_str, req->query_len);
+       WRITE_ENV_STR("REQUEST_METHOD=", req->method_str, req->method_len);
+       WRITE_ENV_STR("SCRIPT_NAME=", req->objectname, req->objectname_len);
+       WRITE_ENV_STR("SERVER_PROTOCOL=", req->version_str, req->version_len);
+
+       if (req->content_type_len)
+               WRITE_ENV_STR("CONTENT_TYPE=",
+                       req->content_type_str, req->content_type_len);
+       if (req->cookies_len)
+               WRITE_ENV_STR("HTTP_COOKIE=",
+                       req->cookies_str, req->cookies_len);
+
+       if (req->host_len)
+               WRITE_ENV_STR("SERVER_NAME=", req->host, req->host_len);
+       else {
+               const char *host = "localhost";
+               WRITE_ENV_STR("SERVER_NAME=", host, strlen(host));
+       }
+
+       *envp_p = NULL;
+
+       spin_lock_irq(&current->sighand->siglock);
+       ka = current->sighand->action + SIGPIPE-1;
+       ka->sa.sa_handler = SIG_IGN;
+       siginitsetinv(&current->blocked, sigmask(SIGCHLD));
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+
+       tux_close(0); tux_close(1);
+       tux_close(2); tux_close(3);
+       tux_close(4); tux_close(5);
+
+       in_pipe_fds[0] = in_pipe_fds[1] = -1;
+       out_pipe_fds[0] = out_pipe_fds[1] = -1;
+       err_pipe_fds[0] = err_pipe_fds[1] = -1;
+
+       err = -ENFILE;
+       if (do_pipe(in_pipe_fds))
+               goto out;
+       if (do_pipe(out_pipe_fds))
+               goto out;
+       if (do_pipe(err_pipe_fds))
+               goto out;
+
+       if (in_pipe_fds[0] != 0) TUX_BUG();
+       if (in_pipe_fds[1] != 1) TUX_BUG();
+       if (out_pipe_fds[0] != 2) TUX_BUG();
+       if (out_pipe_fds[1] != 3) TUX_BUG();
+       if (err_pipe_fds[0] != 4) TUX_BUG();
+       if (err_pipe_fds[1] != 5) TUX_BUG();
+
+       if (req->virtual && req->host_len)
+               sprintf(command, "/%s/cgi-bin/%s", req->host, req->objectname);
+       else
+               sprintf(command, "/cgi-bin/%s", req->objectname);
+       Dprintk("before CGI exec.\n");
+       pid = tux_exec_process(command, argv, envp, 1, &param, 0);
+       Dprintk("after CGI exec.\n");
+
+       if (req->post_data_len) {
+               mm_segment_t oldmm;
+               int ret;
+
+               Dprintk("POST data to CGI:\n");
+               oldmm = get_fs(); set_fs(KERNEL_DS);
+               ret = write(1, req->post_data_str, req->post_data_len);
+               set_fs(oldmm);
+               Dprintk("write() returned: %d.\n", ret);
+               if (ret != req->post_data_len)
+                       Dprintk("write() returned: %d.\n", ret);
+       }
+
+       tux_close(0);
+       tux_close(1);
+
+       handle_cgi_reply(req);
+       err = 0;
+
+out:
+       kfree(envstr);
+       kfree(command);
+
+       return err;
+}
+
+void start_external_cgi (tux_req_t *req)
+{
+       int pid;
+
+repeat:
+       pid = kernel_thread(exec_external_cgi, (void*) req, SIGCHLD);
+       if (pid == -1)
+               return;
+       if (pid < 0) {
+               printk(KERN_INFO "TUX: Could not fork external CGI process due to %d, retrying!\n", pid);
+               current->state = TASK_UNINTERRUPTIBLE;
+               schedule_timeout(HZ);
+               goto repeat;
+       }
+}
+
+int query_extcgi (tux_req_t *req)
+{
+       clear_keepalive(req);
+       start_external_cgi(req);
+       return -1;
+}
+
+#define EXTCGI_INVALID_HEADER \
+       "HTTP/1.1 503 Service Unavailable\r\n" \
+       "Content-Length: 23\r\n\r\n"
+
+#define EXTCGI_INVALID_BODY \
+       "TUX: invalid CGI reply."
+
+#define EXTCGI_INVALID EXTCGI_INVALID_HEADER EXTCGI_INVALID_BODY
+
diff --git a/net/tux/gzip.c b/net/tux/gzip.c
new file mode 100644 (file)
index 0000000..5476dff
--- /dev/null
@@ -0,0 +1,40 @@
+/*     $Id: zlib.h,v 1.2 1997/12/23 10:47:44 paulus Exp $      */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/zlib.h>
+#include <net/tux.h>
+
+#define STREAM_END_SPACE 12
+
+int tux_gzip_compress (tux_req_t *req, unsigned char *data_in, unsigned char *data_out, __u32 *in_len, __u32 *out_len)
+{
+       z_stream *s = &req->ti->gzip_state;
+       int ret, left;
+
+       down(&req->ti->gzip_sem);
+       if (zlib_deflateReset(s) != Z_OK)
+               BUG();
+
+       s->next_in = data_in;
+       s->next_out = data_out;
+       s->avail_in = *in_len;
+       s->avail_out = *out_len;
+
+       Dprintk("calling zlib_deflate with avail_in %d, avail_out %d\n", s->avail_in, s->avail_out);
+       ret = zlib_deflate(s, Z_FINISH);
+       Dprintk("deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", s->avail_in, s->avail_out, s->total_in, s->total_out);
+
+       if (ret != Z_STREAM_END) {
+               printk("bad: deflate returned with %d! avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", ret, s->avail_in, s->avail_out, s->total_in, s->total_out);
+               BUG();
+       }
+       *in_len = s->avail_in;
+       *out_len = s->avail_out;
+       left = s->avail_in;
+
+       up(&req->ti->gzip_sem);
+
+       return left;
+}
+
diff --git a/net/tux/input.c b/net/tux/input.c
new file mode 100644 (file)
index 0000000..f3e566c
--- /dev/null
@@ -0,0 +1,641 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * input.c: handle requests arriving on accepted connections
+ */
+
+#include <net/tux.h>
+#include <linux/kmod.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+void zap_request (tux_req_t *req, int cachemiss)
+{
+       if (!req->error)
+               TUX_BUG();
+       if (req->error == TUX_ERROR_CONN_TIMEOUT) {
+               if (req->proto->request_timeout) {
+                       clear_keepalive(req);
+                       req->proto->request_timeout(req, cachemiss);
+               } else {
+                       clear_keepalive(req);
+                       if (!cachemiss)
+                               flush_request(req, 0);
+                       else {
+                               add_tux_atom(req, flush_request);
+                               add_req_to_workqueue(req);
+                       }
+               }
+               return;
+       }
+
+       if (!cachemiss && (req->error == TUX_ERROR_CONN_CLOSE)) {
+               /*
+                * Zap connection as fast as possible, there is
+                * no valid client connection anymore:
+                */
+               clear_keepalive(req);
+               flush_request(req, 0);
+       } else {
+               if (req->error == TUX_ERROR_CONN_CLOSE) {
+                       clear_keepalive(req);
+                       add_tux_atom(req, flush_request);
+               } else
+                       /*
+                        * Potentially redirect to the secondary server:
+                        */
+                       add_tux_atom(req, redirect_request);
+               add_req_to_workqueue(req);
+       }
+}
+
+void __switch_docroot(tux_req_t *req)
+{
+       if (!req->docroot_dentry || !req->docroot_mnt)
+               TUX_BUG();
+       set_fs_root(current->fs, req->docroot_mnt, req->docroot_dentry);
+}
+
+struct dentry * __tux_lookup (tux_req_t *req, const char *filename,
+                        struct nameidata *base, struct vfsmount **mnt)
+{
+       int err;
+
+       err = path_walk(filename, base);
+       if (err) {
+               Dprintk("path_walk() returned with %d!\n", err);
+               return ERR_PTR(err);
+       }
+       if (*mnt)
+               TUX_BUG();
+       *mnt = base->mnt;
+
+       return base->dentry;
+}
+
+int tux_permission (struct inode *inode)
+{
+       umode_t mode;
+       int err;
+
+       mode = inode->i_mode;
+       Dprintk("URL inode mode: %08x.\n", mode);
+
+       if (mode & tux_mode_forbidden)
+               return -2;
+       /*
+        * at least one bit in the 'allowed' set has to
+        * be present to allow access.
+        */
+       if (!(mode & tux_mode_allowed))
+               return -3;
+       err = permission(inode,MAY_READ,NULL);
+       return err;
+}
+
+struct dentry * tux_lookup (tux_req_t *req, const char *filename,
+                       const unsigned int flag, struct vfsmount **mnt)
+{
+       struct dentry *dentry;
+       struct nameidata base;
+
+       Dprintk("tux_lookup(%p, %s, %d, virtual: %d, host: %s (%d).)\n", req, filename, flag, req->virtual, req->host, req->host_len);
+
+       base.flags = LOOKUP_FOLLOW|flag;
+       base.last_type = LAST_ROOT;
+       if (req->objectname[0] == '/') {
+               base.dentry = dget(req->docroot_dentry);
+               base.mnt = mntget(req->docroot_mnt);
+       } else {
+               if (!req->cwd_dentry) {
+                       req->cwd_dentry = dget(req->docroot_dentry);
+                       req->cwd_mnt = mntget(req->docroot_mnt);
+               }
+               base.dentry = req->cwd_dentry;
+               dget(base.dentry);
+               base.mnt = mntget(req->cwd_mnt);
+       }
+
+       switch_docroot(req);
+       dentry = __tux_lookup (req, filename, &base, mnt);
+
+       Dprintk("looked up {%s} == dentry %p.\n", filename, dentry);
+
+       if (dentry && !IS_ERR(dentry) && !dentry->d_inode)
+               TUX_BUG();
+       return dentry;
+}
+
+int lookup_object (tux_req_t *req, const unsigned int flag)
+{
+       struct vfsmount *mnt = NULL;
+       struct dentry *dentry = NULL;
+       int perm;
+
+       dentry = tux_lookup(req, req->objectname, flag, &mnt);
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO)
+                       goto cachemiss;
+               goto abort;
+       }
+       perm = tux_permission(dentry->d_inode);
+       /*
+        * Only regular files allowed.
+        */
+       if ((perm < 0) || !S_ISREG(dentry->d_inode->i_mode)) {
+               req->status = 403;
+               goto abort;
+       }
+       req->total_file_len = dentry->d_inode->i_size;
+out:
+       install_req_dentry(req, dentry, mnt);
+       return 0;
+cachemiss:
+       return 1;
+abort:
+       if (dentry) {
+               if (!IS_ERR(dentry))
+                       dput(dentry);
+               dentry = NULL;
+       }
+       if (mnt) {
+               if (!IS_ERR(mnt))
+                       mntput(mnt);
+               mnt = NULL;
+       }
+       req_err(req);
+       goto out;
+}
+
+void install_req_dentry (tux_req_t *req, struct dentry *dentry, struct vfsmount *mnt)
+{
+       if (req->dentry)
+               TUX_BUG();
+       req->dentry = dentry;
+       if (req->mnt)
+               TUX_BUG();
+       req->mnt = mnt;
+       if (req->in_file.f_dentry)
+               TUX_BUG();
+       if (dentry)
+               open_private_file(&req->in_file, dentry, FMODE_READ);
+}
+
+void release_req_dentry (tux_req_t *req)
+{
+       if (!req->dentry) {
+               if (req->in_file.f_dentry)
+                       TUX_BUG();
+               return;
+       }
+       if (req->in_file.f_op && req->in_file.f_op->release)
+               req->in_file.f_op->release(req->dentry->d_inode, &req->in_file);
+       memset(&req->in_file, 0, sizeof(req->in_file));
+
+       dput(req->dentry);
+       req->dentry = NULL;
+       mntput(req->mnt);
+       req->mnt = NULL;
+}
+
+int __connection_too_fast (tux_req_t *req)
+{
+       unsigned long curr_bw, delta, bytes;
+
+       bytes = req->total_bytes + req->bytes_sent;
+       if (!bytes)
+               return 1;
+
+       delta = jiffies - req->first_timestamp;
+       if (!delta)
+               delta++;
+       curr_bw = bytes * HZ / delta;
+
+       if (curr_bw > tux_max_output_bandwidth)
+               return 2;
+       return 0;
+}
+
+void unidle_req (tux_req_t *req)
+{
+       threadinfo_t *ti = req->ti;
+
+       Dprintk("UNIDLE req %p <%p> (sock %p, sk %p) (keepalive: %d, status: %d)\n", req, __builtin_return_address(0), req->sock, req->sock->sk, req->keep_alive, req->status);
+       spin_lock_irq(&ti->work_lock);
+       if (req->magic != TUX_MAGIC)
+               TUX_BUG();
+       if (!test_and_clear_bit(0, &req->idle_input)) {
+               Dprintk("unidling %p, wasnt idle!\n", req);
+               if (list_empty(&req->work))
+                       TUX_BUG();
+               list_del(&req->work);
+               DEBUG_DEL_LIST(&req->work);
+               DEC_STAT(nr_work_pending);
+       } else {
+               del_keepalive_timer(req);
+               DEC_STAT(nr_idle_input_pending);
+               Dprintk("unidled %p.\n", req);
+       }
+       if (req->idle_input)
+               TUX_BUG();
+       spin_unlock_irq(&ti->work_lock);
+}
+
+#define GOTO_INCOMPLETE do { Dprintk("incomplete at %s:%d.\n", __FILE__, __LINE__); goto incomplete; } while (0)
+#define GOTO_REDIRECT do { TDprintk("redirect at %s:%d.\n", __FILE__, __LINE__); goto redirect; } while (0)
+#define GOTO_REDIRECT_NONIDLE do { TDprintk("redirect at %s:%d.\n", __FILE__, __LINE__); goto redirect_nonidle; } while (0)
+
+static int read_request (struct socket *sock, char *buf, int max_size)
+{
+       mm_segment_t oldmm;
+       struct kiocb iocb;
+       struct msghdr msg;
+       struct iovec iov;
+
+       int len;
+
+       msg.msg_name     = 0;
+       msg.msg_namelen  = 0;
+       msg.msg_iov      = &iov;
+       msg.msg_iovlen   = 1;
+       msg.msg_control  = NULL;
+       msg.msg_controllen = 0;
+       msg.msg_flags    = 0;
+       
+       msg.msg_iov->iov_base = buf;
+       msg.msg_iov->iov_len  = max_size;
+       
+       oldmm = get_fs(); set_fs(KERNEL_DS);
+
+read_again:
+       init_sync_kiocb(&iocb, NULL);
+       len = sock->sk->sk_prot->recvmsg(&iocb, sock->sk, &msg, max_size,
+                                               MSG_DONTWAIT, MSG_PEEK, NULL);
+       if (-EIOCBQUEUED == len)
+               len = wait_on_sync_kiocb(&iocb);
+
+       /*
+        * We must not get a signal inbetween
+        */
+       if ((len == -EAGAIN) || (len == -ERESTARTSYS)) {
+               if (!signal_pending(current)) {
+                       len = 0;
+                       goto out;
+               }
+               flush_all_signals();
+               goto read_again;
+       }
+out:
+       set_fs(oldmm);
+       return len;
+}
+
+/*
+ * We inline URG data so it's at the head of the normal receive queue.
+ */
+static int zap_urg_data (struct socket *sock)
+{
+       mm_segment_t oldmm;
+       struct msghdr msg;
+       struct iovec iov;
+       struct kiocb iocb;
+       int len;
+       char buf[10];
+
+       oldmm = get_fs(); set_fs(KERNEL_DS);
+
+       msg.msg_name            = 0;
+       msg.msg_namelen         = 0;
+       msg.msg_iov             = &iov;
+       msg.msg_iovlen          = 1;
+       msg.msg_control         = NULL;
+       msg.msg_controllen      = 0;
+       msg.msg_flags           = 0;
+       
+       msg.msg_iov->iov_base = buf;
+       msg.msg_iov->iov_len  = 2;
+
+read_again:
+       init_sync_kiocb(&iocb, NULL);
+       len = sock->sk->sk_prot->recvmsg(&iocb, sock->sk, &msg, 2,
+                                               MSG_DONTWAIT, 0, NULL);
+       if (-EIOCBQUEUED == len)
+               len = wait_on_sync_kiocb(&iocb);
+       Dprintk("recvmsg(MSG_OOB) returned %d.\n", len);
+
+       /*
+        * We must not get a signal inbetween
+        */
+       if ((len == -EAGAIN) || (len == -ERESTARTSYS)) {
+               if (!signal_pending(current)) {
+                       len = 0;
+                       goto out;
+               }
+               flush_all_signals();
+               goto read_again;
+       }
+out:
+       set_fs(oldmm);
+
+       Dprintk("in out:.. and will return %d.!\n", len);
+
+       return len;
+}
+
+void trunc_headers (tux_req_t *req)
+{
+       struct sock *sk = req->sock->sk;
+       int len, addr_len = 0;
+       struct kiocb iocb;
+
+       if (!req->parsed_len)
+               TUX_BUG();
+repeat_trunc:
+       init_sync_kiocb(&iocb, NULL);
+       len = sk->sk_prot->recvmsg(&iocb, sk, NULL, req->parsed_len, 1, MSG_TRUNC, &addr_len);
+       if (-EIOCBQUEUED == len)
+               len = wait_on_sync_kiocb(&iocb);
+       if ((len == -ERESTARTSYS) || (len == -EAGAIN)) {
+               flush_all_signals();
+               goto repeat_trunc;
+       }
+       Dprintk("truncated (TRUNC) %d bytes at %p. (wanted: %d.)\n", len, __builtin_return_address(0), req->parsed_len);
+
+
+
+       req->parsed_len = 0;
+}
+
+void print_req (tux_req_t *req)
+{
+       struct sock *sk;
+
+       printk("PRINT req %p <%p>, sock %p\n",
+                       req, __builtin_return_address(0), req->sock);
+       printk("... idx: %d\n", req->atom_idx);
+       if (req->sock) {
+               sk = req->sock->sk;
+               printk("... sock %p, sk %p, sk->state: %d, sk->err: %d\n", req->sock, sk, sk->sk_state, sk->sk_err);
+               printk("... write_queue: %d, receive_queue: %d, error_queue: %d, keepalive: %d, status: %d\n", !skb_queue_empty(&sk->sk_write_queue), !skb_queue_empty(&sk->sk_receive_queue), !skb_queue_empty(&sk->sk_error_queue), req->keep_alive, req->status);
+               printk("...tp->send_head: %p\n", sk->sk_send_head);
+               printk("...tp->snd_una: %08x\n", tcp_sk(sk)->snd_una);
+               printk("...tp->snd_nxt: %08x\n", tcp_sk(sk)->snd_nxt);
+               printk("...tp->packets_out: %08x\n", tcp_sk(sk)->packets_out);
+       }
+       printk("... meth:{%s}, uri:{%s}, query:{%s}, ver:{%s}\n", req->method_str ? req->method_str : "<null>", req->uri_str ? req->uri_str : "<null>", req->query_str ? req->query_str : "<null>", req->version_str ? req->version_str : "<null>");
+       printk("... post_data:{%s}(%d).\n", req->post_data_str, req->post_data_len);
+       printk("... headers: {%s}\n", req->headers);
+}
+/* 
+ * parse_request() reads all available TCP/IP data and prepares
+ * the request if the TUX request is complete. (we can get TUX
+ * requests in several packets.) Invalid requests are redirected
+ * to the secondary server.
+ */
+
+void parse_request (tux_req_t *req, int cachemiss)
+{
+       int len, parsed_len;
+       struct sock *sk = req->sock->sk;
+       struct tcp_opt *tp = tcp_sk(sk);
+       int was_keepalive = req->keep_alive;
+
+       if (req->magic != TUX_MAGIC)
+               TUX_BUG();
+
+       SET_TIMESTAMP(req->parse_timestamp);
+
+       spin_lock_irq(&req->ti->work_lock);
+       add_keepalive_timer(req);
+       if (test_and_set_bit(0, &req->idle_input))
+               TUX_BUG();
+       INC_STAT(nr_idle_input_pending);
+       spin_unlock_irq(&req->ti->work_lock);
+
+       Dprintk("idled request %p.\n", req);
+
+restart:
+
+       if (tp->urg_data && !(tp->urg_data & TCP_URG_READ)) {
+               len = zap_urg_data(req->sock);
+               if (tp->urg_data && !(tp->urg_data & TCP_URG_READ)) {
+                       req->error = TUX_ERROR_CONN_CLOSE;
+                       goto redirect_error;
+               }
+       }
+
+       INC_STAT(input_slowpath);
+
+       if (!req->headers)
+               req->headers = tux_kmalloc(tux_max_header_len);
+
+       /* First, read the data */
+       len = read_request(req->sock, (char *)req->headers, tux_max_header_len-1);
+       if (len < 0) {
+               req->error = TUX_ERROR_CONN_CLOSE;
+               goto redirect_error;
+       }
+       if (!len)
+               GOTO_INCOMPLETE;
+
+       /*
+        * Make it a zero-delimited string to automatically get
+        * protection against various buffer overflow situations.
+        * Then pass it to the TUX application protocol stack.
+        */
+       ((char *)req->headers)[len] = 0;
+       req->headers_len = len;
+
+       parsed_len = req->proto->parse_message(req, len);
+
+       /*
+        * Is the request fully read? (or is there any error)
+        */
+       if (parsed_len < 0)
+               GOTO_REDIRECT;
+       if (!parsed_len) {
+               /*
+                * Push pending ACK which was delayed due to the
+                * pingpong optimization:
+                */
+               if (was_keepalive) {
+                       lock_sock(sk);
+                       tp->ack.pingpong = 0;
+                       tp->ack.pending |= TCP_ACK_PUSHED;
+                       cleanup_rbuf(sk, 1);
+                       release_sock(sk);
+               }
+               if (len >= tux_max_header_len-1)
+                       GOTO_REDIRECT;
+               GOTO_INCOMPLETE;
+       }
+       unidle_req(req);
+
+       tp->nonagle = 2;
+
+       add_req_to_workqueue(req);
+       return;
+
+redirect:
+       TDprintk("req %p will be redirected!\n", req);
+       req_err(req);
+
+redirect_error:
+       unidle_req(req);
+
+       if (len < 0)
+               req->parsed_len = 0;
+       else
+               req->parsed_len = len;
+
+       INC_STAT(parse_static_redirect);
+       if (req->headers)
+               kfree(req->headers);
+       req->headers = NULL;
+       if (req->error)
+               zap_request(req, cachemiss);
+       return;
+
+incomplete:
+       if (req->error)
+               goto redirect_error;
+       if (tp->urg_data && !(tp->urg_data & TCP_URG_READ))
+               goto restart;
+
+       add_tux_atom(req, parse_request);
+       INC_STAT(parse_static_incomplete);
+       tux_push_req(req);
+}
+
+int process_requests (threadinfo_t *ti, tux_req_t **user_req)
+{
+       struct list_head *head, *curr;
+       int count = 0;
+       tux_req_t *req;
+
+       *user_req = NULL;
+
+restart_loop:
+       spin_lock_irq(&ti->work_lock);
+       head = &ti->work_pending;
+       curr = head->next;
+       
+       if (curr != head) {
+               int i;
+
+               req = list_entry(curr, tux_req_t, work);
+               Dprintk("PROCESS req %p <%p>.\n",
+                       req, __builtin_return_address(0));
+               for (i = 0; i < req->atom_idx; i++)
+                       Dprintk("... atom %d: %p\n", i, req->atoms[i]);
+
+               if (req->ti != ti)
+                       TUX_BUG();
+               if (req->magic != TUX_MAGIC)
+                       TUX_BUG();
+
+               if (list_empty(&req->work))
+                       TUX_BUG();
+               list_del(curr);
+               DEBUG_DEL_LIST(&req->work);
+               spin_unlock_irq(&ti->work_lock);
+
+               if (!req->atom_idx) {
+                       if (req->usermode) {
+                               *user_req = req;
+                               return count;
+                       }
+                       /*
+                        * idx == 0 requests are flushed automatically.
+                        */
+                       flush_request(req, 0);
+               } else
+                       tux_schedule_atom(req, 0);
+               count++;
+               goto restart_loop;
+       }
+       spin_unlock_irq(&ti->work_lock);
+
+       return count;
+}
+
+int tux_flush_workqueue (threadinfo_t *ti)
+{
+       struct list_head *head, *curr, *next;
+       tux_req_t *req;
+       int count = 0;
+
+restart:
+       spin_lock_irq(&ti->work_lock);
+       head = &ti->work_pending;
+       curr = head->next;
+
+       if (curr != head) {
+               req = list_entry(curr, tux_req_t, work);
+               next = curr->next;
+               clear_bit(0, &req->idle_input);
+               clear_bit(0, &req->wait_output_space);
+               if (list_empty(&req->work))
+                       TUX_BUG();
+               list_del(curr);
+               DEBUG_DEL_LIST(curr);
+               DEC_STAT(nr_input_pending);
+               spin_unlock_irq(&ti->work_lock);
+#if CONFIG_TUX_DEBUG
+               req->bytes_expected = 0;
+#endif
+               req->in_file.f_pos = 0;
+               req->atom_idx = 0;
+               clear_keepalive(req);
+               req->status = -1;
+               if (req->usermode) {
+                       req->usermode = 0;
+                       req->private = 0;
+               }
+               flush_request(req, 0);
+               count++;
+               goto restart;
+       }
+       spin_unlock_irq(&ti->work_lock);
+
+       return count;
+}
+
+int print_all_requests (threadinfo_t *ti)
+{
+       struct list_head *head, *curr;
+       tux_req_t *req;
+       int count = 0;
+
+       spin_lock_irq(&ti->work_lock);
+       head = &ti->all_requests;
+       curr = head->next;
+
+       while (curr != head) {
+               req = list_entry(curr, tux_req_t, all);
+               curr = curr->next;
+               print_req(req);
+               count++;
+       }
+       spin_unlock_irq(&ti->work_lock);
+
+       return count;
+}
+
diff --git a/net/tux/logger.c b/net/tux/logger.c
new file mode 100644 (file)
index 0000000..5ce80c1
--- /dev/null
@@ -0,0 +1,855 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * Cleaned up logger output for Alpha.
+ * -- Phil Ezolt (Phillip.Ezolt@compaq.com) & Bill Carr (wcarr92@yahoo.com)
+ *
+ * logger.c: log requests finished by TUX.
+ */
+
+#define __KERNEL_SYSCALLS__
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
+static unsigned int log_head, log_tail;
+static char * log_buffer = NULL;
+static DECLARE_WAIT_QUEUE_HEAD(log_wait);
+static DECLARE_WAIT_QUEUE_HEAD(log_full);
+static int logger_pid = 0;
+
+/*
+ * High-speed TUX logging architecture:
+ *
+ * All fast threads share a common log-ringbuffer. (default size 1MB)
+ * Log entries are binary and are padded to be cacheline aligned, this
+ * ensures that there is no cache-pingpong between fast threads.
+ *
+ * The logger thread writes out pending log entries within 1 second
+ * (buffer-cache writes data out within 5 seconds). The logger thread
+ * gets activated once we have more than 25% of the log ringbuffer
+ * filled - or the 1 second log timeout expires. Fast threads block
+ * if if more than 95% of the ringbuffer is filled and unblock only
+ * if used logbuffer space drops below 90%.
+ *
+ * This architecture guarantees that 1) logging is reliable (no
+ * log entry is ever lost), 2) timely (touches disk within 6 seconds),
+ * 3) in the log-contention case the saturation behavior is still
+ * write-clustered, but 4) if the logger thread can keep up then
+ * the coupling is completely asynchron and parallel.
+ *
+ * The binary log format gives us about 50% saved IO/memory bandwith
+ * and 50% less on-disk used log space than the traditional W3C ASCII
+ * format.
+ *
+ * (We might switch to raw IO though to write the logfile.)
+ */
+
+#define SOFT_LIMIT             (LOG_LEN*25/100)
+#define HARD_LIMIT             (LOG_LEN*95/100)
+#define HARD_RELAX_LIMIT       (LOG_LEN*90/100)
+
+unsigned int tux_logentry_align_order = 5;
+
+#if SMP_CACHE_BYTES == 8
+# define TUX_LOGENTRY_ALIGN 3
+#else
+#if SMP_CACHE_BYTES == 16
+# define TUX_LOGENTRY_ALIGN 4
+#else
+#if SMP_CACHE_BYTES == 32
+# define TUX_LOGENTRY_ALIGN 5
+#else
+#if SMP_CACHE_BYTES == 64
+# define TUX_LOGENTRY_ALIGN 6
+#else
+#if SMP_CACHE_BYTES == 128
+# define TUX_LOGENTRY_ALIGN 7
+#else
+#if SMP_CACHE_BYTES == 256
+# define TUX_LOGENTRY_ALIGN 8
+#else
+#error Add entry!
+#endif
+#endif
+#endif
+#endif
+#endif
+#endif
+
+#define ROUND_UP(x) (((((x)-1) >> TUX_LOGENTRY_ALIGN) + 1) \
+                                       << TUX_LOGENTRY_ALIGN)
+
+static void __throttle_logging (void)
+{
+       DECLARE_WAITQUEUE(wait, current);
+       int pending;
+
+       add_wait_queue(&log_full, &wait);
+       for (;;) {
+               static unsigned long last_warning = 0;
+
+               if (jiffies - last_warning > 10*HZ) {
+                       last_warning = jiffies;
+                       printk(KERN_NOTICE "TUX: log buffer overflow, have to throttle TUX thread!\n");
+               }
+
+               current->state = TASK_INTERRUPTIBLE;
+
+               spin_lock(&log_lock);
+               pending = log_head-log_tail;
+               spin_unlock(&log_lock);
+
+               if ((pending % LOG_LEN) < HARD_LIMIT)
+                       break;
+
+               schedule();
+       }
+       current->state = TASK_RUNNING;
+       remove_wait_queue(&log_full, &wait);
+}
+
+#if CONFIG_TUX_DEBUG
+#define CHECK_LOGPTR(ptr) \
+do { \
+       if ((ptr < log_buffer) || (ptr > log_buffer + LOG_LEN)) { \
+               printk(KERN_ERR "TUX: ouch: log ptr %p > %p + %ld!\n", \
+                       ptr, log_buffer, LOG_LEN); \
+               TUX_BUG(); \
+       } \
+} while (0)
+#else
+#define CHECK_LOGPTR(ptr) do { } while (0)
+#endif
+
+void __log_request (tux_req_t *req)
+{
+       char *str, *next;
+       const char *uri_str;
+       unsigned int inc, len, uri_len, pending, next_head, def_vhost_len = 0;
+       unsigned long flags;
+
+       if (req->proto->pre_log)
+               req->proto->pre_log(req);
+       /*
+        * Log the reply status (success, or type of failure)
+        */
+       if (!tux_log_incomplete && (!req->status || (req->bytes_sent == -1))) {
+               
+               Dprintk("not logging req %p: {%s} [%d/%d]\n", req, req->uri_str, req->status, req->bytes_sent);
+               return;
+       }
+       Dprintk("uri: {%s} [%d]\n", req->uri_str, req->uri_len);
+
+#define NO_URI "<none>"
+       if (req->uri_len) {
+               uri_len = req->uri_len;
+               uri_str = req->uri_str;
+       } else {
+               uri_str = NO_URI;
+               uri_len = sizeof(NO_URI)-1;
+       }
+       len = uri_len + 1;
+
+       if (req->virtual) {
+               if (req->host_len)
+                       len += req->host_len;
+               else {
+                       def_vhost_len = strlen(tux_default_vhost);
+                       len += def_vhost_len;
+               }
+       }
+
+       Dprintk("method_str: {%s} [%d]\n", req->method_str, req->method_len);
+       len += req->method_len + 1;
+
+       Dprintk("version_str: {%s} [%d]\n", req->version_str, req->version_len);
+       len += req->version_len + 1;
+
+#if CONFIG_TUX_EXTENDED_LOG
+       Dprintk("user_agent_str: {%s} [%d]\n", req->user_agent_str, req->user_agent_len);
+       len += req->user_agent_len + 1;
+#endif
+       if (tux_referer_logging) {
+               Dprintk("referer_str: {%s} [%d]\n", req->referer_str, req->referer_len);
+               len += req->referer_len;
+       }
+       len++;
+
+       inc = 5*sizeof(u32) + len;
+#if CONFIG_TUX_EXTENDED_LOG
+       inc += 7*sizeof(u32);
+#endif
+
+       spin_lock_irqsave(&log_lock, flags);
+
+       next_head = ROUND_UP(log_head + inc);
+
+       if (next_head < LOG_LEN) {
+               str = log_buffer + log_head;
+               if (str > log_buffer + LOG_LEN)
+                       TUX_BUG();
+               log_head = next_head;
+       } else {
+               if (log_head < LOG_LEN)
+                       memset(log_buffer+log_head, 0, LOG_LEN-log_head);
+               str = log_buffer;
+               log_head = ROUND_UP(inc);
+       }
+
+       if (str < log_buffer || str+inc >= log_buffer+LOG_LEN)
+               TUX_BUG();
+
+       /*
+        * Log record signature - this makes finding the next entry
+        * easier (since record length is variable), and makes the
+        * binary logfile more robust against potential data corruption
+        * and other damage. The signature also servers as a log format
+        * version identifier.
+        */
+#if CONFIG_TUX_EXTENDED_LOG
+       *(u32 *)str = 0x2223beef;
+#else
+       *(u32 *)str = 0x1112beef;
+#endif
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+
+       *(u32 *)str = 0;
+       /*
+        * Log the client IP address:
+        */
+       if (tux_ip_logging)
+               *(u32 *)str = req->client_addr;
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+
+#if CONFIG_TUX_EXTENDED_LOG
+       /*
+        * Log the client port number:
+        */
+       *(u32 *)str = 0;
+       if (tux_ip_logging)
+               *(u32 *)str = req->client_port;
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+#endif
+
+       /*
+        * Log the request timestamp, in units of 'seconds since 1970'.
+        */
+       *(u32 *)str = CURRENT_TIME.tv_sec;
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+
+#if CONFIG_TUX_EXTENDED_LOG
+       *(u32 *)str = req->accept_timestamp; str += sizeof(u32);
+       *(u32 *)str = req->parse_timestamp; str += sizeof(u32);
+       *(u32 *)str = req->output_timestamp; str += sizeof(u32);
+       *(u32 *)str = req->flush_timestamp; str += sizeof(u32);
+       *(u32 *)str = req->had_cachemiss; str += sizeof(u32);
+       *(u32 *)str = req->keep_alive; str += sizeof(u32);
+#endif
+       /*
+        * Log the requested file size (in fact, log actual bytes sent.)
+        */
+       *(u32 *)str = req->bytes_sent;
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+
+       *(u32 *)str = req->status;
+       str += sizeof(u32);
+       CHECK_LOGPTR(str);
+
+       /*
+        * Zero-terminated method, (base) URI, query and version string.
+        */
+       if (req->method_len) {
+               memcpy(str, req->method_str, req->method_len);
+               str += req->method_len;
+               CHECK_LOGPTR(str);
+       }
+       *str++ = 0;
+
+       if (req->virtual) {
+               if (req->host_len) {
+                       memcpy(str, req->host, req->host_len);
+                       str += req->host_len;
+               } else {
+                       memcpy(str, tux_default_vhost, def_vhost_len);
+                       str += def_vhost_len;
+               }
+               CHECK_LOGPTR(str);
+       }
+
+       memcpy(str, uri_str, uri_len);
+       str += uri_len;
+       *str++ = 0;
+
+       CHECK_LOGPTR(str);
+
+       if (req->version_len) {
+               memcpy(str, req->version_str, req->version_len);
+               str += req->version_len;
+               CHECK_LOGPTR(str);
+       }
+       *str++ = 0;
+#if CONFIG_TUX_EXTENDED_LOG
+       if (req->user_agent_len) {
+               memcpy(str, req->user_agent_str, req->user_agent_len);
+               str += req->user_agent_len;
+               CHECK_LOGPTR(str);
+       }
+       *str++ = 0;
+#endif
+       CHECK_LOGPTR(str);
+
+       if (tux_referer_logging && req->referer_len) {
+               memcpy(str, req->referer_str, req->referer_len);
+               str += req->referer_len;
+               CHECK_LOGPTR(str);
+       }
+       *str++ = 0;
+       CHECK_LOGPTR(str);
+       /*
+        * pad with spaces to next cacheline, with an ending newline.
+        * (not needed for the user-space log utility, but results in
+        * a more readable binary log file, and reduces the amount
+        * of cache pingpong.)
+        */
+       next = (char *)ROUND_UP((unsigned long)str);
+
+       CHECK_LOGPTR(next);
+       len = next-str;
+       memset(str, ' ', len);
+
+       pending = (log_head-log_tail) % LOG_LEN;
+       spin_unlock_irqrestore(&log_lock, flags);
+
+       if (pending >= SOFT_LIMIT)
+               wake_up(&log_wait);
+
+       if (pending >= HARD_LIMIT)
+               __throttle_logging();
+}
+
+void tux_push_pending (struct sock *sk)
+{
+       struct tcp_opt *tp = tcp_sk(sk);
+
+       Dprintk("pushing pending frames on sock %p.\n", sk);
+       lock_sock(sk);
+       if ((sk->sk_state == TCP_ESTABLISHED) && !sk->sk_err) {
+               tp->ack.pingpong = tux_ack_pingpong;
+               tp->nonagle = 1;
+               __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 0), TCP_NAGLE_OFF);
+       }
+       release_sock(sk);
+}
+
+inline void tux_push_req (tux_req_t *req)
+{
+       if (req->sock)
+               tux_push_pending(req->sock->sk);
+       if (req->data_sock)
+               tux_push_pending(req->data_sock->sk);
+}
+
+void __put_data_sock (tux_req_t *req)
+{
+       unlink_tux_data_socket(req);
+       if (req->data_sock->file)
+               fput(req->data_sock->file);
+       else
+               sock_release(req->data_sock);
+       req->data_sock = NULL;
+}
+
+/* open-coded sys_close */
+
+long tux_close(unsigned int fd)
+{
+       struct file * filp;
+       struct files_struct *files = current->files;
+
+       spin_lock(&files->file_lock);
+       if (fd >= files->max_fds)
+               goto out_unlock;
+       filp = files->fd[fd];
+       if (!filp)
+               goto out_unlock;
+       files->fd[fd] = NULL;
+       FD_CLR(fd, files->close_on_exec);
+       /* __put_unused_fd(files, fd); */
+       __FD_CLR(fd, files->open_fds);
+       if (fd < files->next_fd)
+               files->next_fd = fd;
+       spin_unlock(&files->file_lock);
+       return filp_close(filp, files);
+
+out_unlock:
+       spin_unlock(&files->file_lock);
+       return -EBADF;
+}
+
+void flush_request (tux_req_t *req, int cachemiss)
+{
+       struct socket *sock;
+       struct sock *sk;
+       int keep_alive;
+
+       if (cachemiss)
+               TUX_BUG();
+       __set_task_state(current, TASK_RUNNING);
+
+       if (req->magic != TUX_MAGIC)
+               TUX_BUG();
+       if (req->ti->thread != current)
+               TUX_BUG();
+#if CONFIG_TUX_DEBUG
+       if (req->bytes_expected && (req->bytes_sent != req->bytes_expected)) {
+               printk("hm, bytes_expected: %d != bytes_sent: %d!\n",
+                       req->bytes_expected, req->bytes_sent);
+               TUX_BUG();
+       }
+#endif
+       SET_TIMESTAMP(req->flush_timestamp);
+
+       log_request(req);
+       sock = req->sock;
+       sk = NULL;
+       if (sock)
+               sk = sock->sk;
+       Dprintk("FLUSHING req %p <%p> (sock %p, sk %p) (keepalive: %d, status: %d)\n", req, __builtin_return_address(0), sock, sk, req->keep_alive, req->status);
+       if (req->in_file.f_pos)
+               /*TUX_BUG()*/;
+       release_req_dentry(req);
+       req->private = 0;
+
+       if (req->docroot_dentry) {
+               dput(req->docroot_dentry);
+               req->docroot_dentry = NULL;
+               if (!req->docroot_mnt)
+                       TUX_BUG();
+       }
+       if (req->docroot_mnt) {
+               mntput(req->docroot_mnt);
+               req->docroot_mnt = NULL;
+       }
+
+       req->offset_start = 0;
+       req->offset_end = 0;
+       req->output_len = 0;
+       req->total_file_len = 0;
+       req->lendigits = 0;
+       req->mtime = 0;
+       req->etaglen = 0;
+       req->etag[0] = 0;
+       req->ftp_command = 0;
+
+       if (req->postponed)
+               TUX_BUG();
+       if (test_bit(0, &req->idle_input))
+               TUX_BUG();
+       if (test_bit(0, &req->wait_output_space))
+               TUX_BUG();
+       if (req->parsed_len)
+               trunc_headers(req);
+       if (req->parsed_len)
+               TUX_BUG();
+       req->attr = NULL;
+       req->usermode = 0;
+       req->usermodule_idx = 0;
+       req->atom_idx = 0;
+       if (req->module_dentry) {
+               dput(req->module_dentry);
+               req->module_dentry = NULL;
+       }
+       if (req->headers)
+               kfree(req->headers);
+       req->headers = NULL;
+       req->headers_len = 0;
+
+       req->method = METHOD_NONE;
+       req->method_len = 0;
+       req->method_str = NULL;
+       req->version = 0;
+       req->version_str = NULL;
+       req->version_len = 0;
+
+       req->uri_str = NULL;
+       req->uri_len = 0;
+
+       req->objectname[0] = 0;
+       req->objectname_len = 0;
+
+       req->query_str = NULL;
+       req->query_len = 0;
+
+       req->cookies_str = NULL;
+       req->cookies_len = 0;
+       req->parse_cookies = 0;
+
+       req->contentlen_str = NULL;
+       req->contentlen_len = 0;
+       req->content_len = 0;
+
+       req->user_agent_str = NULL;
+       req->user_agent_len = 0;
+
+       req->may_send_gzip = 0;
+       req->content_gzipped = 0;
+
+       req->content_type_str = NULL;
+       req->content_type_len = 0;
+
+       req->accept_str = NULL;
+       req->accept_len = 0;
+
+       req->accept_charset_str = NULL;
+       req->accept_charset_len = 0;
+
+       req->accept_encoding_str = NULL;
+       req->accept_encoding_len = 0;
+
+       req->accept_language_str = NULL;
+       req->accept_language_len = 0;
+
+       req->cache_control_str = NULL;
+       req->cache_control_len = 0;
+
+       req->if_modified_since_str = NULL;
+       req->if_modified_since_len = 0;
+
+       req->if_none_match_str = NULL;
+       req->if_none_match_len = 0;
+
+       req->if_range_str = NULL;
+       req->if_range_len = 0;
+
+       req->negotiate_str = NULL;
+       req->negotiate_len = 0;
+
+       req->pragma_str = NULL;
+       req->pragma_len = 0;
+
+       req->referer_str = NULL;
+       req->referer_len = 0;
+
+       req->post_data_str = NULL;
+       req->post_data_len = 0;
+
+       SET_TIMESTAMP(req->accept_timestamp);
+#if CONFIG_TUX_EXTENDED_LOG
+       req->parse_timestamp = 0;
+       req->output_timestamp = 0;
+       req->flush_timestamp = 0;
+#endif
+       req->status = 0;
+
+       req->total_bytes += req->bytes_sent;
+       req->bytes_sent = 0;
+#if CONFIG_TUX_DEBUG
+       req->bytes_expected = 0;
+#endif
+       req->body_len = 0;
+       keep_alive = req->keep_alive;
+       clear_keepalive(req);
+       req->had_cachemiss = 0;
+       // first_timestamp and total_bytes is kept!
+       req->event = 0;
+       req->lookup_dir = 0;
+       req->lookup_404 = 0;
+
+       req->error = 0;
+       req->user_error = 0;
+
+       if (req->abuf.page)
+               __free_page(req->abuf.page);
+       memset(&req->abuf, 0, sizeof(req->abuf));
+
+       if (sk && keep_alive) {
+               add_tux_atom(req, parse_request);
+               if (skb_queue_empty(&sk->sk_receive_queue)) {
+                       spin_lock_irq(&req->ti->work_lock);
+                       add_keepalive_timer(req);
+                       if (test_and_set_bit(0, &req->idle_input))
+                               TUX_BUG();
+                       /*
+                        * Avoid the race with the event callback:
+                        */
+                       if (skb_queue_empty(&sk->sk_receive_queue) ||
+                                  !test_and_clear_bit(0, &req->idle_input)) {
+                               INC_STAT(nr_idle_input_pending);
+                               spin_unlock_irq(&req->ti->work_lock);
+                               tux_push_req(req);
+                               goto out;
+                       }
+                       del_keepalive_timer(req);
+                       spin_unlock_irq(&req->ti->work_lock);
+               }
+               Dprintk("KEEPALIVE PENDING req %p <%p> (sock %p, sk %p) (keepalive: %d, status: %d)\n", req, __builtin_return_address(0), req->sock, req->sock->sk, req->keep_alive, req->status);
+               add_req_to_workqueue(req);
+               INC_STAT(nr_keepalive_optimized);
+               goto out;
+       }
+
+       del_timer_sync(&req->keepalive_timer);
+       del_timer_sync(&req->output_timer);
+
+       if (timer_pending(&req->keepalive_timer))
+               TUX_BUG();
+       if (timer_pending(&req->output_timer))
+               TUX_BUG();
+       if (!list_empty(&req->lru))
+               TUX_BUG();
+       req->nr_keepalives = 0;
+       req->client_addr = 0;
+       req->client_port = 0;
+       req->virtual = 0;
+       req->ftp_offset_start = 0;
+
+       req->host[0] = 0;
+       req->host_len = 0;
+
+       if (req->cwd_dentry) {
+               dput(req->cwd_dentry);
+               req->cwd_dentry = NULL;
+               if (!req->cwd_mnt)
+                       TUX_BUG();
+       }
+       if (req->cwd_mnt) {
+               mntput(req->cwd_mnt);
+               req->cwd_mnt = NULL;
+       }
+       put_data_sock(req);
+       req->prev_pos = 0;
+       req->curroff = 0;
+       req->total = 0;
+       if (req->dirp0) {
+               kfree(req->dirp0);
+               req->dirp0 = NULL;
+       }
+
+       if (sk)
+               unlink_tux_socket(req);
+       req->sock = NULL;
+       /*
+        * Close potential user-space file descriptors.
+        */
+       {
+               int fd = req->fd, ret;
+
+               if (fd != -1) {
+                       req->fd = -1;
+                       ret = tux_close(fd);
+                       if (ret)
+                               TUX_BUG();
+               } else
+                       if (sock)
+                               sock_release(sock);
+       }
+       kfree_req(req);
+out:
+       ;
+}
+
+static int warn_once = 1;
+
+static unsigned int writeout_log (void)
+{
+       unsigned int len, pending, next_log_tail;
+       mm_segment_t oldmm = get_fs();
+       struct file *log_filp;
+       char * str;
+       unsigned int ret;
+
+       if (tux_logging)
+               Dprintk("TUX logger: opening log file {%s}.\n", tux_logfile);
+       log_filp = tux_open_file(tux_logfile, O_CREAT|O_APPEND|O_WRONLY|O_LARGEFILE);
+       if (!log_filp) {
+               if (warn_once) {
+                       printk(KERN_ERR "TUX: could not open log file {%s}!\n",
+                               tux_logfile);
+                       warn_once = 0;
+               }
+               __set_current_state(TASK_INTERRUPTIBLE);
+               schedule_timeout(HZ);
+               return 0;
+       }
+       spin_lock(&log_lock);
+       str = log_buffer + log_tail;
+       if (log_head < log_tail) {
+               len = LOG_LEN-log_tail;
+               next_log_tail = 0;
+       } else {
+               len = log_head-log_tail;
+               next_log_tail = log_head;
+       }
+       if (!len)
+               goto out;
+       spin_unlock(&log_lock);
+
+       set_fs(KERNEL_DS);
+       ret = log_filp->f_op->write(log_filp, str, len, &log_filp->f_pos);
+       set_fs(oldmm);
+
+       if (len != ret) {
+               if (ret == -ENOSPC) {
+                       printk(KERN_ERR "TUX: trying to write TUX logfile %s, but filesystem is full! Lost %d bytes of log data.\n", tux_logfile, len);
+               } else {
+                       printk(KERN_ERR "TUX: log write %d != %d.\n", ret, len);
+                       printk(KERN_ERR "TUX: log_filp: %p, str: %p, len: %d str[len-1]: %d.\n", log_filp, str, len, str[len-1]);
+               }
+               goto out_lock;
+       }
+
+       /*
+        * Sync log data to disk:
+        */
+       if (log_filp->f_op && log_filp->f_op->fsync) {
+               down(&log_filp->f_dentry->d_inode->i_sem);
+               log_filp->f_op->fsync(log_filp, log_filp->f_dentry, 1);
+               up(&log_filp->f_dentry->d_inode->i_sem);
+       }
+
+       /*
+        * Reduce the cache footprint of the logger file - it's
+        * typically write-once.
+        */
+       invalidate_inode_pages(log_filp->f_dentry->d_inode->i_mapping);
+
+out_lock:
+       spin_lock(&log_lock);
+out:
+       log_tail = next_log_tail;
+       pending = (log_head-log_tail) % LOG_LEN;
+       spin_unlock(&log_lock);
+
+       if (pending < HARD_LIMIT)
+               wake_up(&log_full);
+
+       fput(log_filp);
+       return pending;
+}
+
+static DECLARE_WAIT_QUEUE_HEAD(stop_logger_wait);
+static int stop_logger = 0;
+
+static int logger_thread (void *data)
+{
+       DECLARE_WAITQUEUE(wait, current);
+       mm_segment_t oldmm;
+
+       daemonize("TUX logger");
+
+       oldmm = get_fs();
+       set_fs(KERNEL_DS);
+       printk(KERN_NOTICE "TUX: logger thread started.\n");
+#if CONFIG_SMP
+       {
+               cpumask_t log_mask, map;
+
+               mask_to_cpumask(log_cpu_mask, &log_mask);
+               cpus_and(map, cpu_online_map, log_mask);
+               if(!(cpus_empty(map)))
+                       set_cpus_allowed(current, map);
+
+       }
+#endif
+
+
+       spin_lock_irq(&current->sighand->siglock);
+       siginitsetinv(&current->blocked, 0);
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+
+       if (log_buffer)
+               TUX_BUG();
+       log_buffer = vmalloc(LOG_LEN);
+       memset(log_buffer, 0, LOG_LEN);
+       log_head = log_tail = 0;
+
+       current->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
+
+       add_wait_queue(&log_wait, &wait);
+       for (;;) {
+               if (tux_logging)
+                       Dprintk("logger does writeout - stop:%d.\n", stop_logger);
+
+               while (writeout_log() >= SOFT_LIMIT) {
+                       if (stop_logger)
+                               break;
+               }
+               if (stop_logger)
+                       break;
+                       /* nothing */;
+
+               if (tux_logging)
+                       Dprintk("logger does sleep - stop:%d.\n", stop_logger);
+               __set_current_state(TASK_INTERRUPTIBLE);
+               if (log_head != log_tail) {
+                       __set_current_state(TASK_RUNNING);
+                       continue;
+               }
+               schedule_timeout(HZ);
+               if (tux_logging)
+                       Dprintk("logger back from sleep - stop:%d.\n", stop_logger);
+               if (signal_pending(current))
+                       flush_all_signals();
+       }
+       remove_wait_queue(&log_wait, &wait);
+
+       vfree(log_buffer);
+       log_buffer = NULL;
+       stop_logger = 0;
+       wake_up(&stop_logger_wait);
+
+       set_fs(oldmm);
+
+       return 0;
+}
+
+void start_log_thread (void)
+{
+       warn_once = 1;
+
+       logger_pid = kernel_thread(logger_thread, NULL, 0);
+       if (logger_pid < 0)
+               TUX_BUG();
+}
+
+void stop_log_thread (void)
+{
+       DECLARE_WAITQUEUE(wait, current);
+
+       Dprintk("stopping logger thread %d ...\n", logger_pid);
+
+       __set_current_state(TASK_UNINTERRUPTIBLE);
+       add_wait_queue(&stop_logger_wait, &wait);
+       stop_logger = 1;
+       wake_up(&log_wait);
+       schedule();
+       __set_current_state(TASK_RUNNING);
+       remove_wait_queue(&stop_logger_wait, &wait);
+
+       Dprintk("logger thread stopped!\n");
+}
diff --git a/net/tux/main.c b/net/tux/main.c
new file mode 100644 (file)
index 0000000..e33241f
--- /dev/null
@@ -0,0 +1,1413 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * main.c: main management and initialization routines
+ */
+
+#define __KERNEL_SYSCALLS__
+#define __KERNEL_SYSCALLS_NO_ERRNO__
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+/*
+ * Threads information.
+ */
+unsigned int nr_tux_threads;
+static atomic_t nr_tux_threads_running = ATOMIC_INIT(0);
+static int stop_threads = 0;
+
+threadinfo_t threadinfo[CONFIG_TUX_NUMTHREADS];
+
+static void flush_all_requests (threadinfo_t *ti);
+
+void flush_all_signals (void)
+{
+       spin_lock_irq(&current->sighand->siglock);
+       flush_signals(current);
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+}
+
+int nr_requests_used (void)
+{
+       unsigned int i, nr = 0;
+
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+               nr += ti->nr_requests - ti->nr_free_requests;
+       }
+
+       return nr;
+}
+
+static inline int accept_pending (threadinfo_t *ti)
+{
+       int j;
+
+       for (j = 0; j < CONFIG_TUX_NUMSOCKETS; j++) {
+               if (!ti->listen[j].proto)
+                       break;
+               if (!ti->listen[j].sock)
+                       break;
+               if (tcp_sk(ti->listen[j].sock->sk)->accept_queue)
+                       return 1;
+       }
+       return 0;
+}
+
+static inline int requests_pending (threadinfo_t *ti)
+{
+       if (!list_empty(&ti->work_pending))
+               return 1;
+       return 0;
+}
+
+static int event_loop (threadinfo_t *ti)
+{
+       tux_req_t *req;
+       int work_done;
+
+repeat_accept:
+       if (ti->thread != current)
+               TUX_BUG();
+
+       /*
+        * Any (relevant) event on the socket will change this
+        * thread to TASK_RUNNING because we add it to both
+        * the main listening and the connection request socket
+        * waitqueues. Thus we can do 'lazy checking' of work
+        * to be done and schedule away only if the thread is
+        * still TASK_INTERRUPTIBLE. This makes TUX fully
+        * event driven.
+        */
+       set_task_state(current, TASK_INTERRUPTIBLE);
+       current->flags |= PF_MEMALLOC;
+       work_done = 0;
+       if (accept_pending(ti))
+               work_done = accept_requests(ti);
+
+       if (requests_pending(ti)) {
+               work_done = process_requests(ti, &req);
+               if (req)
+                       goto handle_userspace_req;
+       }
+
+       /*
+        * Be nice to other processes:
+        */
+       if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) {
+               __set_task_state(current, TASK_RUNNING);
+               schedule();
+               goto repeat_accept;
+       }
+
+       if (ti->userspace_req)
+               TUX_BUG();
+       if (unlikely(stop_threads))
+               goto handle_stop;
+
+       /* Any signals? */
+       if (unlikely(signal_pending(current)))
+               goto handle_signal;
+
+       if (work_done)
+               goto repeat_accept;
+       /*
+        * Any socket event either on the listen socket
+        * or on the request sockets will wake us up:
+        */
+       if ((current->state != TASK_RUNNING) &&
+                       !requests_pending(ti) && !accept_pending(ti)) {
+               Dprintk("fast thread: no work to be done, sleeping.\n");
+               schedule();
+               Dprintk("fast thread: back from sleep!\n");
+               goto repeat_accept;
+       }
+       goto repeat_accept;
+
+handle_userspace_req:
+       if (req->attr)
+               TUX_BUG();
+       switch_docroot(req);
+       ti->userspace_req = req;
+       __set_task_state(current, TASK_RUNNING);
+       return TUX_RETURN_USERSPACE_REQUEST;
+
+handle_signal:
+       __set_task_state(current, TASK_RUNNING);
+       return TUX_RETURN_SIGNAL;
+
+handle_stop:
+       __set_task_state(current, TASK_RUNNING);
+       return TUX_RETURN_EXIT;
+}
+
+static int init_queues (int nr_tux_threads)
+{
+       int i;
+
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+
+               INIT_LIST_HEAD(&ti->all_requests);
+
+               ti->free_requests_lock = SPIN_LOCK_UNLOCKED;
+               INIT_LIST_HEAD(&ti->free_requests);
+
+               ti->work_lock = SPIN_LOCK_UNLOCKED;
+               INIT_LIST_HEAD(&ti->work_pending);
+               INIT_LIST_HEAD(&ti->lru);
+
+       }
+       return 0;
+}
+
+int tux_chroot (char *dir)
+{
+       kernel_cap_t saved_cap = current->cap_effective;
+       mm_segment_t oldmm;
+       int err;
+
+       /* Allow chroot dir to be in kernel space. */
+       oldmm = get_fs(); set_fs(KERNEL_DS);
+       set_fs(KERNEL_DS);
+       cap_raise (current->cap_effective, CAP_SYS_CHROOT);
+
+       err = chroot(dir);
+       if (!err)
+               chdir("/");
+
+       current->cap_effective = saved_cap;
+       set_fs(oldmm);
+
+       return err;
+}
+
+/*
+ * Right now this is not fully SMP-safe against multiple TUX
+ * managers. It's just a rudimentary protection against typical
+ * mistakes.
+ */
+static int initialized = 0;
+
+#define MAX_DOCROOTLEN 500
+
+static int lookup_docroot(struct nameidata *docroot, const char *name)
+{
+       int err;
+
+       docroot->mnt = mntget(current->fs->rootmnt);
+       docroot->dentry = dget(current->fs->root);
+       docroot->last.len = 0;
+       docroot->flags = LOOKUP_FOLLOW;
+
+       err = path_walk(name, docroot);
+       if (err) {
+               mntput(docroot->mnt);
+               docroot->mnt = NULL;
+               return err;
+       }
+       return 0;
+}
+
+static int user_req_startup (void)
+{
+       char name[MAX_DOCROOTLEN];
+       struct nameidata *docroot;
+       unsigned int i;
+       int err;
+
+       if (initialized)
+               return -EINVAL;
+       initialized = 1;
+
+       /*
+        * Look up the HTTP and FTP document root.
+        * (typically they are shared, but can be 
+        * different directories.)
+        */
+       docroot = &tux_proto_http.main_docroot;
+       if (docroot->mnt)
+               TUX_BUG();
+       strcpy(name, tux_common_docroot);
+       strcat(name, tux_http_subdocroot);
+
+       err = lookup_docroot(docroot, name);
+       if (err) {
+               initialized = 0;
+               printk(KERN_ERR "TUX: could not look up HTTP documentroot: \"%s\"\n", name);
+               return err;
+       }
+
+       docroot = &tux_proto_ftp.main_docroot;
+       if (docroot->mnt)
+               TUX_BUG();
+       strcpy(name, tux_common_docroot);
+       strcat(name, tux_ftp_subdocroot);
+
+       err = lookup_docroot(docroot, name);
+       if (err) {
+abort:
+               docroot = &tux_proto_http.main_docroot;
+               path_release(docroot);
+               memset(docroot, 0, sizeof(*docroot));
+               initialized = 0;
+               printk(KERN_ERR "TUX: could not look up FTP documentroot: \"%s\"\n", name);
+               return err;
+       }
+
+       /*
+        * Start up the logger thread. (which opens the logfile)
+        */
+       start_log_thread();
+
+       nr_tux_threads = tux_threads;
+       if (nr_tux_threads < 1) 
+               nr_tux_threads = 1;
+       if (nr_tux_threads > CONFIG_TUX_NUMTHREADS) 
+               nr_tux_threads = CONFIG_TUX_NUMTHREADS;
+       tux_threads = nr_tux_threads;
+
+       /*
+        * Set up per-thread work-queues:
+        */
+       memset(threadinfo, 0, CONFIG_TUX_NUMTHREADS*sizeof(threadinfo_t));
+       init_queues(nr_tux_threads);
+
+       /*
+        * Prepare the worker thread structures.
+        */
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+               ti->cpu = i;
+               ti->gzip_state.workspace =
+                       vmalloc(zlib_deflate_workspacesize());
+               if (!ti->gzip_state.workspace ||
+                           (zlib_deflateInit(&ti->gzip_state, 6) != Z_OK)) {
+                       stop_log_thread();
+                       goto abort;
+               }
+               init_MUTEX(&ti->gzip_sem);
+       }
+
+       __module_get(tux_module);
+
+       return 0;
+}
+
+static DECLARE_WAIT_QUEUE_HEAD(wait_stop);
+static DECLARE_WAIT_QUEUE_HEAD(thread_stopped);
+
+static int user_req_shutdown (void)
+{
+       DECLARE_WAITQUEUE(wait, current);
+       struct nameidata *docroot;
+       int i, err = -EINVAL;
+
+       lock_kernel();
+       if (!initialized) {
+               Dprintk("TUX is not up - cannot shut down.\n");
+               goto err;
+       }
+       initialized = 0;
+       stop_threads = 1;
+       add_wait_queue(&thread_stopped, &wait);
+
+wait_more:
+       /*
+        * Wake up all the worker threads so they notice
+        * that we are being stopped.
+        */
+       set_task_state(current, TASK_UNINTERRUPTIBLE);
+       if (atomic_read(&nr_tux_threads_running)) {
+               Dprintk("TUX: shutdown, %d threads still running.\n",
+                       atomic_read(&nr_tux_threads_running));
+               wake_up(&wait_stop);
+               schedule();
+               goto wait_more;
+       }
+       set_task_state(current, TASK_RUNNING);
+       stop_threads = 0;
+       remove_wait_queue(&thread_stopped, &wait);
+
+       if (nr_async_io_pending())
+               TUX_BUG();
+
+       stop_log_thread();
+
+       docroot = &tux_proto_http.main_docroot;
+       path_release(docroot);
+       memset(docroot, 0, sizeof(*docroot));
+       docroot = &tux_proto_ftp.main_docroot;
+       path_release(docroot);
+       memset(docroot, 0, sizeof(*docroot));
+       err = 0;
+
+       flush_dentry_attributes();
+       free_mimetypes();
+       unregister_all_tuxmodules();
+
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+               vfree(ti->gzip_state.workspace);
+       }
+
+       module_put(tux_module);
+
+err:
+       unlock_kernel();
+       return err;
+}
+
+void drop_permissions (void)
+{
+       /*
+        * Userspace drops privileges already, and group
+        * membership is important to keep.
+        */
+       /* Give the new process no privileges.. */
+       current->uid = current->euid =
+               current->suid = current->fsuid = tux_cgi_uid;
+       current->gid = current->egid =
+               current->sgid = current->fsgid = tux_cgi_gid;
+       cap_clear(current->cap_permitted);
+       cap_clear(current->cap_inheritable);
+       cap_clear(current->cap_effective);
+}
+
+static int wait_for_others (void)
+{
+       threadinfo_t *ti;
+       unsigned int cpu;
+
+repeat:
+       if (signal_pending(current))
+               return -1;
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(HZ/10);
+
+       for (cpu = 0; cpu < nr_tux_threads; cpu++) {
+               ti = threadinfo + cpu;
+               if (ti->listen_error)
+                       return -1;
+               if (!ti->started)
+                       goto repeat;
+       }
+       /* ok, all threads have started up. */
+       return 0;
+}
+
+static void zap_listen_sockets (threadinfo_t *ti)
+{
+       struct socket *sock;
+       int i;
+
+       for (i = 0; i < CONFIG_TUX_NUMSOCKETS; i++) {
+               if (!ti->listen[i].proto)
+                       break;
+               sock = ti->listen[i].sock;
+               if (!ti->listen[i].cloned && sock) {
+                       while (waitqueue_active(sock->sk->sk_sleep))
+                               yield();
+                       sock_release(sock);
+               }
+               ti->listen[i].sock = NULL;
+               ti->listen[i].proto = NULL;
+               ti->listen[i].cloned = 0;
+       }
+}
+
+static DECLARE_MUTEX(serialize_startup);
+
+static int user_req_start_thread (threadinfo_t *ti)
+{
+       unsigned int err, cpu, i, j, k;
+       struct k_sigaction *ka;
+
+       cpu = ti->cpu;
+#if CONFIG_SMP
+       {
+               unsigned int mask;
+               cpumask_t cpu_mask, map;
+
+               mask = 1 << ((cpu + tux_cpu_offset) % num_online_cpus());
+
+               mask_to_cpumask(mask, &cpu_mask);
+               cpus_and(map, cpu_mask, cpu_online_map);
+               if(!(cpus_empty(map)))
+                       set_cpus_allowed(current, map);         
+       }
+#endif
+       ti->thread = current;
+       atomic_inc(&nr_tux_threads_running);
+
+       err = start_cachemiss_threads(ti);
+       if (err)
+               goto out;
+
+       init_waitqueue_entry(&ti->stop, current);
+       for (j = 0; j < CONFIG_TUX_NUMSOCKETS; j++)
+               init_waitqueue_entry(ti->wait_event + j, current);
+
+       ka = current->sighand->action + SIGCHLD-1;
+       ka->sa.sa_handler = SIG_IGN;
+
+       /* Block all signals except SIGKILL, SIGSTOP, SIGHUP and SIGCHLD */
+       spin_lock_irq(&current->sighand->siglock);
+       siginitsetinv(&current->blocked, sigmask(SIGKILL) |
+                       sigmask(SIGSTOP)| sigmask(SIGHUP) | sigmask(SIGCHLD));
+       recalc_sigpending();
+       spin_unlock_irq(&current->sighand->siglock);
+
+       if (!tux_listen[cpu][0].proto) {
+               printk(KERN_ERR "no listen socket specified for TUX thread %d, in /proc/net/tux/%d/listen/, aborting.\n", cpu, cpu);
+               goto error;
+       }
+
+       /*
+        * Serialize startup so that listen sockets can be
+        * created race-free.
+        */
+       down(&serialize_startup);
+
+       Dprintk("thread %d initializing sockets.\n", cpu);
+
+       for (k = 0; k < CONFIG_TUX_NUMSOCKETS; k++) {
+               tux_socket_t *e1, *e2;
+
+               e1 = tux_listen[cpu] + k;
+               if (!e1->proto)
+                       break;
+               for (i = 0; i < CONFIG_TUX_NUMTHREADS; i++) {
+                       if (i == cpu)
+                               continue;
+                       for (j = 0; j < CONFIG_TUX_NUMSOCKETS; j++) {
+                               e2 = tux_listen[i] + j;
+                               if (!e2->proto)
+                                       continue;
+                               if ((e1->ip == e2->ip) && (e1->port == e2->port) && (e1->proto == e2->proto) && threadinfo[i].listen[j].proto) {
+                                       ti->listen[k] = threadinfo[i].listen[j];
+                                       ti->listen[k].cloned = 1;
+                                       Dprintk("cloned socket %d from thread %d's socket %d.\n", k, i, j);
+                                       goto next_socket;
+                               }
+                       }
+               }
+
+               ti->listen[k].sock = start_listening(tux_listen[cpu] + k, cpu);
+               if (!ti->listen[k].sock)
+                       goto error_unlock;
+               ti->listen[k].cloned = 0;
+               ti->listen[k].proto = tux_listen[cpu][k].proto;
+               Dprintk("thread %d got sock %p (%d), proto %s.\n", cpu, ti->listen[k].sock, k, ti->listen[k].proto->name);
+next_socket:
+               ;
+       }
+       Dprintk("thread %d done initializing sockets.\n", cpu);
+       up(&serialize_startup);
+
+       if (wait_for_others())
+               goto error_nomsg;
+
+       if (!ti->listen[0].proto) {
+               printk("hm, socket 0 has no protocol.\n");
+               goto error;
+       }
+
+       add_wait_queue(&wait_stop, &ti->stop);
+       for (j = 0; j < CONFIG_TUX_NUMSOCKETS; j++)
+               if (ti->listen[j].proto)
+                       add_wait_queue_exclusive(ti->listen[j].sock->sk->sk_sleep,
+                               ti->wait_event + j);
+       drop_permissions();
+
+       __module_get(tux_module);
+       return 0;
+
+error_unlock:
+       up(&serialize_startup);
+error:
+       printk(KERN_NOTICE "TUX: could not start worker thread %d.\n", ti->cpu);
+
+error_nomsg:
+       ti->listen_error = 1;
+       ti->started = 0;
+
+       zap_listen_sockets(ti);
+       flush_all_requests(ti);
+       stop_cachemiss_threads(ti);
+
+       err = -EINVAL;
+
+out:
+       /*
+        * Last thread close the door:
+        */
+       if (atomic_dec_and_test(&nr_tux_threads_running))
+               user_req_shutdown();
+
+       return -err;
+}
+
+static int flush_idleinput (threadinfo_t * ti)
+{
+       struct list_head *head, *tmp;
+       tux_req_t *req;
+       int count = 0;
+
+       head = &ti->all_requests;
+       tmp = head->next;
+
+       while (tmp != head) {
+               req = list_entry(tmp, tux_req_t, all);
+               tmp = tmp->next;
+               if (test_bit(0, &req->idle_input)) {
+                       idle_event(req);
+                       count++;
+               }
+       }
+       return count;
+}
+
+static int flush_waitoutput (threadinfo_t * ti)
+{
+       struct list_head *head, *tmp;
+       tux_req_t *req;
+       int count = 0;
+
+       head = &ti->all_requests;
+       tmp = head->next;
+
+       while (tmp != head) {
+               req = list_entry(tmp, tux_req_t, all);
+               tmp = tmp->next;
+               if (test_bit(0, &req->wait_output_space)) {
+                       output_space_event(req);
+                       count++;
+               }
+       }
+       return count;
+}
+
+static void flush_all_requests (threadinfo_t *ti)
+{
+       for (;;) {
+               int count;
+
+               count = flush_idleinput(ti);
+               count += flush_waitoutput(ti);
+               count += tux_flush_workqueue(ti);
+               count += flush_freequeue(ti);
+               if (!ti->nr_requests)
+                       break;
+               /*
+                * Go through again if we advanced:
+                */
+               if (count)
+                       continue;
+               Dprintk("flush_all_requests: %d requests still waiting.\n", ti->nr_requests);
+#if TUX_DEBUG
+               count = print_all_requests(ti);
+               Dprintk("flush_all_requests: printed %d requests.\n", count);
+#endif
+               current->state = TASK_UNINTERRUPTIBLE;
+               schedule_timeout(HZ/10);
+       }
+}
+
+int nr_async_io_pending (void)
+{
+       unsigned int i, sum = 0;
+
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+               if (ti->iot)
+                       sum += ti->iot->nr_async_pending;
+       }
+       return sum;
+}
+
+static int user_req_stop_thread (threadinfo_t *ti)
+{
+       int j;
+
+       printk(KERN_NOTICE "TUX: thread %d stopping ...\n",
+               (int)(ti-threadinfo));
+
+       if (!ti->started)
+               TUX_BUG();
+       for (j = 0; j < CONFIG_TUX_NUMSOCKETS; j++)
+               if (ti->listen[j].proto)
+                       remove_wait_queue(ti->listen[j].sock->sk->sk_sleep,
+                               ti->wait_event + j);
+       remove_wait_queue(&wait_stop, &ti->stop);
+
+       Dprintk(KERN_NOTICE "TUX: thread %d waiting for sockets to go inactive ...\n", (int)(ti-threadinfo));
+       zap_listen_sockets(ti);
+
+       Dprintk(KERN_NOTICE "TUX: thread %d has all sockets inactive.\n", (int)(ti-threadinfo));
+
+       flush_all_requests(ti);
+       stop_cachemiss_threads(ti);
+
+       if (ti->nr_requests)
+               TUX_BUG();
+       ti->started = 0;
+
+       printk(KERN_INFO "TUX: thread %d stopped.\n", ti->cpu);
+
+       ti->thread = NULL;
+       current->tux_info = NULL;
+       current->tux_exit = NULL;
+       atomic_dec(&nr_tux_threads_running);
+       wake_up(&thread_stopped);
+
+       module_put(tux_module);
+
+       return 0;
+}
+
+#define COPY_INT(u_field, k_field)                                     \
+do {                                                                   \
+       if (__copy_to_user(&u_info->u_field, &req->k_field,             \
+                                       sizeof(req->k_field)))          \
+               return_EFAULT;                                          \
+} while (0)
+
+#define GETLEN(k_field, maxlen)                                                \
+               ((req->k_field##_len < maxlen) ?                        \
+               req->k_field##_len : maxlen-1)
+
+#define COPY_STR(u_field, k_field, maxlen)                             \
+do {                                                                   \
+       if (__copy_to_user(u_info->u_field, req->k_field##_str,         \
+               GETLEN(k_field, maxlen)))                               \
+                       return_EFAULT;                                  \
+} while (0)
+
+#define COPY_COND_STR(u_field,k_field,maxlen)                          \
+do {                                                                   \
+       if (req->k_field##_len)                                         \
+               COPY_STR(u_field, k_field, maxlen);                     \
+       if (__put_user((char)0, u_info->u_field +                       \
+                       GETLEN(k_field, maxlen)))                       \
+               return_EFAULT;                                          \
+} while (0)
+
+static void finish_userspace_req (tux_req_t *req)
+{
+       threadinfo_t *ti = req->ti;
+
+       ti->userspace_req = NULL;
+       req->usermode = 0;
+       req->private = 0;
+       req->error = 0;
+       DEC_STAT(nr_userspace_pending);
+       flush_request(req, 0);
+}
+
+static void zap_userspace_req (tux_req_t *req)
+{
+       clear_keepalive(req);
+       finish_userspace_req(req);
+}
+
+/*
+ * Fills in the user-space request structure:
+ */
+static int prepare_userspace_req (threadinfo_t *ti, user_req_t *u_info)
+{
+       u64 u_req;
+       tux_req_t *req = ti->userspace_req;
+       unsigned int tmp;
+       int filelen;
+       int fd;
+
+       Dprintk("prepare_userspace_req(%p).\n", req);
+       if (!req)
+               TUX_BUG();
+       if (req->error) {
+               TDprintk("userspace request has error %d.\n", req->error);
+               return -1;
+       }
+       fd = req->fd;
+       if (fd == -1) {
+               fd = sock_map_fd(req->sock);
+               Dprintk("sock_map_fd(%p) :%d.\n", req, fd);
+               if (fd < 0) {
+                       Dprintk("sock_map_fd() returned %d.\n", fd);
+                       return -EMFILE;
+               }
+               req->fd = fd;
+       }
+
+#define return_EFAULT do { Dprintk("-EFAULT at %d:%s.\n", __LINE__, __FILE__); return -EFAULT; } while (0)
+
+       if (!access_ok(VERIFY_WRITE, u_info, sizeof(*u_info)))
+               return_EFAULT;
+       if (__copy_to_user(&u_info->sock, &fd, sizeof(fd)))
+               return_EFAULT;
+       if (req->attr)
+               TUX_BUG();
+
+       COPY_INT(module_index, usermodule_idx);
+
+       COPY_COND_STR(query, query, MAX_URI_LEN);
+
+       COPY_INT(event, event);
+       Dprintk("prepare userspace, user error: %d, event %d.\n", req->user_error, req->event);
+       COPY_INT(error, user_error);
+       req->user_error = 0;
+
+       filelen = req->total_file_len;
+       if (filelen < 0)
+               filelen = 0;
+       if (__copy_to_user(&u_info->objectlen, &filelen, sizeof(filelen)))
+               return_EFAULT;
+       if ((req->method == METHOD_POST) && !filelen)
+               if (__copy_to_user(&u_info->objectlen,
+                       &req->content_len, sizeof(filelen)))
+               return_EFAULT;
+       if (req->objectname_len) {
+               if (req->objectname[req->objectname_len])
+                       TUX_BUG();
+               if (__copy_to_user(u_info->objectname, req->objectname,
+                               req->objectname_len + 1))
+                       return_EFAULT;
+       } else
+               if (__put_user((char)0, u_info->objectname))
+                       return_EFAULT;
+
+       COPY_INT(http_version, version);
+       COPY_INT(http_method, method);
+       COPY_INT(keep_alive, keep_alive);
+
+       COPY_INT(cookies_len, cookies_len);
+       if (req->cookies_len)
+               COPY_STR(cookies, cookies, MAX_COOKIE_LEN);
+       if (__put_user((char)0, u_info->cookies + req->cookies_len))
+               return_EFAULT;
+
+       u_req = (u64)(unsigned long)req;
+       if (__copy_to_user(&u_info->id, &u_req, sizeof(u_req)))
+               return_EFAULT;
+       COPY_INT(priv, private);
+       COPY_INT(bytes_sent, bytes_sent);
+
+       tmp = inet_sk(req->sock->sk)->daddr;
+       if (__copy_to_user(&u_info->client_host, &tmp, sizeof(tmp)))
+               return_EFAULT;
+
+       COPY_COND_STR(content_type, content_type, MAX_FIELD_LEN);
+       COPY_COND_STR(user_agent, user_agent, MAX_FIELD_LEN);
+       COPY_COND_STR(accept, accept, MAX_FIELD_LEN);
+       COPY_COND_STR(accept_charset, accept_charset, MAX_FIELD_LEN);
+       COPY_COND_STR(accept_encoding, accept_encoding, MAX_FIELD_LEN);
+       COPY_COND_STR(accept_language, accept_language, MAX_FIELD_LEN);
+       COPY_COND_STR(cache_control, cache_control, MAX_FIELD_LEN);
+       COPY_COND_STR(if_modified_since, if_modified_since, MAX_FIELD_LEN);
+       COPY_COND_STR(negotiate, negotiate, MAX_FIELD_LEN);
+       COPY_COND_STR(pragma, pragma, MAX_FIELD_LEN);
+       COPY_COND_STR(referer, referer, MAX_FIELD_LEN);
+
+       return TUX_RETURN_USERSPACE_REQUEST;
+}
+
+#define GOTO_ERR_no_unlock do { Dprintk("sys_tux() ERR at %s:%d.\n", __FILE__, __LINE__); goto err_no_unlock; } while (0)
+#define GOTO_ERR_unlock do { Dprintk("sys_tux() ERR at %s:%d.\n", __FILE__, __LINE__); goto err_unlock; } while (0)
+
+static int register_mimetype(user_req_t *u_info)
+{
+       char extension[MAX_URI_LEN], mimetype[MAX_URI_LEN], expires[MAX_URI_LEN];
+       u64 u_addr;
+       char *addr;
+       int ret;
+
+       ret = strncpy_from_user(extension, u_info->objectname, MAX_URI_LEN);
+       if (ret <= 0)
+               GOTO_ERR_no_unlock;
+       extension[ret] = 0;
+       Dprintk("got MIME extension: %s.\n", extension);
+       ret = copy_from_user(&u_addr, &u_info->object_addr, sizeof(u_addr));
+       if (ret)
+               GOTO_ERR_no_unlock;
+       addr = (char *)(unsigned long)u_addr;
+       ret = strncpy_from_user(mimetype, addr, MAX_URI_LEN);
+       if (ret <= 0)
+               GOTO_ERR_no_unlock;
+       mimetype[ret] = 0;
+       Dprintk("got MIME type: %s.\n", mimetype);
+        ret = strncpy_from_user(expires, u_info->cache_control, MAX_URI_LEN);
+        if (ret >= 0)
+               expires[ret] = 0;
+       else
+               expires[0] = 0;
+        Dprintk("got expires header: %s.\n", expires);
+
+       add_mimetype(extension, mimetype, expires);
+       ret = 0;
+err_no_unlock:
+       return ret;
+}
+
+void user_send_buffer (tux_req_t *req, int cachemiss)
+{
+       int ret;
+
+
+       SET_TIMESTAMP(req->output_timestamp);
+
+repeat:
+       ret = send_sync_buf(req, req->sock, req->userbuf, req->userlen, MSG_DONTWAIT | MSG_MORE);
+       switch (ret) {
+               case -EAGAIN:
+                       add_tux_atom(req, user_send_buffer);
+                       if (add_output_space_event(req, req->sock)) {
+                               del_tux_atom(req);
+                               goto repeat;
+                       }
+                       INC_STAT(user_sendbuf_write_misses);
+                       break;
+               default:
+                       if (ret <= 0) {
+                               req_err(req);
+                               req->usermode = 0;
+                               req->private = 0;
+                               add_req_to_workqueue(req);
+                               break;
+                       }
+                       req->userbuf += ret;
+                       req->userlen -= ret;
+                       if ((int)req->userlen < 0)
+                               TUX_BUG();
+                       if (req->userlen)
+                               goto repeat;
+                       add_req_to_workqueue(req);
+                       break;
+       }
+}
+
+void user_send_object (tux_req_t *req, int cachemiss)
+{
+       int ret;
+
+
+       SET_TIMESTAMP(req->output_timestamp);
+
+repeat:
+       ret = generic_send_file(req, req->sock, cachemiss);
+       switch (ret) {
+               case -5:
+                       add_tux_atom(req, user_send_object);
+                       output_timeout(req);
+                       break;
+               case -4:
+                       add_tux_atom(req, user_send_object);
+                       if (add_output_space_event(req, req->sock)) {
+                               del_tux_atom(req);
+                               goto repeat;
+                       }
+                       INC_STAT(user_sendobject_write_misses);
+                       break;
+               case -3:
+                       INC_STAT(user_sendobject_cachemisses);
+                       add_tux_atom(req, user_send_object);
+                       queue_cachemiss(req);
+                       break;
+               case -1:
+                       break;
+               default:
+                       req->in_file.f_pos = 0;
+                       add_req_to_workqueue(req);
+                       break;
+       }
+}
+
+void user_get_object (tux_req_t *req, int cachemiss)
+{
+       int missed;
+
+       if (!req->dentry) {
+               req->usermode = 0;
+               missed = lookup_object(req, cachemiss ? 0 : LOOKUP_ATOMIC);
+               if (req->usermode)
+                       TUX_BUG();
+               req->usermode = 1;
+               if (!missed && !req->dentry) {
+                       req->error = 0;
+                       req->user_error = -ENOENT;
+                       add_req_to_workqueue(req);
+                       return;
+               }
+               if (missed) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       INC_STAT(user_lookup_cachemisses);
+fetch_missed:
+                       req->ti->userspace_req = NULL;
+                       DEC_STAT(nr_userspace_pending);
+                       add_tux_atom(req, user_get_object);
+                       queue_cachemiss(req);
+                       return;
+               }
+       }
+       req->total_file_len = req->dentry->d_inode->i_size;
+       if (!req->output_len)
+               req->output_len = req->total_file_len;
+       if (tux_fetch_file(req, !cachemiss)) {
+               INC_STAT(user_fetch_cachemisses);
+               goto fetch_missed;
+       }
+       req->in_file.f_pos = 0;
+       add_req_to_workqueue(req);
+}
+
+asmlinkage long __sys_tux (unsigned int action, user_req_t *u_info)
+{
+       int ret = -1;
+       threadinfo_t *ti;
+       tux_req_t *req;
+
+       if (action != TUX_ACTION_CURRENT_DATE)
+               Dprintk("got sys_tux(%d, %p).\n", action, u_info);
+
+       if (action >= MAX_TUX_ACTION)
+               GOTO_ERR_no_unlock;
+
+       ti = (threadinfo_t *) current->tux_info;
+       if (ti)
+               if (ti->thread != current)
+                       TUX_BUG();
+
+       if (!capable(CAP_SYS_ADMIN)
+                       && (action != TUX_ACTION_CONTINUE_REQ) &&
+                               (action != TUX_ACTION_STOPTHREAD))
+               goto userspace_actions;
+
+       switch (action) {
+               case TUX_ACTION_CONTINUE_REQ:
+                       ret = continue_request((int)(long)u_info);
+                       goto out;
+
+               case TUX_ACTION_STARTUP:
+                       lock_kernel();
+                       ret = user_req_startup();
+                       unlock_kernel();
+                       goto out;
+
+               case TUX_ACTION_SHUTDOWN:
+                       lock_kernel();
+                       ret = user_req_shutdown();
+                       unlock_kernel();
+                       goto out;
+
+               case TUX_ACTION_REGISTER_MODULE:
+                       ret = user_register_module(u_info);
+                       goto out;
+
+               case TUX_ACTION_UNREGISTER_MODULE:
+                       ret = user_unregister_module(u_info);
+                       goto out;
+
+               case TUX_ACTION_STARTTHREAD:
+               {
+                       unsigned int nr;
+
+                       ret = copy_from_user(&nr, &u_info->thread_nr,
+                                               sizeof(int));
+                       if (ret)
+                               GOTO_ERR_no_unlock;
+                       if (nr >= nr_tux_threads)
+                               GOTO_ERR_no_unlock;
+                       ti = threadinfo + nr;
+                       if (ti->started)
+                               GOTO_ERR_unlock;
+                       ti->started = 1;
+                       current->tux_info = ti;
+                       current->tux_exit = tux_exit;
+                       if (ti->thread)
+                               TUX_BUG();
+                       Dprintk("TUX: current open files limit for TUX%d: %ld.\n", nr, current->rlim[RLIMIT_NOFILE].rlim_cur);
+                       lock_kernel();
+                       ret = user_req_start_thread(ti);
+                       unlock_kernel();
+                       if (ret) {
+                               current->tux_info = NULL;
+                               current->tux_exit = NULL;
+                       } else {
+                               if (ti->thread != current)
+                                       TUX_BUG();
+                       }
+                       goto out_userreq;
+               }
+
+               case TUX_ACTION_STOPTHREAD:
+                       if (!ti)
+                               GOTO_ERR_no_unlock;
+                       if (!ti->started)
+                               GOTO_ERR_unlock;
+                       req = ti->userspace_req;
+                       if (req)
+                               zap_userspace_req(req);
+                       
+                       lock_kernel();
+                       ret = user_req_stop_thread(ti);
+                       unlock_kernel();
+                       goto out_userreq;
+
+               case TUX_ACTION_CURRENT_DATE:
+                       ret = strncpy_from_user(tux_date, u_info->new_date,
+                               DATE_LEN);
+                       if (ret <= 0)
+                               GOTO_ERR_no_unlock;
+                       goto out;
+
+               case TUX_ACTION_REGISTER_MIMETYPE:
+                       ret = register_mimetype(u_info);
+                       if (ret)
+                               GOTO_ERR_no_unlock;
+                       goto out;
+
+               case TUX_ACTION_QUERY_VERSION:
+                       ret = (TUX_MAJOR_VERSION << 24) | (TUX_MINOR_VERSION << 16) | TUX_PATCHLEVEL_VERSION;
+                       goto out;
+               default:
+                       ;
+       }
+
+userspace_actions:
+
+       if (!ti)
+               GOTO_ERR_no_unlock;
+
+       if (!ti->started)
+               GOTO_ERR_unlock;
+
+       req = ti->userspace_req;
+       if (!req) {
+               if (action == TUX_ACTION_EVENTLOOP)
+                       goto eventloop;
+               GOTO_ERR_unlock;
+       }
+       if (!req->usermode)
+               TUX_BUG();
+
+       ret = copy_from_user(&req->event, &u_info->event, sizeof(int));
+       if (ret)
+               GOTO_ERR_unlock;
+       ret = copy_from_user(&req->status, &u_info->http_status, sizeof(int));
+       if (ret)
+               GOTO_ERR_unlock;
+       ret = copy_from_user(&req->bytes_sent, &u_info->bytes_sent, sizeof(int));
+       if (ret)
+               GOTO_ERR_unlock;
+       ret = copy_from_user(&req->private, &u_info->priv, sizeof(req->private));
+       if (ret)
+               GOTO_ERR_unlock;
+
+       switch (action) {
+
+               case TUX_ACTION_EVENTLOOP:
+eventloop:
+                       req = ti->userspace_req;
+                       if (req)
+                               zap_userspace_req(req);
+                       ret = event_loop(ti);
+                       goto out_userreq;
+
+               /*
+                * Module forces keepalive off, server will close
+                * the connection.
+                */
+               case TUX_ACTION_FINISH_CLOSE_REQ:
+                       clear_keepalive(req);
+
+               case TUX_ACTION_FINISH_REQ:
+                       finish_userspace_req(req);
+                       goto eventloop;
+
+               case TUX_ACTION_REDIRECT_REQ:
+
+                       ti->userspace_req = NULL;
+                       req->usermode = 0;
+                       req->private = 0;
+                       req->error = TUX_ERROR_REDIRECT;
+                       DEC_STAT(nr_userspace_pending);
+                       add_tux_atom(req, redirect_request);
+                       add_req_to_workqueue(req);
+
+                       goto eventloop;
+
+               case TUX_ACTION_POSTPONE_REQ:
+
+                       postpone_request(req);
+                       ti->userspace_req = NULL;
+                       ret = TUX_RETURN_USERSPACE_REQUEST;
+                       break;
+
+               case TUX_ACTION_GET_OBJECT:
+                       release_req_dentry(req);
+                       ret = strncpy_from_user(req->objectname,
+                               u_info->objectname, MAX_URI_LEN-1);
+                       if (ret <= 0) {
+                               req->objectname[0] = 0;
+                               req->objectname_len = 0;
+                               GOTO_ERR_unlock;
+                       }
+                       req->objectname[ret] = 0; // string delimit
+                       req->objectname_len = ret;
+
+                       Dprintk("got objectname {%s} (%d) from user-space req %p (req: %p).\n", req->objectname, req->objectname_len, u_info, req);
+                       req->ti->userspace_req = NULL;
+                       DEC_STAT(nr_userspace_pending);
+                       user_get_object(req, 0);
+                       goto eventloop;
+
+               case TUX_ACTION_READ_OBJECT:
+               {
+                       u64 u_addr;
+                       char *addr;
+                       loff_t ppos = 0;
+                       struct file *filp;
+
+                       if (!req->dentry)
+                               GOTO_ERR_unlock;
+                       
+                       ret = copy_from_user(&u_addr, &u_info->object_addr,
+                                       sizeof(u_addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       addr = (char *)(unsigned long)u_addr;
+                       filp = dentry_open(req->dentry, O_RDONLY, 0);
+                       dget(req->dentry);
+                       generic_file_read(filp, addr, req->total_file_len, &ppos);
+                       fput(filp);
+                       ret = TUX_RETURN_USERSPACE_REQUEST;
+                       break;
+               }
+
+               case TUX_ACTION_SEND_OBJECT:
+                       if (!req->dentry)
+                               GOTO_ERR_unlock;
+                       req->ti->userspace_req = NULL;
+                       DEC_STAT(nr_userspace_pending);
+                       user_send_object(req, 0);
+                       goto eventloop;
+
+               case TUX_ACTION_SEND_BUFFER:
+               {
+                       u64 u_addr;
+                       char *addr;
+                       unsigned int len;
+
+                       ret = copy_from_user(&u_addr,
+                                       &u_info->object_addr, sizeof(u_addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       addr = (char *)(unsigned long)u_addr;
+                       ret = copy_from_user(&len,
+                                       &u_info->objectlen, sizeof(addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       if ((int)len <= 0)
+                               GOTO_ERR_unlock;
+
+                       ret = -EFAULT;
+                       if (!access_ok(VERIFY_READ, addr, len))
+                               GOTO_ERR_unlock;
+                       req->userbuf = addr;
+                       req->userlen = len;
+
+                       req->ti->userspace_req = NULL;
+                       DEC_STAT(nr_userspace_pending);
+                       user_send_buffer(req, 0);
+                       ret = 0;
+                       goto eventloop;
+               }
+
+               case TUX_ACTION_READ_HEADERS:
+               {
+                       char *addr;
+                       u64 u_addr;
+
+                       ret = copy_from_user(&u_addr, &u_info->object_addr,
+                                       sizeof(u_addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       addr = (char *)(unsigned long)u_addr;
+                       ret = copy_to_user(&u_info->objectlen,
+                                &req->headers_len, sizeof(req->headers_len));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       ret = copy_to_user(addr,req->headers, req->headers_len);
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       break;
+               }
+
+               case TUX_ACTION_READ_POST_DATA:
+               {
+                       char *addr;
+                       unsigned int size;
+                       u64 u_addr;
+
+                       ret = copy_from_user(&u_addr, &u_info->object_addr,
+                                       sizeof(u_addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       addr = (char *)(unsigned long)u_addr;
+
+                       ret = copy_from_user(&size, &u_info->objectlen,
+                                       sizeof(size));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       Dprintk("READ_POST_DATA: got %p(%d).\n", addr, size);
+                       if (req->post_data_len < size)
+                               size = req->post_data_len;
+                       Dprintk("READ_POST_DATA: writing %d.\n", size);
+                       ret = copy_to_user(&u_info->objectlen,
+                                               &size, sizeof(size));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       ret = copy_to_user(addr, req->post_data_str, size);
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       goto out;
+               }
+
+               case TUX_ACTION_WATCH_PROXY_SOCKET:
+               {
+                       struct socket *sock;
+                       int err;
+                       long fd;
+                       u64 u_addr;
+
+                       ret = copy_from_user(&u_addr, &u_info->object_addr,
+                                       sizeof(u_addr));
+                       if (ret)
+                               GOTO_ERR_unlock;
+                       fd = (int)(unsigned long)u_addr;
+
+                       sock = sockfd_lookup(fd, &err);
+                       if (!sock)
+                               GOTO_ERR_unlock;
+                       put_data_sock(req);
+                       link_tux_data_socket(req, sock);
+
+                       ret = 0;
+                       goto out;
+               }
+
+               case TUX_ACTION_WAIT_PROXY_SOCKET:
+               {
+                       if (!req->data_sock)
+                               GOTO_ERR_unlock;
+                       if (socket_input(req->data_sock)) {
+                               ret = TUX_RETURN_USERSPACE_REQUEST;
+                               goto out_userreq;
+                       }
+                       spin_lock_irq(&req->ti->work_lock);
+                       add_keepalive_timer(req);
+                       if (test_and_set_bit(0, &req->idle_input))
+                               TUX_BUG();
+                       spin_unlock_irq(&req->ti->work_lock);
+                       if (socket_input(req->data_sock)) {
+                               unidle_req(req);
+                               ret = TUX_RETURN_USERSPACE_REQUEST;
+                               goto out_userreq;
+                       }
+                       req->ti->userspace_req = NULL;
+                       goto eventloop;
+               }
+
+               default:
+                       GOTO_ERR_unlock;
+       }
+
+out_userreq:
+       req = ti->userspace_req;
+       if (req) {
+               ret = prepare_userspace_req(ti, u_info);
+               if (ret < 0) {
+                       TDprintk("hm, user req %p returned %d, zapping.\n",
+                               req, ret);
+                       zap_userspace_req(req);
+                       goto eventloop;
+               }
+       }
+out:
+       if (action != TUX_ACTION_CURRENT_DATE)
+               Dprintk("sys_tux(%d, %p) returning %d.\n", action, u_info, ret);
+       while (unlikely(test_thread_flag(TIF_NEED_RESCHED))) {
+               __set_task_state(current, TASK_RUNNING);
+               schedule();
+       }
+       return ret;
+err_unlock:
+err_no_unlock:
+       Dprintk("sys_tux(%d, %p) returning -EINVAL (ret:%d)!\n", action, u_info, ret);
+       while (unlikely(test_thread_flag(TIF_NEED_RESCHED))) {
+               __set_task_state(current, TASK_RUNNING);
+               schedule();
+       }
+       return -EINVAL;
+}
+
+/*
+ * This gets called if a TUX thread does an exit().
+ */
+void tux_exit (void)
+{
+       __sys_tux(TUX_ACTION_STOPTHREAD, NULL);
+}
+
+int tux_init(void)
+{
+       start_sysctl();
+
+#if CONFIG_TUX_MODULE
+       spin_lock(&tux_module_lock);
+       sys_tux_ptr = __sys_tux;
+       tux_module = THIS_MODULE;
+       spin_unlock(&tux_module_lock);
+#endif
+
+       return 0;
+}
+
+void tux_cleanup (void)
+{
+#if CONFIG_TUX_MODULE
+       spin_lock(&tux_module_lock);
+       tux_module = NULL;
+       sys_tux_ptr = NULL;
+       spin_unlock(&tux_module_lock);
+#endif
+
+       end_sysctl();
+}
+
+module_init(tux_init)
+module_exit(tux_cleanup)
+
+MODULE_LICENSE("GPL");
+
diff --git a/net/tux/mod.c b/net/tux/mod.c
new file mode 100644 (file)
index 0000000..1489114
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * mod.c: loading/registering of dynamic TUX modules
+ */
+
+#include <net/tux.h>
+#include <linux/kmod.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+spinlock_t tuxmodules_lock = SPIN_LOCK_UNLOCKED;
+static LIST_HEAD(tuxmodules_list);
+
+tcapi_template_t * get_first_usermodule (void)
+{
+       tcapi_template_t *tcapi;
+       struct list_head *head, *curr, *next;
+
+       spin_lock(&tuxmodules_lock);
+       head = &tuxmodules_list;
+       next = head->next;
+
+       while ((curr = next) != head) {
+               tcapi = list_entry(curr, tcapi_template_t, modules);
+               next = curr->next;
+               if (tcapi->userspace_id) {
+                       spin_unlock(&tuxmodules_lock);
+                       return tcapi;
+               }
+       }
+       spin_unlock(&tuxmodules_lock);
+       return NULL;
+}
+
+static tcapi_template_t * lookup_module (const char *vfs_name)
+{
+       tcapi_template_t *tcapi;
+       struct list_head *head, *curr, *next;
+
+       while (*vfs_name == '/')
+               vfs_name++;
+       Dprintk("looking up TUX module {%s}.\n", vfs_name);
+       head = &tuxmodules_list;
+       next = head->next;
+
+       while ((curr = next) != head) {
+               tcapi = list_entry(curr, tcapi_template_t, modules);
+               next = curr->next;
+               Dprintk("checking module {%s} == {%s}?\n", vfs_name, tcapi->vfs_name);
+               if (!strcmp(tcapi->vfs_name, vfs_name))
+                       return tcapi;
+       }
+       return NULL;
+}
+
+/*
+ * Attempt to load a TUX application module.
+ * This is the slow path, we cache ('link') the module's
+ * API vector to the inode.
+ * The module loading path is serialized, and we handshake
+ * with the loaded module and fetch its API vector.
+ */
+tcapi_template_t * lookup_tuxmodule (const char *filename)
+{
+       tcapi_template_t *tcapi;
+
+       spin_lock(&tuxmodules_lock);
+       tcapi = lookup_module(filename);
+       if (!tcapi)
+               Dprintk("did not find module vfs:{%s}\n", filename);
+       spin_unlock(&tuxmodules_lock);
+       return tcapi;
+}
+
+
+int register_tuxmodule (tcapi_template_t *tcapi)
+{
+       int ret = -EEXIST;
+
+       spin_lock(&tuxmodules_lock);
+
+       if (lookup_module(tcapi->vfs_name)) {
+               Dprintk("module with VFS binding '%s' already registered!\n",
+                                                tcapi->vfs_name);
+               goto out;
+       } 
+
+       list_add(&tcapi->modules, &tuxmodules_list);
+       ret = 0;
+       Dprintk("TUX module %s registered.\n", tcapi->vfs_name);
+out:
+       spin_unlock(&tuxmodules_lock);
+
+       return ret;
+}
+
+void unregister_all_tuxmodules (void)
+{
+       tcapi_template_t *tcapi;
+       struct list_head *curr;
+
+       spin_lock(&tuxmodules_lock);
+       while (((curr = tuxmodules_list.next)) != &tuxmodules_list) {
+               tcapi = list_entry(curr, tcapi_template_t, modules);
+               list_del(curr);
+               kfree(tcapi->vfs_name);
+               kfree(tcapi);
+       }
+       spin_unlock(&tuxmodules_lock);
+}
+
+tcapi_template_t * unregister_tuxmodule (char *vfs_name)
+{
+       tcapi_template_t *tcapi;
+       int err = 0;
+
+       spin_lock(&tuxmodules_lock);
+       tcapi = lookup_module(vfs_name);
+       if (!tcapi) {
+               Dprintk("huh, module %s not registered??\n", vfs_name);
+               err = -1;
+       } else {
+               list_del(&tcapi->modules);
+               Dprintk("TUX module %s unregistered.\n", vfs_name);
+       }
+       spin_unlock(&tuxmodules_lock);
+
+       return tcapi;
+}
+
+static int check_module_version (user_req_t *u_info)
+{
+       int major, minor, patch, ret;
+
+       ret = copy_from_user(&major, &u_info->version_major, sizeof(int));
+       ret += copy_from_user(&minor, &u_info->version_minor, sizeof(int));
+       ret += copy_from_user(&patch, &u_info->version_patch, sizeof(int));
+       if (ret)
+               return -EFAULT;
+
+       if ((major != TUX_MAJOR_VERSION) || (minor > TUX_MINOR_VERSION)) {
+
+               printk(KERN_ERR "TUX: module version %d:%d incompatible with kernel version %d:%d!\n", major, minor, TUX_MAJOR_VERSION, TUX_MINOR_VERSION);
+               return -EINVAL;
+       }
+       return 0;
+}
+
+int user_register_module (user_req_t *u_info)
+{
+       int idx, len, ret;
+       tcapi_template_t *tcapi;
+       char modulename [MAX_URI_LEN+1];
+
+       ret = check_module_version(u_info);
+       if (ret)
+               return ret;
+
+       /*
+        * Check module name length.
+        */
+       ret = strnlen_user(u_info->objectname, MAX_URI_LEN+2);
+       if (ret < 0)
+               goto out;
+       ret = -EINVAL;
+       if (ret >= MAX_URI_LEN)
+               goto out;
+
+       Dprintk("register user-module, %p.\n", u_info);
+       ret = strncpy_from_user(modulename, u_info->objectname, MAX_URI_LEN);
+       if (ret < 0)
+               goto out;
+       modulename[ret] = 0;
+       Dprintk("... user-module is: {%s}.\n", modulename);
+       len = strlen(modulename);
+       if (!len)
+               printk(KERN_ERR "no module name provided: please upgrade your TUX user-space utilities!\n");
+       if (!len || (len > MAX_URI_LEN))
+               return -EINVAL;
+       Dprintk("... user-module len is: %d.\n", len);
+
+       ret = copy_from_user(&idx, &u_info->module_index, sizeof(int));
+       if (ret || !idx)
+               goto out;
+       Dprintk("... user-module index is: %d.\n", idx);
+
+       ret = -ENOMEM;
+       tcapi = (tcapi_template_t *) kmalloc(sizeof(*tcapi), GFP_KERNEL);
+       if (!tcapi)
+               goto out;
+       memset(tcapi, 0, sizeof(*tcapi));
+
+       tcapi->vfs_name = (char *) kmalloc(len+1, GFP_KERNEL);
+       if (!tcapi->vfs_name) {
+               kfree(tcapi);
+               goto out;
+       }
+       strcpy(tcapi->vfs_name, modulename);
+       tcapi->userspace_id = idx;
+
+       Dprintk("... registering module {%s}.\n", tcapi->vfs_name);
+       ret = register_tuxmodule(tcapi);
+out:
+       return ret;
+}
+
+int user_unregister_module (user_req_t *u_info)
+{
+       int len, ret;
+       tcapi_template_t *tcapi;
+       char modulename [MAX_URI_LEN+1];
+
+       /*
+        * Check module name length.
+        */
+       ret = strnlen_user(u_info->objectname, MAX_URI_LEN+2);
+       if (ret < 0)
+               goto out;
+       ret = -EINVAL;
+       if (ret >= MAX_URI_LEN)
+               goto out;
+       Dprintk("unregister user-module, %p.\n", u_info);
+       ret = strncpy_from_user(modulename, u_info->objectname, MAX_URI_LEN);
+       if (ret <= 0)
+               goto out;
+       modulename[ret] = 0;
+       Dprintk("... user-module is: {%s}.\n", modulename);
+       len = strlen(modulename);
+       if (!len || (len > MAX_URI_LEN))
+               return -EINVAL;
+       Dprintk("... user-module len is: %d.\n", len);
+
+       Dprintk("... unregistering module {%s}.\n", modulename);
+       tcapi = unregister_tuxmodule(modulename);
+       ret = -EINVAL;
+       if (tcapi) {
+               ret = 0;
+               kfree(tcapi->vfs_name);
+               kfree(tcapi);
+       }
+out:
+       return ret;
+}
+
diff --git a/net/tux/output.c b/net/tux/output.c
new file mode 100644 (file)
index 0000000..0ac39b2
--- /dev/null
@@ -0,0 +1,352 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * output.c: Send data to clients
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+int send_sync_buf (tux_req_t *req, struct socket *sock, const char *buf, const size_t length, unsigned long flags)
+{
+       struct msghdr msg;
+       struct iovec iov;
+       int len, written = 0, left = length;
+       struct tcp_opt *tp = tcp_sk(sock->sk);
+
+       tp->nonagle = 2;
+
+       msg.msg_name     = 0;
+       msg.msg_namelen  = 0;
+       msg.msg_iov      = &iov;
+       msg.msg_iovlen   = 1;
+       msg.msg_control  = NULL;
+       msg.msg_controllen = 0;
+       msg.msg_flags    = flags | MSG_NOSIGNAL;
+repeat_send:
+       msg.msg_iov->iov_len = left;
+       msg.msg_iov->iov_base = (char *) buf + written;
+
+       len = sock_sendmsg(sock, &msg, left);
+
+       Dprintk("sendmsg ret: %d, written: %d, left: %d.\n", len,written,left);
+       if ((len == -ERESTARTSYS) || (!(flags & MSG_DONTWAIT) &&
+                        (len == -EAGAIN))) {
+               flush_all_signals();
+               goto repeat_send;
+       }
+       if (len > 0) {
+               written += len;
+               left -= len;
+               if (left)
+                       goto repeat_send;
+       }
+       if (len >= 0) {
+               if (written != length)
+                       TUX_BUG();
+               if (left)
+                       TUX_BUG();
+       }
+       if (req && (written > 0))
+               req->bytes_sent += written;
+       Dprintk("sendmsg FINAL ret: %d, written: %d, left: %d.\n", len,written,left);
+       return written ? written : len;
+}
+
+unsigned int tux_zerocopy_sendfile = 1;
+
+typedef struct sock_send_desc
+{
+       struct socket *sock;
+       tux_req_t *req;
+} sock_send_desc_t;
+
+static int sock_send_actor (read_descriptor_t * desc, struct page *page,
+                               unsigned long offset, unsigned long orig_size)
+{
+       sock_send_desc_t *sock_desc = (sock_send_desc_t *)desc->arg.buf;
+       struct socket *sock = sock_desc->sock;
+       tux_req_t *req = sock_desc->req;
+       unsigned int flags;
+       ssize_t written;
+       char *buf = NULL;
+       unsigned int size;
+
+       flags = MSG_DONTWAIT | MSG_NOSIGNAL;
+       if (desc->count < orig_size)
+               orig_size = desc->count;
+       if (desc->count > orig_size)
+               flags |= MSG_MORE;
+       Dprintk("sock_send_actor(), page: %p, offset: %ld, orig_size: %ld, sock: %p, desc->count: %d, desc->written: %d, MSG_MORE: %d.\n", page, offset, orig_size, sock, desc->count, desc->written, flags & MSG_MORE);
+
+       if (req->content_gzipped >= 2) {
+               unsigned int gzip_left;
+               struct msghdr msg;
+               struct iovec iov;
+               mm_segment_t oldmm;
+               char *kaddr = kmap(page);
+               __u32 in_len, out_len;
+               out_len = orig_size*101/100 + 12;
+               buf = tux_kmalloc(out_len);
+               in_len = orig_size;
+               size = out_len;
+               gzip_left = 0;
+// 8b1f 0808 fdc4 3bd8 0300 79
+buf[1] = 0x8b; buf[0] = 0x1f; buf[3] = 0x08; buf[2] = 0x08;
+buf[5] = 0xfd; buf[4] = 0xc4; buf[7] = 0x3b; buf[6] = 0xd8;
+buf[9] = 0x03; buf[8] = 0x00; buf[10] = 0x79;
+               size += 11;
+               Dprintk("pre-compress: in_len: %d, out_len: %d, gzip_left: %d, uncompressed size: %d.\n", in_len, out_len, gzip_left, size);
+               gzip_left = tux_gzip_compress(req, kaddr, buf+11, &in_len, &out_len);
+               size -= out_len;
+ buf[11] = 0x79; buf[12] = 0x00;
+
+               Dprintk("post-compress: in_len: %d, out_len: %d, gzip_left: %d, compressed size: %d.\n", in_len, out_len, gzip_left, size);
+               kunmap(page);
+               msg.msg_name = NULL;
+               msg.msg_namelen = 0;
+               msg.msg_iov = &iov;
+               msg.msg_iovlen = 1;
+               msg.msg_control = NULL;
+               msg.msg_controllen = 0;
+               flags &= ~MSG_DONTWAIT;
+               msg.msg_flags = flags;
+               iov.iov_base = buf;
+               iov.iov_len = size;
+
+               oldmm = get_fs(); set_fs(KERNEL_DS);
+               written = sock_sendmsg(sock, &msg, size);
+               set_fs(oldmm);
+
+               Dprintk("buf: %p, offset: %ld, size: %d, written: %d.\n", buf, offset, size, written);
+               if (written == size)
+                       written = orig_size;
+               else
+                       written = size;
+                       
+       } else {
+               size = orig_size;
+               if (tux_zerocopy_sendfile && sock->ops->sendpage &&
+                   (sock->sk->sk_route_caps&NETIF_F_SG)) {
+                       written = sock->ops->sendpage(sock, page, offset, size, flags);
+               } else {
+                       struct msghdr msg;
+                       struct iovec iov;
+                       char *kaddr;
+                       mm_segment_t oldmm;
+       
+                       if (offset+size > PAGE_SIZE)
+                               return -EFAULT;
+
+                       kaddr = kmap(page);
+       
+                       msg.msg_name = NULL;
+                       msg.msg_namelen = 0;
+                       msg.msg_iov = &iov;
+                       msg.msg_iovlen = 1;
+                       msg.msg_control = NULL;
+                       msg.msg_controllen = 0;
+                       msg.msg_flags = flags;
+                       iov.iov_base = kaddr + offset;
+                       iov.iov_len = size;
+
+                       oldmm = get_fs(); set_fs(KERNEL_DS);
+                       written = sock_sendmsg(sock, &msg, size);
+                       set_fs(oldmm);
+
+                       Dprintk("kaddr: %p, offset: %ld, size: %d, written: %d.\n", kaddr, offset, size, written);
+                       kunmap(page);
+               }
+       }
+       if (written < 0) {
+               desc->error = written;
+               written = 0;
+       }
+       Dprintk("desc->count: %d, desc->written: %d, written: %d.\n", desc->count, desc->written, written);
+       desc->count -= written;
+       if ((int)desc->count < 0)
+               TUX_BUG();
+       desc->written += written;
+
+       if (buf)
+               kfree(buf);
+
+       return written;
+}
+
+/*
+ * Return 1 if the output space condition went away
+ * before adding the handler.
+ */
+int add_output_space_event (tux_req_t *req, struct socket *sock)
+{
+       struct sock *sk = sock->sk;
+       /*
+        * blocked due to socket IO?
+        */
+       spin_lock_irq(&req->ti->work_lock);
+       add_keepalive_timer(req);
+       if (test_and_set_bit(0,&req->wait_output_space))
+               TUX_BUG();
+       INC_STAT(nr_output_space_pending);
+
+       if ((sk->sk_state == TCP_ESTABLISHED) && enough_wspace(sk)) {
+               if (test_and_clear_bit(0, &req->wait_output_space)) {
+                       DEC_STAT(nr_output_space_pending);
+                       del_keepalive_timer(req);
+                       spin_unlock_irq(&req->ti->work_lock);
+                       return 1;
+               }
+       }
+       spin_unlock_irq(&req->ti->work_lock);
+
+       return 0;
+}
+
+#define SEND_BLOCKSIZE (164*1024)
+
+int generic_send_file (tux_req_t *req, struct socket *sock, int cachemiss)
+{
+       sock_send_desc_t sock_desc;
+       int len, want, nonblock = !cachemiss;
+       struct tcp_opt *tp = tcp_sk(sock->sk);
+
+       tp->nonagle = 2;
+
+       sock_desc.sock = sock;
+       sock_desc.req = req;
+
+repeat:
+       Dprintk("generic_send_file(%p,%d,%p) called, f_pos: %Ld, output_len: %Ld.\n", req, nonblock, sock, req->in_file.f_pos, req->output_len);
+
+       if (req->proto->check_req_err(req, cachemiss))
+               return -1;
+       if (connection_too_fast(req) == 2) {
+               len = -5;
+               goto out;
+       }
+       if (req->total_file_len < req->in_file.f_pos)
+               TUX_BUG();
+
+       req->desc.written = 0;
+       /*
+        * Careful, output_len can be 64-bit, while 'want' can be 32-bit.
+        */
+       if (req->output_len > SEND_BLOCKSIZE)
+               want = SEND_BLOCKSIZE;
+       else
+               want = req->output_len;
+       req->desc.count = want;
+       req->desc.arg.buf = (char *) &sock_desc;
+       req->desc.error = 0;
+       Dprintk("sendfile(), desc.count: %d.\n", req->desc.count);
+       do_generic_file_read(&req->in_file, &req->in_file.f_pos, &req->desc, sock_send_actor, nonblock);
+       if (req->desc.written > 0) {
+               req->bytes_sent += req->desc.written;
+               req->output_len -= req->desc.written;
+       }
+       if (!nonblock && (req->desc.error == -EWOULDBLOCKIO))
+               TUX_BUG();
+       Dprintk("sendfile() wrote: %d bytes.\n", req->desc.written);
+       if (req->output_len && !req->desc.written && !req->desc.error) {
+#if CONFIG_TUX_DEBUG
+               req->bytes_expected = 0;
+#endif
+               req->in_file.f_pos = 0;
+               req->error = TUX_ERROR_CONN_CLOSE;
+               zap_request(req, cachemiss);
+               return -1;
+       }
+
+       switch (req->desc.error) {
+
+       case -EWOULDBLOCKIO:
+               len = -3;
+               break;
+       case -EAGAIN:
+no_write_space:
+               Dprintk("sk->wmem_queued: %d, sk->sndbuf: %d.\n",
+                       sock->sk->sk_wmem_queued, sock->sk->sk_sndbuf);
+               len = -4;
+               break;
+       default:
+               len = req->desc.written;
+#if CONFIG_TUX_DEBUG
+               if (req->desc.error)
+                       TDprintk("TUX: sendfile() returned error %d (signals pending: %08lx)!\n", req->desc.error, current->pending.signal.sig[0]);
+#endif
+               if (!req->desc.error) {
+                       if (req->output_len < 0)
+                               BUG();
+                       if (req->output_len) {
+                               if (test_bit(SOCK_NOSPACE, &sock->flags))
+                                       goto no_write_space;
+                               goto repeat;
+                       }
+               }
+#if CONFIG_TUX_DEBUG
+               if (req->desc.written != want)
+                       TDprintk("TUX: sendfile() wrote %d bytes, wanted %d! (pos %Ld) (signals pending: %08lx).\n", req->desc.written, want, req->in_file.f_pos, current->pending.signal.sig[0]);
+               else
+                       Dprintk("TUX: sendfile() FINISHED for req %p, wrote %d bytes.\n", req, req->desc.written);
+               req->bytes_expected = 0;
+#endif
+               break;
+       }
+
+out:
+       Dprintk("sendfile() wrote %d bytes.\n", len);
+
+       return len;
+}
+
+static int file_fetch_actor (read_descriptor_t * desc, struct page *page,
+                               unsigned long offset, unsigned long size)
+{
+       if (desc->count < size)
+               size = desc->count;
+
+       desc->count -= size;
+       desc->written += size;
+
+       return size;
+}
+
+int tux_fetch_file (tux_req_t *req, int nonblock)
+{
+       int len;
+
+       req->desc.written = 0;
+       req->desc.count = req->output_len;
+       req->desc.arg.buf = NULL;
+       req->desc.error = 0;
+
+       do_generic_file_read(&req->in_file, &req->in_file.f_pos, &req->desc,
+                                       file_fetch_actor, nonblock);
+       if (nonblock && (req->desc.error == -EWOULDBLOCKIO))
+               return 1;
+       len = req->desc.written;
+       if (req->desc.error)
+               Dprintk("fetchfile() returned %d error!\n", req->desc.error);
+       Dprintk("fetchfile() fetched %d bytes.\n", len);
+       return 0;
+}
+
diff --git a/net/tux/parser.h b/net/tux/parser.h
new file mode 100644 (file)
index 0000000..f355c1e
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, Ingo Molnar <mingo@redhat.com>
+ *
+ * parser.h: generic parsing routines
+ */
+
+#define get_c(ptr,left)                                                \
+({                                                             \
+       char __ret;                                     \
+                                                               \
+       if (!left)                                              \
+               GOTO_INCOMPLETE;                                \
+       left--;                                                 \
+       __ret = *((ptr)++);                                     \
+       if (!__ret)                                             \
+               GOTO_REDIR;                                     \
+       __ret;                                                  \
+})
+
+#define PARSE_TOKEN(ptr,str,left)                              \
+       ({                                                      \
+               int __ret;                                      \
+                                                               \
+               if (!left)                                      \
+                       GOTO_INCOMPLETE;                        \
+               if (sizeof(str)-1 > left) {                     \
+                       if (memcmp(ptr, str, left))             \
+                               GOTO_REDIR;                     \
+                       GOTO_INCOMPLETE;                        \
+               }                                               \
+                                                               \
+               if (memcmp(ptr, str, sizeof(str)-1))            \
+                       __ret = 0;                              \
+               else {                                          \
+                       ptr += sizeof(str)-1;                   \
+                       left -= sizeof(str)-1;                  \
+                       __ret = 1;                              \
+               }                                               \
+               __ret;                                          \
+       })
+
+#define PARSE_METHOD(req,ptr,name,left)                                \
+       ({                                                      \
+               int __ret;                                      \
+                                                               \
+               if (PARSE_TOKEN(ptr,#name" ",left)) {           \
+                       req->method = METHOD_##name;            \
+                       __ret = 1;                              \
+               } else                                          \
+                       __ret = 0;                              \
+               __ret;                                          \
+       })
+
+#define COPY_LINE(ptr,target,left)                             \
+       do {                                                    \
+               char prev_c = 0, c;                             \
+               while (((c = get_c(ptr,left))) != '\n') \
+                       *target++ = prev_c = c;                 \
+               if (prev_c != '\r')                             \
+                       GOTO_REDIR;                             \
+       } while (0)
+
+#define COPY_LINE_TOLOWER(ptr,target,left,limit)               \
+       do {                                                    \
+               char prev_c = 0, c;                             \
+               while (((c = get_c(ptr,left))) != '\n') {       \
+                       if ((c >= 'A') && (c <= 'Z'))           \
+                               c -= 'A'-'a';                   \
+                       *target++ = prev_c = c;                 \
+                       if (target == (limit))                  \
+                               GOTO_REDIR;                     \
+               }                                               \
+               if (prev_c != '\r')                             \
+                       GOTO_REDIR;                             \
+       } while (0)
+
+#define COPY_FIELD(ptr,target,left)                            \
+       do {                                                    \
+               char c;                                         \
+               while ((c = get_c(ptr,left)) != ' ')            \
+                       *target++ = c;                          \
+       } while (0)
+
+#define SKIP_LINE(ptr,left)                                    \
+       do {                                                    \
+               char prev_c = 0, c;                             \
+               while (((c = get_c(ptr,left))) != '\n')         \
+                       prev_c = c;                             \
+               if (prev_c != '\r')                             \
+                       GOTO_REDIR;                             \
+       } while (0)
+
+#define SKIP_WHITESPACE(curr,left)             \
+do {                                           \
+       while ((left) && (*(curr) == ' '))      \
+               (curr)++, (left)--;             \
+       if (!(left))                            \
+               GOTO_REDIR;                     \
+} while (0)
+
diff --git a/net/tux/postpone.c b/net/tux/postpone.c
new file mode 100644 (file)
index 0000000..d4a693b
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * postpone.c: postpone/continue userspace requests
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+void postpone_request (tux_req_t *req)
+{
+       if (!req->usermode)
+               TUX_BUG();
+       INC_STAT(nr_postpone_pending);
+       req->postponed = 1;
+}
+
+/*
+ * Continue a postponed request. The request will show up in the
+ * userspace queue and will be handled by the fast thread.
+ * A request can only be postponed in a TUX process, but can be
+ * continued from any process that has access to the socket file
+ * descriptor.
+ */
+int continue_request (int fd)
+{
+       threadinfo_t *ti;
+       struct socket *sock;
+       tux_req_t *req;
+       int err;
+
+       sock = sockfd_lookup(fd, &err);
+       if (!sock || !sock->sk)
+               goto out;
+       req = sock->sk->sk_user_data;
+
+       err = -EINVAL;
+       if (!req)
+               goto out_put;
+       ti = req->ti;
+       if (!req->postponed)
+               goto out_unlock_put;
+       if (!req->usermode)
+               TUX_BUG();
+
+       req->postponed = 0;
+       DEC_STAT(nr_postpone_pending);
+
+       Dprintk("continuing postponed req %p.\n", req);
+       add_req_to_workqueue(req);
+
+out_unlock_put:
+       err = 0;
+out_put:
+       fput(sock->file);
+out:
+       return err;
+}
+
diff --git a/net/tux/proc.c b/net/tux/proc.c
new file mode 100644 (file)
index 0000000..2973a48
--- /dev/null
@@ -0,0 +1,1190 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * proc.c: /proc/sys/tux handling
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+char tux_common_docroot[200] = "/var/www/tux/";
+char tux_http_subdocroot[200] = "";
+char tux_ftp_subdocroot[200] = "";
+char tux_logfile[200] = "/var/log/tux";
+char tux_cgiroot[200] = "/var/www/tux/cgiroot/";
+char tux_404_page[200] = "404.html";
+char tux_default_vhost[200] = "default";
+char tux_extra_html_header[600];
+unsigned int tux_extra_html_header_size = 0;
+
+int tux_cgi_uid = -1;
+int tux_cgi_gid = -1;
+unsigned int tux_clientport = 8080;
+unsigned int tux_logging = 0;
+unsigned int tux_threads = 2;
+unsigned int tux_max_connect = 10000;
+unsigned int tux_max_keepalives = 10000;
+unsigned int tux_max_backlog = 2048;
+unsigned int tux_keepalive_timeout = 0;
+unsigned int tux_max_output_bandwidth = 0;
+unsigned int tux_defer_accept = 1;
+unsigned int tux_mode_forbidden = 0 /*S_IXUGO*/; /* do not allow executable (CGI) files */
+unsigned int tux_mode_allowed = S_IROTH; /* allow access if read-other is set */
+unsigned int tux_virtual_server = 0;
+unsigned int tux_ftp_virtual_server = 0;
+unsigned int mass_hosting_hash = 0;
+unsigned int strip_host_tail = 0;
+unsigned int tux_max_object_size = 0;
+unsigned int log_cpu_mask = ~0;
+unsigned int tux_compression = 0;
+unsigned int tux_noid = 0;
+unsigned int tux_cgi_inherit_cpu = 0;
+unsigned int tux_cgi_cpu_mask = ~0;
+unsigned int tux_zerocopy_header = 1;
+unsigned int tux_max_free_requests = 1000;
+unsigned int tux_ignore_query = 0;
+unsigned int tux_all_userspace = 0;
+unsigned int tux_redirect_logging = 1;
+unsigned int tux_max_header_len = 3000;
+unsigned int tux_referer_logging = 0;
+unsigned int tux_generate_etags = 1;
+unsigned int tux_generate_last_mod = 1;
+unsigned int tux_generate_cache_control = 1;
+unsigned int tux_ip_logging = 1;
+unsigned int tux_ftp_wait_close = 1;
+unsigned int tux_ftp_log_retr_only = 0;
+unsigned int tux_hide_unreadable = 1;
+unsigned int tux_http_dir_indexing = 0;
+unsigned int tux_log_incomplete = 0;
+unsigned int tux_cpu_offset = 0;
+unsigned int tux_ftp_login_message = 0;
+
+static struct ctl_table_header *tux_table_header;
+
+static ctl_table tux_table[] = {
+       {       NET_TUX_DOCROOT,
+               "documentroot",
+               &tux_common_docroot,
+               sizeof(tux_common_docroot),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_DOCROOT,
+               "http_subdocroot",
+               &tux_http_subdocroot,
+               sizeof(tux_http_subdocroot),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_DOCROOT,
+               "ftp_subdocroot",
+               &tux_ftp_subdocroot,
+               sizeof(tux_ftp_subdocroot),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_LOGFILE,
+               "logfile",
+               &tux_logfile,
+               sizeof(tux_logfile),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_THREADS,
+               "threads",
+               &tux_threads,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_KEEPALIVE_TIMEOUT,
+               "keepalive_timeout",
+               &tux_keepalive_timeout,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_KEEPALIVE_BW,
+               "max_output_bandwidth",
+               &tux_max_output_bandwidth,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_DEFER_ACCEPT,
+               "defer_accept",
+               &tux_defer_accept,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_BACKLOG,
+               "max_backlog",
+               &tux_max_backlog,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_CONNECT,
+               "max_connect",
+               &tux_max_connect,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_KEEPALIVES,
+               "max_keepalives",
+               &tux_max_keepalives,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MODE_FORBIDDEN,
+               "mode_forbidden",
+               &tux_mode_forbidden,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MODE_ALLOWED,
+               "mode_allowed",
+               &tux_mode_allowed,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CGI_UID,
+               "cgi_uid",
+               &tux_cgi_uid,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CGI_GID,
+               "cgi_gid",
+               &tux_cgi_gid,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CGIROOT,
+               "cgiroot",
+               &tux_cgiroot,
+               sizeof(tux_cgiroot),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_404_PAGE,
+               "404_page",
+               &tux_404_page,
+               sizeof(tux_404_page),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_404_PAGE,
+               "default_vhost",
+               &tux_default_vhost,
+               sizeof(tux_default_vhost),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_404_PAGE,
+               "extra_html_header",
+               &tux_extra_html_header,
+               sizeof(tux_extra_html_header),
+               0644,
+               NULL,
+               proc_dostring,
+               &sysctl_string,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "extra_html_header_size",
+               &tux_extra_html_header_size,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "clientport",
+               &tux_clientport,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "generate_etags",
+               &tux_generate_etags,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+        {       NET_TUX_CLIENTPORT,
+                "generate_last_mod",
+                &tux_generate_last_mod,
+                sizeof(int),
+                0644,
+                NULL,
+                proc_dointvec,
+                &sysctl_intvec,
+                NULL,
+                NULL,
+                NULL
+        },
+        {       NET_TUX_CLIENTPORT,
+                "generate_cache_control",
+                &tux_generate_cache_control,
+                sizeof(int),
+                0644,
+                NULL,
+                proc_dointvec,
+                &sysctl_intvec,
+                NULL,
+                NULL,
+                NULL
+        },
+       {       NET_TUX_CLIENTPORT,
+               "ip_logging",
+               &tux_ip_logging,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "ftp_wait_close",
+               &tux_ftp_wait_close,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "ftp_log_retr_only",
+               &tux_ftp_log_retr_only,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "http_dir_indexing",
+               &tux_http_dir_indexing,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "hide_unreadable",
+               &tux_hide_unreadable,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CLIENTPORT,
+               "log_incomplete",
+               &tux_log_incomplete,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_LOGGING,
+               "TDprintk",
+               &tux_TDprintk,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_LOGGING,
+               "Dprintk",
+               &tux_Dprintk,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+#if TUX_DPRINTK
+#endif
+       {       NET_TUX_LOGGING,
+               "logging",
+               &tux_logging,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_LOGENTRY_ALIGN_ORDER,
+               "logentry_align_order",
+               &tux_logentry_align_order,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_ACK_PINGPONG,
+               "ack_pingpong",
+               &tux_ack_pingpong,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_PUSH_ALL,
+               "push_all",
+               &tux_push_all,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_ZEROCOPY_PARSE,
+               "zerocopy_parse",
+               &tux_zerocopy_parse,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_VIRTUAL_SERVER,
+               "virtual_server",
+               &tux_virtual_server,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_VIRTUAL_SERVER,
+               "mass_hosting_hash",
+               &mass_hosting_hash,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_VIRTUAL_SERVER,
+               "strip_host_tail",
+               &strip_host_tail,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_VIRTUAL_SERVER,
+               "ftp_virtual_server",
+               &tux_ftp_virtual_server,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_OBJECT_SIZE,
+               "max_object_size",
+               &tux_max_object_size,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_COMPRESSION,
+               "compression",
+               &tux_compression,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_NOID,
+               "noid",
+               &tux_noid,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CGI_INHERIT_CPU,
+               "cgi_inherit_cpu",
+               &tux_cgi_inherit_cpu,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_CGI_CPU_MASK,
+               "cgi_cpu_mask",
+               &tux_cgi_cpu_mask,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_ZEROCOPY_HEADER,
+               "zerocopy_header",
+               &tux_zerocopy_header,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_ZEROCOPY_SENDFILE,
+               "zerocopy_sendfile",
+               &tux_zerocopy_sendfile,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_FREE_REQUESTS,
+               "max_free_requests",
+               &tux_max_free_requests,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_ALL_USERSPACE,
+               "all_userspace",
+               &tux_all_userspace,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_REDIRECT_LOGGING,
+               "redirect_logging",
+               &tux_redirect_logging,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_IGNORE_QUERY,
+               "ignore_query",
+               &tux_ignore_query,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_REFERER_LOGGING,
+               "referer_logging",
+               &tux_referer_logging,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_REFERER_LOGGING,
+               "cpu_offset",
+               &tux_cpu_offset,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_REFERER_LOGGING,
+               "ftp_login_message",
+               &tux_ftp_login_message,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {       NET_TUX_MAX_HEADER_LEN,
+               "max_header_len",
+               &tux_max_header_len,
+               sizeof(int),
+               0644,
+               NULL,
+               proc_dointvec,
+               &sysctl_intvec,
+               NULL,
+               NULL,
+               NULL
+       },
+       {0,0,0,0,0,0,0,0,0,0,0} };
+       
+       
+static ctl_table tux_dir_table[] = {
+       {NET_TUX, "tux", NULL, 0, 0555, tux_table,0,0,0,0,0},
+       {0,0,0,0,0,0,0,0,0,0,0}
+};
+
+static ctl_table tux_root_table[] = {
+       {CTL_NET, "net", NULL, 0, 0555, tux_dir_table,0,0,0,0,0},
+       {0,0,0,0,0,0,0,0,0,0,0}
+};
+
+
+static struct proc_dir_entry * root_tux_dir;
+static struct proc_dir_entry * log_cpu_mask_entry;
+static struct proc_dir_entry * stat_entry;
+static struct proc_dir_entry * tux_dir [CONFIG_TUX_NUMTHREADS];
+static struct proc_dir_entry * listen_dir [CONFIG_TUX_NUMTHREADS];
+
+tux_socket_t tux_listen [CONFIG_TUX_NUMTHREADS][CONFIG_TUX_NUMSOCKETS] =
+ { [0 ... CONFIG_TUX_NUMTHREADS-1] = { {&tux_proto_http, 0, 80, NULL}, } };
+
+#define HEX_DIGITS 8
+
+static int hex_read_proc (char *page, char **start, off_t off,
+                       int count, int *eof, void *data)
+{
+       if (count < HEX_DIGITS+1)
+               return -EINVAL;
+       return sprintf (page, "%08x\n", *(unsigned int *)data);
+}
+
+static int hex_write_proc (struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+       char hexnum [HEX_DIGITS];
+       unsigned int new_value;
+       unsigned int i, full_count = count;
+
+       if (!count)
+               return -EINVAL;
+       if (count > HEX_DIGITS)
+               count = HEX_DIGITS;
+       if (copy_from_user(hexnum, buffer, count))
+               return -EFAULT;
+
+       /*
+        * Parse the first 8 characters as a hex string, any non-hex char
+        * is end-of-string. '00e1', 'e1', '00E1', 'E1' are the same.
+        */
+       new_value = 0;
+
+       for (i = 0; i < count; i++) {
+               unsigned int c = hexnum[i];
+
+               switch (c) {
+                       case '0' ... '9': c -= '0'; break;
+                       case 'a' ... 'f': c -= 'a'-10; break;
+                       case 'A' ... 'F': c -= 'A'-10; break;
+               default:
+                       goto out;
+               }
+               new_value = (new_value << 4) | c;
+       }
+out:
+       *(int *)data = new_value;
+
+       return full_count;
+}
+
+#define LINE_SIZE 1024
+#define LINE_MASK (LINE_SIZE-1)
+
+static int print_request_stats (threadinfo_t *ti, char *page, unsigned int skip_count, unsigned int max_count)
+{
+       struct list_head *head, *curr;
+       tux_req_t *req;
+       unsigned int count = 0, size, line_off, len;
+       char stat_line [LINE_SIZE];
+
+       if (!max_count)
+               BUG();
+
+       head = &ti->all_requests;
+       curr = head->next;
+
+       while (curr != head) {
+               req = list_entry(curr, tux_req_t, all);
+               curr = curr->next;
+               count++;
+               if (count <= skip_count)
+                       continue;
+               line_off = 0;
+#define SP(x...) \
+       line_off += sprintf(stat_line + line_off, x)
+
+               if (req->proto == &tux_proto_http)
+                       SP("0 ");
+               else
+                       SP("1 ");
+       
+               SP("%p ", req);
+               SP("%d ", req->atom_idx);
+               if (req->atom_idx >= 1)
+                       SP("%p ", req->atoms[0]);
+               else
+                       SP("........ ");
+               if (req->atom_idx >= 2)
+                       SP("%p ", req->atoms[1]);
+               else
+                       SP("........ ");
+               if (!list_empty(&req->work))    SP("W");        else SP(".");
+               if (!list_empty(&req->free))    SP("F");        else SP(".");
+               if (!list_empty(&req->lru))     SP("L");        else SP(".");
+               if (req->keep_alive)            SP("K");        else SP(".");
+               if (req->idle_input)            SP("I");        else SP(".");
+               if (timer_pending(&req->keepalive_timer))
+                                               SP("T(%lu/%lu)",jiffies,req->keepalive_timer.expires);  else SP(".");
+               if (req->wait_output_space)     SP("O");        else SP(".");
+               if (timer_pending(&req->output_timer))
+                                               SP("T");        else SP(".");
+               SP(" %d ", req->error);
+               SP(" %d ", req->status);
+
+#define SP_HOST(ip,port) \
+               SP("%d.%d.%d.%d:%d ",NIPQUAD(ip),port)
+
+               if (req->sock) {
+                       if (req->sock->sk)
+                               SP("%d:", req->sock->sk->sk_state);
+                       else
+                               SP("-2:");
+               } else
+                       SP("-1:");
+               SP_HOST(req->client_addr, req->client_port);
+
+               SP("%Ld ", req->total_file_len);
+               SP("%Ld ", req->in_file.f_pos);
+               if (req->proto == &tux_proto_http) {
+                       SP("%d ", req->method);
+                       SP("%d ", req->version);
+               }
+               if (req->proto == &tux_proto_ftp) {
+                       SP("%d ", req->ftp_command);
+                       if (req->data_sock) {
+                               if (req->data_sock->sk)
+                                       SP("%d:",req->data_sock->sk->sk_state);
+                               else
+                                       SP("-2:");
+                               if (req->data_sock->sk)
+                                       SP_HOST(inet_sk(req->data_sock->sk)->daddr,
+                                               inet_sk(req->data_sock->sk)->dport);
+                               else
+                                       SP("-1:-1 ");
+                       } else
+                               SP("-1 ");
+               }
+               SP("%p/%p %p/%p ", req->sock, req->sock ? req->sock->sk : (void *)-1, req->data_sock, req->data_sock ? req->data_sock->sk : (void *)-1);
+
+               SP("%d\n", req->parsed_len);
+               len = req->headers_len;
+               if (len > 500)
+                       len = 500;
+               SP("\n%d\n", len);
+               memcpy(stat_line + line_off, req->headers, len);
+               line_off += len;
+               len = req->objectname_len;
+               if (len > 100)
+                       len = 100;
+               SP("\n%d\n", len);
+               memcpy(stat_line + line_off, req->objectname, len);
+               line_off += len;
+               SP("\n\n<END>");
+               if (line_off >= LINE_SIZE)
+                       BUG();
+               Dprintk("printing req %p, count %d, page %p: {%s}.\n", req, count, page, stat_line);
+               size = sprintf(page, "%-*s\n", LINE_SIZE-1, stat_line);
+               if (size != LINE_SIZE)
+                       BUG();
+               page += LINE_SIZE;
+               if (count-skip_count >= max_count)
+                       break;
+       }
+
+       Dprintk("count: %d.\n", count-skip_count);
+       return count - skip_count;
+}
+
+static int stat_read_proc (char *page, char **start, off_t off,
+                       int max_size, int *eof, void *data)
+{
+       unsigned int i, nr_total = 0, nr, nr_off, nr_skip, size = 0, nr_wanted;
+
+       Dprintk("START, page: %p, max_size: %d, off: %ld.\n", page, max_size, off);
+       *eof = 1;
+       if (max_size & LINE_MASK)
+               return 0;
+       if (off & LINE_MASK)
+               return 0;
+       if (!max_size)
+               return 0;
+
+       nr_off = off/LINE_SIZE;
+
+       for (i = 0; i < nr_tux_threads; i++) {
+               threadinfo_t *ti = threadinfo + i;
+               spin_lock_irq(&ti->work_lock);
+               nr = ti->nr_requests;
+               Dprintk("ti: %p, nr: %d, nr_total: %d, nr_off: %d.\n", ti, nr, nr_total, nr_off);
+               nr_total += nr;
+               if (nr_off >= nr_total) {
+                       spin_unlock_irq(&ti->work_lock);
+                       continue;
+               }
+               nr_skip = nr_off - (nr_total - nr);
+               nr_wanted = (max_size-size) / LINE_SIZE;
+               Dprintk("nr_skip: %d, nr_wanted: %d.\n", nr_skip, nr_wanted);
+               nr = print_request_stats(ti, page + size, nr_skip, nr_wanted);
+               spin_unlock_irq(&ti->work_lock);
+               nr_off += nr;
+               size += nr * LINE_SIZE;
+               Dprintk("ret: %d requests, size: %d.\n", nr, size);
+               if (size > max_size)
+                       BUG();
+               if (size == max_size)
+                       break;
+       }
+       Dprintk("DONE: size: %d.\n", size);
+
+       *start = page;
+
+       if (size)
+               *eof = 0;
+       return size;
+}
+
+static int stat_write_proc (struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+       return -EINVAL;
+}
+
+#define MAX_STRING "http://255.255.255.255:65535"
+#define MAX_STRINGLEN (sizeof(MAX_STRING))
+
+#define INACTIVE_1 "[inactive]\n"
+#define INACTIVE_2 "0\n"
+
+static int listen_read_proc (char *page, char **start, off_t off,
+                       int count, int *eof, void *data)
+{
+       tux_socket_t *listen = data;
+
+       if (count < MAX_STRINGLEN)
+               return -EINVAL;
+
+       if (!listen->proto)
+               return sprintf(page, INACTIVE_1);
+
+       return sprintf (page, "%s://%u.%u.%u.%u:%hu\n", listen->proto->name,
+                       HIPQUAD(listen->ip), listen->port);
+}
+
+static int listen_write_proc (struct file *file, const char *buffer,
+                                       unsigned long count, void *data)
+{
+       char string [MAX_STRINGLEN];
+       unsigned int d1, d2, d3, d4;
+       unsigned short port;
+       tux_socket_t *listen = data;
+
+       if (!count)
+               return -EINVAL;
+       if (count > MAX_STRINGLEN)
+               count = MAX_STRINGLEN;
+       if (copy_from_user(string, buffer, count))
+               return -EFAULT;
+       string[count] = 0;
+
+       if (!strcmp(string, INACTIVE_1) || !strcmp(string, INACTIVE_2)) {
+               listen->proto = NULL;
+               listen->ip = 0;
+               listen->port = 0;
+               return count;
+       }
+
+#define MK_IP(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | d)
+
+        if (sscanf(string, "http://%u.%u.%u.%u:%hu\n",
+                                       &d1, &d2, &d3, &d4, &port) == 5) {
+               listen->ip = MK_IP(d1,d2,d3,d4);
+               listen->port = port;
+               listen->proto = &tux_proto_http;
+               return count;
+       }
+               
+        if (sscanf(string, "ftp://%u.%u.%u.%u:%hu\n",
+                                       &d1, &d2, &d3, &d4, &port) == 5) {
+               listen->ip = MK_IP(d1,d2,d3,d4);
+               listen->port = port;
+               listen->proto = &tux_proto_ftp;
+               return count;
+       }
+       printk(KERN_ERR "tux: invalid listen-socket parameters: %s\n", string);
+       return -EINVAL;
+}
+
+#define MAX_NAMELEN 10
+
+static void register_tux_proc (unsigned int nr)
+{
+       struct proc_dir_entry *entry;
+       char name [MAX_NAMELEN];
+       int i;
+
+       if (!root_tux_dir)
+               TUX_BUG();
+
+       sprintf(name, "%d", nr);
+
+       /* create /proc/net/tux/1234/ */
+       tux_dir[nr] = proc_mkdir(name, root_tux_dir);
+
+       /* create /proc/net/tux/1234/listen/ */
+       listen_dir[nr] = proc_mkdir("listen", tux_dir[nr]);
+
+       /* create /proc/net/tux/1234/listen/ */
+       for (i = 0; i < CONFIG_TUX_NUMSOCKETS; i++) {
+               sprintf(name, "%d", i);
+               entry = create_proc_entry(name, 0700, listen_dir[nr]);
+
+               entry->nlink = 1;
+               entry->data = (void *)(tux_listen[nr] + i);
+               entry->read_proc = listen_read_proc;
+               entry->write_proc = listen_write_proc;
+               tux_listen[nr][i].entry = entry;
+       }
+}
+
+static void unregister_tux_proc (unsigned int nr)
+{
+       int i;
+
+       for (i = 0; i < CONFIG_TUX_NUMSOCKETS; i++) {
+               remove_proc_entry(tux_listen[nr][i].entry->name,listen_dir[nr]);
+               tux_listen[nr][i].entry = NULL;
+       }
+
+       remove_proc_entry(listen_dir[nr]->name, tux_dir[nr]);
+
+       remove_proc_entry(tux_dir[nr]->name, root_tux_dir);
+}
+
+static void cleanup_tux_proc (void)
+{
+       int i;
+
+       Dprintk("cleaning up /proc/net/tux/\n");
+
+       for (i = 0; i < CONFIG_TUX_NUMTHREADS; i++)
+               unregister_tux_proc(i);
+       remove_proc_entry(stat_entry->name, root_tux_dir);
+       remove_proc_entry(log_cpu_mask_entry->name, root_tux_dir);
+       remove_proc_entry(root_tux_dir->name, proc_net);
+}
+
+static void init_tux_proc (void)
+{
+       struct proc_dir_entry *entry;
+       int i;
+
+       if (root_tux_dir)
+               return;
+
+       /* create /proc/net/tux */
+       root_tux_dir = proc_mkdir("tux", proc_net);
+
+       entry = create_proc_entry("log_cpu_mask", 0700, root_tux_dir);
+
+       entry->nlink = 1;
+       entry->data = (void *)&log_cpu_mask;
+       entry->read_proc = hex_read_proc;
+       entry->write_proc = hex_write_proc;
+
+       log_cpu_mask_entry = entry;
+
+       entry = create_proc_entry("stat", 0700, root_tux_dir);
+
+       entry->nlink = 1;
+       entry->data = NULL;
+       entry->read_proc = stat_read_proc;
+       entry->write_proc = stat_write_proc;
+
+       stat_entry = entry;
+
+       /*
+        * Create entries for all existing threads.
+        */
+       for (i = 0; i < CONFIG_TUX_NUMTHREADS; i++)
+               register_tux_proc(i);
+}
+
+void start_sysctl(void)
+{
+       init_tux_proc();
+       tux_table_header = register_sysctl_table(tux_root_table,1);
+}
+
+void end_sysctl(void)
+{
+       cleanup_tux_proc();
+       unregister_sysctl_table(tux_table_header);
+}
+
+#if CONFIG_SMP
+void mask_to_cpumask(unsigned int mask, cpumask_t *cpu_mask)
+{
+
+       unsigned int bit_mask, i;
+
+       bit_mask = 1 << 31;
+
+       for (i=NR_CPUS-1; i--; i >= 0) {
+               if(mask & bit_mask)
+                       cpu_set(i, *cpu_mask);
+               else
+                       cpu_clear(i, *cpu_mask);
+               mask <<= 1;
+       }
+
+}
+#endif
+
diff --git a/net/tux/proto_ftp.c b/net/tux/proto_ftp.c
new file mode 100644 (file)
index 0000000..fbb9d8e
--- /dev/null
@@ -0,0 +1,1549 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * ftp_proto.c: FTP application protocol support
+ */
+
+#define __KERNEL_SYSCALLS__
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+#define HELLO          "220 Linux/TUX 3.0 FTP server welcomes you!\r\n"
+#define WRITE_DONE     "226 Transfer complete.\r\n"
+#define BAD_FILENAME   "550 No such file or directory.\r\n"
+#define GOOD_DIR       "250 CWD command successful.\r\n"
+#define LIST_ERR       "503 LIST without PORT! Closing connection.\r\n"
+#define LIST_ERR_MEM   "503 LIST could not allocate memory! Closing connection.\r\n"
+#define WRITE_FILE     "150 Opening BINARY mode data connection.\r\n"
+#define WRITE_LIST     "150 Opening ASCII mode data connection.\r\n"
+#define RETR_ERR       "503 RETR without PORT! Closing connection.\r\n"
+#define PORT_OK                "200 PORT command successful.\r\n"
+#define LOGIN_OK       "230-There are currently %d users logged in, out of %d maximum.\r\n230-Bandwidth served by TUX currently: %d KB/sec\r\n230 TUX Guest login ok.\r\n"
+#define LOGIN_OK_ONE   "230-There is currently 1 user logged in, out of %d maximum.\r\n230-Bandwidth served by TUX currently: %d KB/sec\r\n230 TUX Guest login ok.\r\n"
+#define LOGIN_OK_PASS  "230 TUX Guest login ok.\r\n"
+#define LOGIN_FORBIDDEN        "530 Sorry, Login Denied!\r\n"
+#define TYPE_OK                "200 Type set to I.\r\n"
+#define BYE            "221 Thank You for using TUX!\r\n"
+#define NOT_IMPLEMENTED        "502 Command not implemented.\r\n"
+#define CLOSE_2                "221 Cannot handle request, closing connection!\r\n"
+#define CLOSE          "500 Unknown command.\r\n"
+#define CLOSE_TIMEOUT  "421 Timeout, closing connection!\r\n"
+#define LINUX_SYST     "215 UNIX Type: L8, Linux/TUX/3.0\r\n"
+#define COMMAND_OK     "200 Command OK.\r\n"
+#define REST_OK                "350 Restart offset OK.\r\n"
+#define WRITE_ABORTED  "426 Transfer aborted, data connection closed.\r\n"
+#define SITE           "214 No SITE commands are recognized.\r\n"
+
+#define INTERVAL 10
+
+unsigned long last_measurement;
+unsigned int ftp_bytes_sent;
+unsigned int ftp_bandwidth;
+
+static void __update_bandwidth (tux_req_t *req, unsigned int bytes)
+{
+       /*
+        * Bandwidth measurement. Not completely accurate,
+        * but it's good enough and lightweight enough.
+        */
+       if (jiffies >= last_measurement + INTERVAL*HZ) {
+               ftp_bandwidth = (ftp_bytes_sent + 1023)/INTERVAL/1024;
+               ftp_bytes_sent = 0;
+               last_measurement = jiffies;
+       }
+       if (bytes)
+               atomic_add(bytes, (atomic_t *)&ftp_bytes_sent);
+       Dprintk("update_bandwidth(%p,%d), bytes_sent: %d, bandwidth: %d.\n",
+               req, bytes, ftp_bytes_sent, ftp_bandwidth);
+}
+
+#define update_bandwidth(req,bytes)                            \
+       do {                                                    \
+               if (unlikely(tux_ftp_login_message))            \
+                       __update_bandwidth(req, bytes);         \
+       } while (0)
+
+static inline void __ftp_send_async_message (tux_req_t *req,
+                const char *message, int status, unsigned int size)
+{
+       update_bandwidth(req, size);
+       __send_async_message(req, message, status, size, 1);
+}
+
+#define ftp_send_async_message(req,str,status) \
+               __ftp_send_async_message(req,str,status,sizeof(str)-1)
+
+
+static void ftp_flush_req (tux_req_t *req, int cachemiss)
+{
+       tux_push_pending(req->sock->sk);
+       add_req_to_workqueue(req);
+}
+
+static void ftp_execute_command (tux_req_t *req, int cachemiss);
+
+static void ftp_lookup_vhost (tux_req_t *req, int cachemiss)
+{
+       struct dentry *dentry;
+       struct nameidata base;
+       struct vfsmount *mnt = NULL;
+       unsigned int flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       char ip[3+1+3+1+3+1+3 + 2];
+
+       sprintf(ip, "%d.%d.%d.%d", NIPQUAD(inet_sk(req->sock->sk)->rcv_saddr));
+       Dprintk("ftp_lookup_vhost(%p, %d, virtual: %d, host: %s.)\n", 
+               req, flag, req->virtual, ip);
+
+       base.flags = LOOKUP_FOLLOW|flag;
+       base.last_type = LAST_ROOT;
+       base.dentry = dget(req->proto->main_docroot.dentry);
+       base.mnt = mntget(req->proto->main_docroot.mnt);
+
+       dentry = __tux_lookup(req, ip, &base, &mnt);
+
+       Dprintk("looked up dentry %p.\n", dentry);
+       if (dentry && !IS_ERR(dentry) && !dentry->d_inode)
+               TUX_BUG();
+
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       add_tux_atom(req, ftp_lookup_vhost);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto abort;
+       }
+
+       req->docroot_dentry = dentry;
+       req->docroot_mnt = mnt;
+
+       add_tux_atom(req, ftp_execute_command);
+       add_req_to_workqueue(req);
+       return;
+abort:
+       if (dentry) {
+               if (!IS_ERR(dentry))
+                       dput(dentry);
+               dentry = NULL;
+       }
+       if (mnt) {
+               if (!IS_ERR(mnt))
+                       mntput(mnt);
+               mnt = NULL;
+       }
+       req_err(req);
+       add_req_to_workqueue(req);
+}
+
+static void ftp_got_request (tux_req_t *req)
+{
+       add_tux_atom(req, parse_request);
+       add_tux_atom(req, ftp_flush_req);
+       ftp_send_async_message(req, HELLO, 220);
+}
+
+#define GOTO_ERR { TDprintk("FTP protocol error at: %s:%d\n", \
+                       __FILE__, __LINE__); goto error; }
+
+static void zap_data_socket (tux_req_t *req)
+{
+       if (!req->data_sock)
+               return;
+       Dprintk("zapping req %p's data socket %p.\n", req, req->data_sock);
+
+       unlink_tux_data_socket(req);
+       sock_release(req->data_sock);
+       req->data_sock = NULL;
+}
+
+static int parse_ftp_message (tux_req_t *req, const int total_len)
+{
+       int comm, comm1 = 0, comm2 = 0, comm3 = 0, comm4 = 0;
+       int newline_pos, i;
+       const char *mess, *curr;
+
+       curr = mess = req->headers;
+
+       Dprintk("FTP parser got %d bytes: --->{%s}<---\n", total_len, curr);
+
+       newline_pos = -1;
+       for (i = 0; i < total_len; i++, curr++) {
+               if (!*curr)
+                       GOTO_ERR;
+               if (!(*curr == '\r') || !(*(curr+1) == '\n'))
+                       continue;
+               newline_pos = i;
+               break;
+       }
+       Dprintk("Newline pos: %d\n", newline_pos);
+       if (newline_pos == -1) {
+               Dprintk("incomplete mess on req %p!\n", req);
+               return 0;
+       }
+       if (newline_pos < 3)
+               GOTO_ERR;
+
+#define toup(c) ((((c) >= 'a') && ((c) <= 'z')) ? ((c) + 'A' - 'a') : (c))
+
+#define STRING_VAL(c1,c2,c3,c4) \
+       (toup(c1) + (toup(c2) << 8) + (toup(c3) << 16) + (toup(c4) << 24))
+
+#define STRING_VAL_STR(str) \
+               STRING_VAL(str[0], str[1], str[2], str[3])
+
+       Dprintk("string val (%c%c%c%c): %08x\n",
+               mess[0], mess[1], mess[2], mess[3],
+               STRING_VAL_STR(mess));
+
+#define PARSE_FTP_COMM(c1,c2,c3,c4,name,num)                   \
+       if (STRING_VAL_STR(mess) == STRING_VAL(c1,c2,c3,c4))    \
+       {                                                       \
+               Dprintk("parsed "#name".\n");                   \
+               comm##num = FTP_COMM_##name;                    \
+       }
+
+       PARSE_FTP_COMM('A','C','C','T', ACCT,2);
+       PARSE_FTP_COMM('C','D','U','P', CDUP,3);
+       PARSE_FTP_COMM('S','M','N','T', SMNT,4);
+       PARSE_FTP_COMM('Q','U','I','T', QUIT,1);
+       PARSE_FTP_COMM('R','E','I','N', REIN,2);
+       PARSE_FTP_COMM('P','A','S','V', PASV,3);
+       PARSE_FTP_COMM('S','T','R','U', STRU,4); 
+       PARSE_FTP_COMM('S','T','O','R', STOR,2); 
+       PARSE_FTP_COMM('S','T','O','U', STOU,3); 
+       PARSE_FTP_COMM('A','P','P','E', APPE,4); 
+       PARSE_FTP_COMM('A','L','L','O', ALLO,1); 
+       PARSE_FTP_COMM('R','N','F','R', RNFR,2); 
+       PARSE_FTP_COMM('R','N','T','O', RNTO,3); 
+       PARSE_FTP_COMM('A','B','O','R', ABOR,4); 
+       PARSE_FTP_COMM('D','E','L','E', DELE,1); 
+       PARSE_FTP_COMM('R','M','D',' ', RMD, 2); 
+       PARSE_FTP_COMM('M','K','D',' ', MKD, 3); 
+       PARSE_FTP_COMM('P','W','D',' ', PWD, 4); 
+       PARSE_FTP_COMM('S','Y','S','T', SYST,2); 
+       PARSE_FTP_COMM('N','O','O','P', NOOP,3); 
+       PARSE_FTP_COMM('F','E','A','T', FEAT,4); 
+
+       comm = comm1 | comm2 | comm3 | comm4;
+
+       if (comm) {
+               if (newline_pos != 4)
+                       GOTO_ERR;
+               req->ftp_command = comm;
+               goto out;
+       }
+       
+       switch (STRING_VAL(mess[0], mess[1], mess[2], mess[3])) {
+
+#define PARSE_FTP_COMM_3CHAR(c1,c2,c3,name)                            \
+               case STRING_VAL(c1,c2,c3,'\r'):                         \
+               {                                                       \
+                       Dprintk("parsed "#name".\n");                   \
+                       req->ftp_command = FTP_COMM_##name;             \
+                       if (newline_pos != 3)                           \
+                               GOTO_ERR;                               \
+               }
+
+#define PARSE_FTP_3CHAR_COMM_IGNORE(c1,c2,c3,name)                     \
+               case STRING_VAL(c1,c2,c3,' '):                          \
+               {                                                       \
+                       Dprintk("parsed "#name".\n");                   \
+                       req->ftp_command = FTP_COMM_##name;             \
+               }
+
+#define PARSE_FTP_COMM_IGNORE(c1,c2,c3,c4,name)                                \
+               case STRING_VAL(c1,c2,c3,c4):                           \
+               {                                                       \
+                       Dprintk("parsed "#name".\n");                   \
+                       req->ftp_command = FTP_COMM_##name;             \
+               }
+
+#define PARSE_FTP_3CHAR_COMM_1_FIELD(c1,c2,c3,name,field,field_len,max)        \
+               case STRING_VAL(c1,c2,c3,' '):                          \
+               {                                                       \
+                       Dprintk("parsed "#name".\n");                   \
+                       req->ftp_command = FTP_COMM_##name;             \
+                       if (newline_pos == 4)                           \
+                               GOTO_ERR;                               \
+                       if (newline_pos >= 5) {                         \
+                               curr = mess + 3;                        \
+                               if (*curr++ != ' ')                     \
+                                       GOTO_ERR;                       \
+                               *(field_len) = newline_pos-4;           \
+                               if (*(field_len) >= max)                \
+                                       GOTO_ERR;                       \
+                               memcpy(field, curr, *(field_len));      \
+                               (field)[*(field_len)] = 0;              \
+                       }                                               \
+               }
+
+#define PARSE_FTP_COMM_1_FIELD(c1,c2,c3,c4,name,field,field_len,max)   \
+               case STRING_VAL(c1,c2,c3,c4):                           \
+               {                                                       \
+                       Dprintk("parsed "#name".\n");                   \
+                       req->ftp_command = FTP_COMM_##name;             \
+                       if (newline_pos < 4)                            \
+                               GOTO_ERR;                               \
+                       if (newline_pos == 4)                           \
+                               *(field_len) = 0;                       \
+                       else {                                          \
+                               curr = mess + 4;                        \
+                               if (*curr++ != ' ')                     \
+                                       GOTO_ERR;                       \
+                               *(field_len) = newline_pos-5;           \
+                               if (*(field_len) >= max)                \
+                                       GOTO_ERR;                       \
+                               memcpy(field, curr, *(field_len));      \
+                               (field)[*(field_len)] = 0;              \
+                       }                                               \
+               }
+
+               PARSE_FTP_COMM_1_FIELD('U','S','E','R', USER,
+                       req->username, &req->username_len,
+                       MAX_USERNAME_LEN-1);
+               if (!req->username_len)
+                       GOTO_ERR;
+               break;
+
+               {
+                       #define MAX_PASS_LEN 100
+                       char pass[MAX_PASS_LEN];
+                       unsigned int pass_len;
+                       PARSE_FTP_COMM_1_FIELD('P','A','S','S', PASS,
+                               pass, &pass_len,
+                               MAX_PASS_LEN-1);
+                       if (!pass_len)
+                               GOTO_ERR;
+                       break;
+               }
+
+               PARSE_FTP_3CHAR_COMM_1_FIELD('C','W','D', CWD,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (!req->objectname_len)
+                       GOTO_ERR;
+               req->uri_str = req->objectname;
+               req->uri_len = req->objectname_len;
+               break;
+
+               PARSE_FTP_COMM_3CHAR('P','W','D', PWD); break;
+
+               {
+                       char type[3];
+                       unsigned int type_len;
+
+                       PARSE_FTP_COMM_1_FIELD('T','Y','P','E', TYPE,
+                               type, &type_len, 2);
+                       if (!type_len)
+                               GOTO_ERR;
+                       if ((type[0] != 'I') && (type[0] != 'A'))
+                               GOTO_ERR;
+               }
+               break;
+
+               PARSE_FTP_COMM_1_FIELD('R','E','T','R', RETR,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (!req->objectname_len) {
+                       zap_data_socket(req);
+                       req->ftp_command = FTP_COMM_NONE;
+               }
+               req->uri_str = req->objectname;
+               req->uri_len = req->objectname_len;
+               break;
+
+               PARSE_FTP_COMM_1_FIELD('S','I','Z','E', SIZE,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (!req->objectname_len)
+                       req->ftp_command = FTP_COMM_NONE;
+               req->uri_str = req->objectname;
+               req->uri_len = req->objectname_len;
+               break;
+
+               PARSE_FTP_COMM_1_FIELD('M','D','T','M', MDTM,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (!req->objectname_len)
+                       req->ftp_command = FTP_COMM_NONE;
+               req->uri_str = req->objectname;
+               req->uri_len = req->objectname_len;
+               break;
+
+               PARSE_FTP_COMM_IGNORE('M','O','D','E', MODE);
+               break;
+
+               PARSE_FTP_COMM_IGNORE('S','T','A','T', STAT);
+               break;
+
+               PARSE_FTP_COMM_IGNORE('S','I','T','E', SITE);
+               break;
+
+               PARSE_FTP_COMM_1_FIELD('L','I','S','T', LIST,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (req->objectname[0] == '-') {
+                       req->objectname_len = 0;
+                       req->objectname[0] = 0;
+               }
+               if (req->objectname_len) {
+                       req->uri_str = req->objectname;
+                       req->uri_len = req->objectname_len;
+               }
+               break;
+
+               PARSE_FTP_COMM_1_FIELD('N','L','S','T', NLST,
+                       req->objectname, &req->objectname_len,
+                       MAX_OBJECTNAME_LEN-1);
+               if (req->objectname[0] == '-') {
+                       req->objectname_len = 0;
+                       req->objectname[0] = 0;
+               }
+               if (req->objectname_len) {
+                       req->uri_str = req->objectname;
+                       req->uri_len = req->objectname_len;
+               }
+               break;
+
+               PARSE_FTP_COMM_IGNORE('H','E','L','P', HELP);
+               break;
+
+               PARSE_FTP_COMM_IGNORE('C','L','N','T', CLNT);
+               break;
+
+#define IS_NUM(n) (((n) >= '0') && ((n) <= '9'))
+
+#define GET_DIGIT(curr,n)                              \
+       n += (*curr) - '0';                             \
+       curr++;                                         \
+       if (IS_NUM(*curr)) {                            \
+               n *= 10;
+
+#define PARSE_PORTNUM(curr,n)                          \
+do {                                                   \
+       Dprintk("PORT NUM parser:--->{%s}<---\n", curr);\
+       if (!IS_NUM(*curr))                             \
+               GOTO_ERR;                               \
+       n = 0;                                          \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       }}}                                             \
+       if (n > 255)                                    \
+               GOTO_ERR;                               \
+       Dprintk("PORT NUM parser:--->{%s}<---\n", curr);\
+       Dprintk("PORT NUM parser parsed %d.\n", n);     \
+} while (0)
+
+#define PARSE_NUM(curr,n)                              \
+do {                                                   \
+       Dprintk("NUM parser:--->{%s}<---\n", curr);     \
+       if (!IS_NUM(*curr))                             \
+               GOTO_ERR;                               \
+       n = 0;                                          \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       GET_DIGIT(curr,n);                              \
+       }}}}}}}}}}                                      \
+       Dprintk("NUM parser:--->{%s}<---\n", curr);     \
+       Dprintk("NUM parser parsed %d.\n", n);          \
+} while (0)
+
+               case STRING_VAL('P','O','R','T'):
+               {
+                       unsigned int h1, h2, h3, h4, p1, p2;
+                       if (req->data_sock)
+                               zap_data_socket(req);
+                       /*
+                        * Minimum size: "PORT 0,0,0,0,0,0", 16 bytes.
+                        */
+                       if (newline_pos < 16)
+                               GOTO_ERR;
+                       Dprintk("parsed PORT.\n");
+                       if (req->data_sock)
+                               GOTO_ERR;
+                       curr = mess + 4;
+                       if (*curr++ != ' ')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,h1);
+                       if (*curr++ != ',')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,h2);
+                       if (*curr++ != ',')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,h3);
+                       if (*curr++ != ',')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,h4);
+                       if (*curr++ != ',')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,p1);
+                       if (*curr++ != ',')
+                               GOTO_ERR;
+                       PARSE_PORTNUM(curr,p2);
+                       if (curr-mess != newline_pos)
+                               GOTO_ERR;
+                       req->ftp_command = FTP_COMM_PORT;
+                       req->ftp_user_addr = (h1<<24) + (h2<<16) + (h3<<8) + h4;
+                       req->ftp_user_port = (p1<<8) + p2;
+                       Dprintk("FTP PORT got: %d.%d.%d.%d:%d.\n",
+                               h1, h2, h3, h4, req->ftp_user_port);
+                       Dprintk("FTP user-addr: %08x (htonl: %08x), socket: %08x.\n",
+                               req->ftp_user_addr, htonl(req->ftp_user_addr),
+                               inet_sk(req->sock->sk)->daddr);
+                       /*
+                        * Do not allow redirection of connections, and do
+                        * not allow reserved ports to be accessed.
+                        */
+                       if (inet_sk(req->sock->sk)->daddr != htonl(req->ftp_user_addr))
+                               GOTO_ERR;
+                       if (req->ftp_user_port < 1024)
+                               GOTO_ERR;
+                       break;
+               }
+               case STRING_VAL('R','E','S','T'):
+               {
+                       unsigned int offset;
+
+                       /*
+                        * Minimum size: "REST 0", 6 bytes.
+                        */
+                       if (newline_pos < 6)
+                               GOTO_ERR;
+                       Dprintk("parsed REST.\n");
+                       curr = mess + 4;
+                       if (*curr++ != ' ')
+                               GOTO_ERR;
+                       PARSE_NUM(curr,offset);
+                       if (curr-mess != newline_pos)
+                               GOTO_ERR;
+                       req->ftp_command = FTP_COMM_REST;
+                       req->ftp_offset_start = offset;
+                       Dprintk("FTP REST got: %d bytes offset.\n", offset);
+
+                       break;
+               }
+               default:
+                       req->ftp_command = FTP_COMM_NONE;
+                       break;
+       }
+
+out:
+       req->parsed_len = newline_pos + 2;
+
+       req->virtual = tux_ftp_virtual_server;
+       if (req->virtual)
+               add_tux_atom(req, ftp_lookup_vhost);
+       else {
+               req->docroot_dentry = dget(req->proto->main_docroot.dentry);
+               req->docroot_mnt = mntget(req->proto->main_docroot.mnt);
+               add_tux_atom(req, ftp_execute_command);
+       }
+
+       return req->parsed_len;
+error:
+       clear_keepalive(req);
+       TDprintk("rejecting FTP session!\n");
+       TDprintk("mess     :--->{%s}<---\n", mess);
+       TDprintk("mess left:--->{%s}<---\n", curr);
+       req_err(req);
+       return -1;
+}
+
+static void ftp_wait_close (tux_req_t *req, int cachemiss);
+static void ftp_wait_syn (tux_req_t *req, int cachemiss);
+
+static int ftp_check_req_err (tux_req_t *req, int cachemiss)
+{
+       int state = req->sock->sk->sk_state;
+       int err = req->sock->sk->sk_err | req->error;
+       int urg = tcp_sk(req->sock->sk)->urg_data;
+
+       if (req->data_sock) {
+               urg |= tcp_sk(req->data_sock->sk)->urg_data;
+               state |= req->data_sock->sk->sk_state;
+               err |= req->data_sock->sk->sk_err;
+       }
+
+       if ((state <= TCP_SYN_RECV) && !err) {
+               if (!urg)
+                       return 0;
+               req->in_file.f_pos = 0;
+               add_tux_atom(req, flush_request);
+               zap_data_socket(req);
+               ftp_send_async_message(req, WRITE_ABORTED, 426);
+               return 1;
+       }
+#if CONFIG_TUX_DEBUG
+       req->bytes_expected = 0;
+       if (tux_TDprintk)
+               dump_stack();
+#endif
+       req->in_file.f_pos = 0;
+       TDprintk("zapping, data sock state: %d (err: %d, urg: %d)\n",
+               state, err, urg);
+       /*
+        * We are in the middle of a file transfer,
+        * zap it immediately:
+        */
+       req->error = TUX_ERROR_CONN_CLOSE;
+       zap_request(req, cachemiss);
+       return 1;
+}
+
+void ftp_send_file (tux_req_t *req, int cachemiss)
+{
+       int ret;
+
+       SET_TIMESTAMP(req->output_timestamp);
+repeat:
+       ret = generic_send_file(req, req->data_sock, cachemiss);
+       update_bandwidth(req, req->in_file.f_pos - req->prev_pos);
+       req->prev_pos = req->in_file.f_pos;
+
+       switch (ret) {
+               case -5:
+                       add_tux_atom(req, ftp_send_file);
+                       output_timeout(req);
+                       break;
+               case -4:
+                       add_tux_atom(req, ftp_send_file);
+                       if (add_output_space_event(req, req->data_sock)) {
+                               del_tux_atom(req);
+                               goto repeat;
+                       }
+                       break;
+               case -3:
+                       add_tux_atom(req, ftp_send_file);
+                       queue_cachemiss(req);
+                       break;
+               case -1:
+                       break;
+               default:
+                       req->in_file.f_pos = 0;
+
+                       if (tux_ftp_wait_close) {
+                               req->data_sock->ops->shutdown(req->data_sock, SEND_SHUTDOWN);
+                               add_tux_atom(req, ftp_wait_close);
+                               add_req_to_workqueue(req);
+                               return;
+                       }
+                       Dprintk("FTP send file req %p finished!\n", req);
+                       zap_data_socket(req);
+                       add_tux_atom(req, ftp_flush_req);
+                       if (req->error)
+                               ftp_send_async_message(req, BAD_FILENAME, 200);
+                       else
+                               ftp_send_async_message(req, WRITE_DONE, 200);
+                       break;
+       }
+}
+
+#define sk_syn(sk) \
+       (!(sk)->sk_err && ((1 << (sk)->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)))
+#define req_syn(req) \
+       (!(req)->error && sk_syn((req)->data_sock->sk))
+
+static void ftp_wait_syn (tux_req_t *req, int cachemiss)
+{
+       Dprintk("ftp_wait_syn in: data socket state %d.\n", req->data_sock->state);
+       if (req_syn(req)) {
+               spin_lock_irq(&req->ti->work_lock);
+               add_keepalive_timer(req);
+               if (test_and_set_bit(0, &req->idle_input))
+                       TUX_BUG();
+               spin_unlock_irq(&req->ti->work_lock);
+               if (req_syn(req)) {
+                       add_tux_atom(req, ftp_wait_syn);
+                       return;
+               }
+               unidle_req(req);
+       }
+       Dprintk("ftp_wait_syn out: data socket state %d.\n", req->data_sock->state);
+       add_req_to_workqueue(req);
+}
+
+static void ftp_wait_close (tux_req_t *req, int cachemiss)
+{
+       struct sock *sk = req->data_sock->sk;
+
+       Dprintk("ftp_wait_close: data socket state %d.\n", sk->sk_state);
+
+       if (!req->error && (sk->sk_state <= TCP_FIN_WAIT1) && !sk->sk_err) {
+               spin_lock_irq(&req->ti->work_lock);
+               add_keepalive_timer(req);
+               if (test_and_set_bit(0, &req->idle_input))
+                       TUX_BUG();
+               spin_unlock_irq(&req->ti->work_lock);
+               if (!req->error && (sk->sk_state <= TCP_FIN_WAIT1) && !sk->sk_err) {
+                       add_tux_atom(req, ftp_wait_close);
+                       return;
+               }
+               unidle_req(req);
+       }
+       zap_data_socket(req);
+       add_tux_atom(req, ftp_flush_req);
+       if (req->error)
+               ftp_send_async_message(req, BAD_FILENAME, 200);
+       else
+               ftp_send_async_message(req, WRITE_DONE, 200);
+}
+
+void ftp_get_size (tux_req_t *req, int cachemiss)
+{
+       char file_size[200];
+       int missed, len;
+
+       if (!req->dentry) {
+               missed = lookup_object(req, cachemiss ? 0 : LOOKUP_ATOMIC);
+               if (!missed && !req->dentry) {
+                       ftp_send_async_message(req, BAD_FILENAME, 200);
+                       return;
+               }
+               if (missed) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_get_size);
+                       queue_cachemiss(req);
+                       return;
+               }
+       }
+       req->in_file.f_pos = 0;
+       len = sprintf(file_size, "213 %Li\r\n", req->dentry->d_inode->i_size);
+       __ftp_send_async_message(req, file_size, 200, len);
+}
+
+void ftp_get_mdtm (tux_req_t *req, int cachemiss)
+{
+       unsigned int flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       struct dentry *dentry;
+       struct vfsmount *mnt = NULL;
+       char file_mdtm[200];
+       unsigned int len;
+       int err;
+
+       dentry = tux_lookup(req, req->objectname, flag, &mnt);
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_get_mdtm);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto out_err;
+       }
+       err = permission(dentry->d_inode, MAY_READ, NULL);
+       if (err)
+               goto out_err_put;
+
+       req->in_file.f_pos = 0;
+       len = mdtm_time (file_mdtm, dentry->d_inode->i_mtime.tv_sec);
+       dput(dentry);
+       mntput(mnt);
+       __ftp_send_async_message(req, file_mdtm, 200, len);
+       return;
+
+out_err_put:
+       dput(dentry);
+       mntput(mnt);
+out_err:
+       ftp_send_async_message(req, BAD_FILENAME, 550);
+}
+
+static void ftp_get_file (tux_req_t *req, int cachemiss)
+{
+       int missed;
+
+       if (!req->dentry) {
+               missed = lookup_object(req, cachemiss ? 0 : LOOKUP_ATOMIC);
+               if (!missed && !req->dentry) {
+                       ftp_send_async_message(req, BAD_FILENAME, 200);
+                       return;
+               }
+               if (missed) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_get_file);
+                       queue_cachemiss(req);
+                       return;
+               }
+       }
+       Dprintk("ftp_send_file %p, ftp_offset: %Ld, total_len: %Ld.\n", req, req->ftp_offset_start, req->total_file_len);
+       req->in_file.f_pos = 0;
+       if (req->ftp_offset_start) {
+               if (req->ftp_offset_start <= req->total_file_len) {
+                       req->offset_start = req->ftp_offset_start;
+                       req->in_file.f_pos = req->offset_start;
+               }
+               req->ftp_offset_start = 0;
+       }
+       req->output_len = req->total_file_len - req->offset_start;
+       req->prev_pos = req->in_file.f_pos;
+       Dprintk("ftp_send_file %p, f_pos: %Ld (out_len: %Ld).\n", req, req->in_file.f_pos, req->output_len);
+       add_tux_atom(req, ftp_send_file);
+       add_tux_atom(req, ftp_wait_syn);
+       add_tux_atom(req, ftp_flush_req);
+       ftp_send_async_message(req, WRITE_FILE, 200);
+}
+
+static void __exchange_sockets (tux_req_t *req)
+{
+       struct socket *tmp;
+
+       tmp = req->data_sock;
+       req->data_sock = req->sock;
+       req->sock = tmp;
+
+       req->in_file.f_pos = 0;
+}
+
+static void ftp_do_ls_start (tux_req_t *req, int cachemiss)
+{
+       Dprintk("ftp_do_ls_start(%p, %d).\n", req, cachemiss);
+       if (!req->cwd_dentry)
+               TUX_BUG();
+       __exchange_sockets(req);
+       queue_cachemiss(req);
+}
+
+static void ftp_do_ls_end (tux_req_t *req, int cachemiss)
+{
+       Dprintk("ftp_do_ls_end(%p, %d).\n", req, cachemiss);
+       __exchange_sockets(req);
+       if (tux_ftp_wait_close) {
+               req->data_sock->ops->shutdown(req->data_sock, SEND_SHUTDOWN);
+               add_tux_atom(req, ftp_wait_close);
+               add_req_to_workqueue(req);
+               return;
+       }
+       zap_data_socket(req);
+       add_tux_atom(req, ftp_flush_req);
+       if (req->error)
+               ftp_send_async_message(req, BAD_FILENAME, 200);
+       else
+               ftp_send_async_message(req, WRITE_DONE, 200);
+}
+
+static void ftp_chdir (tux_req_t *req, int cachemiss)
+{
+       unsigned int flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       struct dentry *dentry;
+       struct vfsmount *mnt = NULL;
+       int err;
+
+       Dprintk("ftp_chdir(%p, %d, {%s})\n", req, cachemiss, req->objectname);
+       dentry = tux_lookup(req, req->objectname, flag, &mnt);
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_chdir);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto out_err;
+       }
+       err = permission(dentry->d_inode, MAY_EXEC, NULL);
+       if (err)
+               goto out_err_put;
+       req->cwd_dentry = dentry;
+       req->cwd_mnt = mnt;
+       ftp_send_async_message(req, GOOD_DIR, 200);
+       return;
+
+out_err_put:
+       dput(dentry);
+       mntput(mnt);
+out_err:
+       ftp_send_async_message(req, BAD_FILENAME, 550);
+}
+
+void ftp_accept_pasv (tux_req_t *req, int cachemiss)
+{
+       struct socket *sock, *new_sock = NULL;
+       struct tcp_opt *tp1, *tp2;
+       int err;
+
+       tp1 = tcp_sk(req->data_sock->sk);
+
+       Dprintk("PASV accept on req %p, accept_queue: %p.\n",
+                       req, tp1->accept_queue);
+       if (req->error || (req->data_sock->sk->sk_state != TCP_LISTEN))
+               goto error;
+new_socket:
+       if (!tp1->accept_queue) {
+               spin_lock_irq(&req->ti->work_lock);
+               add_keepalive_timer(req);
+               if (test_and_set_bit(0, &req->idle_input))
+                       TUX_BUG();
+               spin_unlock_irq(&req->ti->work_lock);
+               if (!tp1->accept_queue) {
+                       add_tux_atom(req, ftp_accept_pasv);
+                       return;
+               }
+               unidle_req(req);
+       }
+       new_sock = sock_alloc();
+       if (!new_sock)
+               goto error;
+       sock = req->data_sock;
+       new_sock->type = sock->type;
+       new_sock->ops = sock->ops;
+
+       err = sock->ops->accept(sock, new_sock, O_NONBLOCK);
+       Dprintk("PASV accept() returned %d (state %d).\n", err, new_sock->sk->sk_state);
+       if (err < 0)
+               goto error;
+       if (new_sock->sk->sk_state != TCP_ESTABLISHED)
+               goto error;
+       /*
+        * Do not allow other clients to steal the FTP connection!
+        */
+       if (inet_sk(new_sock->sk)->daddr != inet_sk(req->sock->sk)->daddr) {
+               Dprintk("PASV: ugh, unauthorized connect?\n");
+               sock_release(new_sock);
+               new_sock = NULL;
+               goto new_socket;
+       }
+       /*
+        * Zap the listen socket:
+        */
+       zap_data_socket(req);
+
+       tp2 = tcp_sk(new_sock->sk);
+       tp2->nonagle = 2;
+       tp2->ack.pingpong = tux_ack_pingpong;
+       new_sock->sk->sk_reuse = 1;
+       sock_set_flag(new_sock->sk, SOCK_URGINLINE);
+       sock_reset_flag(new_sock->sk, SOCK_LINGER);
+
+       link_tux_data_socket(req, new_sock);
+       add_req_to_workqueue(req);
+       return;
+
+error:
+       if (new_sock)
+               sock_release(new_sock);
+       req_err(req);
+       zap_data_socket(req);
+       ftp_send_async_message(req, CLOSE, 500);
+}
+
+static char * ftp_print_dir_line (tux_req_t *req, char *tmp, char *d_name, int d_len, int d_type, struct dentry *dentry, struct inode *inode)
+{
+       char *string0 = tmp;
+       unsigned int size;
+
+       if (req->ftp_command == FTP_COMM_NLST) {
+               memcpy(tmp, d_name, d_len);
+               tmp += d_len;
+               *tmp++ = '\r';
+               *tmp++ = '\n';
+               *tmp = 0;
+               return tmp;
+       }
+       switch (d_type) {
+               default:
+               case DT_UNKNOWN:
+               case DT_WHT:
+                       if (tux_hide_unreadable)
+                               goto out_dput;
+                       *tmp++ = '?';
+                       break;
+
+               case DT_FIFO:
+                       if (tux_hide_unreadable)
+                               goto out_dput;
+                       *tmp++ = 'p';
+                       break;
+
+               case DT_CHR:
+                       if (tux_hide_unreadable)
+                               goto out_dput;
+                       *tmp++ = 'c';
+                       break;
+
+               case DT_DIR:
+                       *tmp++ = 'd';
+                       break;
+
+               case DT_BLK:
+                       if (tux_hide_unreadable)
+                               goto out_dput;
+                       *tmp++ = 'b';
+                       break;
+
+               case DT_REG:
+                       *tmp++ = '-';
+                       break;
+
+               case DT_LNK:
+                       *tmp++ = 'l';
+                       break;
+
+               case DT_SOCK:
+                       if (tux_hide_unreadable)
+                               goto out_dput;
+                       *tmp++ = 's';
+                       break;
+       }
+
+       if (inode->i_mode & S_IRUSR) *tmp++ = 'r'; else *tmp++ = '-';
+       if (inode->i_mode & S_IWUSR) *tmp++ = 'w'; else *tmp++ = '-';
+       if (inode->i_mode & S_IXUSR) *tmp++ = 'x'; else *tmp++ = '-';
+       if (inode->i_mode & S_IRGRP) *tmp++ = 'r'; else *tmp++ = '-';
+       if (inode->i_mode & S_IWGRP) *tmp++ = 'w'; else *tmp++ = '-';
+       if (inode->i_mode & S_IXGRP) *tmp++ = 'x'; else *tmp++ = '-';
+       if (inode->i_mode & S_IROTH) *tmp++ = 'r'; else *tmp++ = '-';
+       if (inode->i_mode & S_IWOTH) *tmp++ = 'w'; else *tmp++ = '-';
+       if (inode->i_mode & S_IXOTH) *tmp++ = 'x'; else *tmp++ = '-';
+
+       *tmp++ = ' ';
+
+       size = sprintf(tmp, "%4i %d", inode->i_nlink, inode->i_uid);
+       tmp += size;
+
+       size = 14 - size;
+       if (size <= 0)
+               size = 1;
+       memset(tmp, ' ', size);
+       tmp += size;
+
+       size = sprintf(tmp, "%d", inode->i_gid);
+       tmp += size;
+
+       size = 9 - size;
+       if (size <= 0)
+               size = 1;
+       memset(tmp, ' ', size);
+       tmp += size;
+
+       tmp += sprintf(tmp, "%8Li", inode->i_size);
+       *tmp++ = ' ';
+
+       tmp += time_unix2ls(inode->i_mtime.tv_sec, tmp);
+       *tmp++ = ' ';
+
+       memcpy(tmp, d_name, d_len);
+       tmp += d_len;
+
+       if (d_type == DT_LNK) {
+               int len = 0, max_len;
+               #define ARROW " -> "
+
+               memcpy(tmp, ARROW, sizeof(ARROW)-1);
+               tmp += sizeof(ARROW)-1;
+               max_len = MAX_OBJECTNAME_LEN-(tmp-string0);
+               if (inode->i_op && inode->i_op->readlink) {
+                       mm_segment_t oldmm;
+
+                       oldmm = get_fs(); set_fs(KERNEL_DS);
+                       set_fs(KERNEL_DS);
+                       len = inode->i_op->readlink(dentry, tmp, max_len);
+                       set_fs(oldmm);
+               }
+               if (len > 0)
+                       tmp += len;
+               else
+                       Dprintk("hm, readlink() returned %d.\n", len);
+       }
+       *tmp++ = '\r';
+       *tmp++ = '\n';
+       *tmp = 0;
+
+       return tmp;
+out_dput:
+       return NULL;
+}
+
+static void ftp_do_ls_onefile (tux_req_t *req, int cachemiss)
+{
+       char string0[MAX_OBJECTNAME_LEN+200], *tmp;
+
+       tmp = ftp_print_dir_line(req, string0, req->objectname, req->objectname_len,
+DT_REG, req->dentry, req->dentry->d_inode);
+       if (!tmp) {
+               req_err(req);
+               add_req_to_workqueue(req);
+               return;
+       }
+       if (tmp - string0 >= MAX_OBJECTNAME_LEN+200)
+               BUG();
+       __ftp_send_async_message(req, string0, 200, tmp - string0);
+}
+
+static void ftp_lookup_listfile (tux_req_t *req, int cachemiss)
+{
+       unsigned int flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       struct dentry *dentry;
+       struct vfsmount *mnt = NULL;
+       int err;
+
+       Dprintk("ftp_lookup_listfile(%p, %d, {%s})\n", req, cachemiss, req->objectname);
+       dentry = tux_lookup(req, req->objectname, flag, &mnt);
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       if (cachemiss)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_lookup_listfile);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto out_err;
+       }
+
+       if (S_ISDIR(dentry->d_inode->i_mode)) {
+               err = permission(dentry->d_inode, MAY_EXEC, NULL);
+               if (err) {
+                       Dprintk("Directory permission error: %d.\n", err);
+                       goto out_err_put;
+               }
+               install_req_dentry(req, dentry, mnt);
+
+               add_tux_atom(req, ftp_do_ls_end);
+               if (!req->cwd_dentry)
+                       TUX_BUG();
+               add_tux_atom(req, list_directory);
+       } else {
+               install_req_dentry(req, dentry, mnt);
+
+               add_tux_atom(req, ftp_do_ls_end);
+               add_tux_atom(req, ftp_do_ls_onefile);
+       }
+
+       add_tux_atom(req, ftp_do_ls_start);
+       add_tux_atom(req, ftp_wait_syn);
+       add_tux_atom(req, ftp_flush_req);
+       ftp_send_async_message(req, WRITE_LIST, 200);
+       return;
+
+out_err_put:
+       dput(dentry);
+       mntput(mnt);
+out_err:
+       ftp_send_async_message(req, BAD_FILENAME, 550);
+}
+
+static void ftp_execute_command (tux_req_t *req, int cachemiss)
+{
+       if (!req->parsed_len)
+               TUX_BUG();
+       trunc_headers(req);
+       req->keep_alive = 1;
+
+       switch (req->ftp_command) {
+
+#define ABORTED \
+       "226 Abort successful.\r\n"
+
+       case FTP_COMM_ABOR:
+       {
+               zap_data_socket(req);
+               ftp_send_async_message(req, ABORTED, 226);
+               break;
+       }
+
+       case FTP_COMM_PWD:
+       {
+               unsigned int str_len;
+               char *buf, *path;
+
+               buf = (char *)__get_free_page(GFP_KERNEL);
+               if (!buf) {
+                       req_err(req);
+                       ftp_send_async_message(req, LIST_ERR_MEM, 200);
+                       GOTO_ERR;
+               }
+
+               if (!req->cwd_dentry) {
+                       req->cwd_dentry = dget(req->docroot_dentry);
+                       req->cwd_mnt = mntget(req->docroot_mnt);
+               }
+
+// "257 "/" is current directory.\r\n"
+
+#define PART_1 "257 \""
+#define PART_1_LEN (sizeof(PART_1)-1)
+
+#define PART_3 "\" is current directory.\r\n"
+#define PART_3_LEN sizeof(PART_3)
+
+               path = tux_print_path(req, req->cwd_dentry, req->cwd_mnt,
+                       buf+PART_1_LEN, PAGE_SIZE - PART_3_LEN - PART_1_LEN);
+
+               if (path < buf + PART_1_LEN)
+                       BUG();
+
+               memcpy(path - PART_1_LEN, PART_1, PART_1_LEN);
+               memcpy(buf + PAGE_SIZE-PART_3_LEN-1, PART_3, PART_3_LEN);
+               str_len = buf + PAGE_SIZE-1 - (path - PART_1_LEN) - 1;
+
+               __ftp_send_async_message(req, path - PART_1_LEN, 226, str_len);
+               free_page((unsigned long)buf);
+               break;
+       }
+
+       case FTP_COMM_CDUP:
+       {
+               memcpy(req->objectname, "..", 3);
+               req->objectname_len = 2;
+               req->uri_str = req->objectname;
+               req->uri_len = req->objectname_len;
+
+               // fall through to CWD:
+       }
+       case FTP_COMM_CWD:
+       {
+               ftp_chdir(req, cachemiss);
+               break;
+       }
+
+       case FTP_COMM_NLST:
+       case FTP_COMM_LIST:
+       {
+               if (!req->data_sock) {
+                       req_err(req);
+                       ftp_send_async_message(req, LIST_ERR, 200);
+                       GOTO_ERR;
+               }
+               if (req->dentry)
+                       TUX_BUG();
+               if (!req->cwd_dentry) {
+                       req->cwd_dentry = dget(req->docroot_dentry);
+                       req->cwd_mnt = mntget(req->docroot_mnt);
+               }
+               if (req->objectname_len)
+                       ftp_lookup_listfile(req, cachemiss);
+               else {
+                       dget(req->cwd_dentry);
+                       mntget(req->cwd_mnt);
+                       install_req_dentry(req, req->cwd_dentry, req->cwd_mnt);
+                       if (!req->dentry)
+                               TUX_BUG();
+                       add_tux_atom(req, ftp_do_ls_end);
+                       if (!req->cwd_dentry)
+                               TUX_BUG();
+                       add_tux_atom(req, list_directory);
+                       add_tux_atom(req, ftp_do_ls_start);
+                       add_tux_atom(req, ftp_wait_syn);
+                       add_tux_atom(req, ftp_flush_req);
+                       ftp_send_async_message(req, WRITE_LIST, 200);
+               }
+               break;
+       }
+
+       case FTP_COMM_RETR:
+       {
+               if (!req->data_sock) {
+                       req_err(req);
+                       ftp_send_async_message(req, RETR_ERR, 200);
+                       GOTO_ERR;
+               }
+               ftp_get_file(req, cachemiss);
+               break;
+       }
+
+       case FTP_COMM_SIZE:
+       {
+               ftp_get_size(req, cachemiss);
+               break;
+       }
+
+       case FTP_COMM_MDTM:
+       {
+               ftp_get_mdtm(req, cachemiss);
+               break;
+       }
+
+       case FTP_COMM_PASV:
+       {
+               char buf [36 + 4*3 + 5 + 10];
+               struct socket *data_sock;
+               struct sockaddr_in addr;
+               unsigned int str_len;
+               struct tcp_opt *tp;
+               u32 local_addr;
+               int err;
+
+               if (req->data_sock)
+                       zap_data_socket(req);
+               /*
+                * Create FTP data connection to client:
+                */
+               err = sock_create(AF_INET, SOCK_STREAM, IPPROTO_IP, &data_sock);
+               if (err < 0) {
+                       Dprintk("sock create err: %d\n", err);
+                       req_err(req);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+                       
+               local_addr = inet_sk(req->sock->sk)->rcv_saddr;
+               addr.sin_family = AF_INET;
+               addr.sin_port = 0;
+               addr.sin_addr.s_addr = local_addr;
+               Dprintk("client address: (%d,%d,%d,%d).\n", 
+                       NIPQUAD(inet_sk(req->sock->sk)->daddr));
+
+               data_sock->sk->sk_reuse = 1;
+               sock_set_flag(data_sock->sk, SOCK_URGINLINE);
+               sock_reset_flag(data_sock->sk, SOCK_LINGER);
+
+               err = data_sock->ops->bind(data_sock,
+                               (struct sockaddr*)&addr, sizeof(addr));
+               tp = tcp_sk(data_sock->sk);
+               tp->nonagle = 2;
+               Dprintk("PASV bind() ret: %d.\n", err);
+               if (err < 0) {
+                       req_err(req);
+                       sock_release(data_sock);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+
+               tp->ack.pingpong = tux_ack_pingpong;
+
+               if (!tux_keepalive_timeout)
+                       tp->linger2 = 0;
+               else
+                       tp->linger2 = tux_keepalive_timeout * HZ;
+
+               err = data_sock->ops->listen(data_sock, 1);
+               Dprintk("PASV listen() ret: %d\n", err);
+               if (err) {
+                       req_err(req);
+                       sock_release(data_sock);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+               link_tux_data_socket(req, data_sock);
+
+               Dprintk("FTP PASV listen sock state: %d, sk state: %d\n",
+                       data_sock->state, data_sock->sk->sk_state);
+
+               str_len = sprintf(buf,
+                       "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d)\r\n",
+                               NIPQUAD(local_addr),
+                               ntohs(inet_sk(data_sock->sk)->sport) / 256,
+                               ntohs(inet_sk(data_sock->sk)->sport) & 255 );
+               Dprintk("PASV mess: {%s}\n", buf);
+
+               add_tux_atom(req, ftp_accept_pasv);
+               add_tux_atom(req, ftp_flush_req);
+               __ftp_send_async_message(req, buf, 227, str_len);
+               break;
+       }
+
+       case FTP_COMM_PORT:
+       {
+               struct socket *data_sock;
+               struct sockaddr_in addr;
+               kernel_cap_t saved_cap;
+               u32 local_addr;
+               int err;
+
+               /*
+                * Create FTP data connection to client:
+                */
+               err = sock_create(AF_INET, SOCK_STREAM, IPPROTO_IP, &data_sock);
+               if (err < 0) {
+                       Dprintk("sock create err: %d\n", err);
+                       req_err(req);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+
+               local_addr = inet_sk(req->sock->sk)->rcv_saddr;
+               addr.sin_family = AF_INET;
+               addr.sin_port = htons(20);
+               addr.sin_addr.s_addr = local_addr;
+
+               Dprintk("data socket address: (%d,%d,%d,%d).\n",
+                       NIPQUAD(local_addr));
+
+               data_sock->sk->sk_reuse = 1;
+               sock_set_flag(data_sock->sk, SOCK_URGINLINE);
+               sock_reset_flag(data_sock->sk, SOCK_LINGER);
+
+               saved_cap = current->cap_effective;
+               cap_raise (current->cap_effective, CAP_NET_BIND_SERVICE);
+               err = data_sock->ops->bind(data_sock,
+                               (struct sockaddr*)&addr, sizeof(addr));
+               current->cap_effective = saved_cap;
+
+               Dprintk("ACTIVE bind() ret: %d.\n", err);
+               if (err) {
+                       sock_release(data_sock);
+                       req_err(req);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+               tcp_sk(data_sock->sk)->nonagle = 2;
+
+               link_tux_data_socket(req, data_sock);
+
+               addr.sin_family = AF_INET;
+               addr.sin_port = htons(req->ftp_user_port);
+               addr.sin_addr.s_addr = htonl(req->ftp_user_addr);
+
+               err = data_sock->ops->connect(data_sock, (struct sockaddr *) &addr, sizeof(addr), O_RDWR|O_NONBLOCK);
+               if (err && (err != -EINPROGRESS)) {
+                       Dprintk("connect error: %d\n", err);
+                       zap_data_socket(req);
+                       req_err(req);
+                       ftp_send_async_message(req, CLOSE, 500);
+                       GOTO_ERR;
+               }
+               Dprintk("FTP data sock state: %d, sk state: %d\n", data_sock->state, data_sock->sk->sk_state);
+               ftp_send_async_message(req, PORT_OK, 200);
+               break;
+       }
+
+       case FTP_COMM_USER:
+       {
+               if (!strcmp(req->username, "ftp")
+                        || !strcmp(req->username, "FTP")
+                        || !strcmp(req->username, "anonymous")
+                        || !strcmp(req->username, "ANONYMOUS")) {
+                       unsigned int str_len;
+                       char login_ok [200];
+
+                       if (!tux_ftp_login_message) {
+                               ftp_send_async_message(req, LOGIN_OK_PASS, 230);
+                               break;
+                       }
+                       update_bandwidth(req, 0); /* get current bandwidth */
+                       if (nr_requests_used() == 1)
+                               str_len = sprintf(login_ok, LOGIN_OK_ONE,
+                                       tux_max_connect, ftp_bandwidth);
+                       else
+                               str_len = sprintf(login_ok, LOGIN_OK,
+                                       nr_requests_used(), tux_max_connect, ftp_bandwidth);
+                       __ftp_send_async_message(req, login_ok, 200, str_len);
+               } else {
+                       clear_keepalive(req);
+                       ftp_send_async_message(req, LOGIN_FORBIDDEN, 530);
+               }
+               break;
+       }
+       case FTP_COMM_PASS:
+       {
+               ftp_send_async_message(req, LOGIN_OK_PASS, 230);
+               break;
+       }
+       case FTP_COMM_SITE:
+       {
+               ftp_send_async_message(req, SITE, 214);
+               break;
+       }
+       case FTP_COMM_SYST:
+       {
+               ftp_send_async_message(req, LINUX_SYST, 200);
+               break;
+       }
+       case FTP_COMM_TYPE:
+       {
+               ftp_send_async_message(req, TYPE_OK, 200);
+               break;
+       }
+#define EXTRA_FEATURES "211-Extensions supported:\r\n SIZE\r\n MDTM\r\n211 End\r\n"
+
+       case FTP_COMM_FEAT:
+       {
+               ftp_send_async_message(req, EXTRA_FEATURES, 211);
+               break;
+       }
+       case FTP_COMM_HELP:
+       case FTP_COMM_CLNT:
+       case FTP_COMM_NOOP:
+       {
+               ftp_send_async_message(req, COMMAND_OK, 200);
+               break;
+       }
+       case FTP_COMM_REST:
+       {
+               ftp_send_async_message(req, REST_OK, 200);
+               break;
+       }
+       case FTP_COMM_QUIT:
+       {
+               clear_keepalive(req);
+               ftp_send_async_message(req, BYE, 200);
+               break;
+       }
+
+       default:
+       {
+               req->keep_alive = 1;
+               ftp_send_async_message(req, CLOSE, 500);
+               break;
+       }
+       }
+       return;
+error:
+       Dprintk("rejecting FTP session!\n");
+       return;
+}
+
+
+static void ftp_timeout (tux_req_t *req, int cachemiss)
+{
+       Dprintk("called ftp_timeout(%p)\n", req);
+       if (req->error != TUX_ERROR_CONN_TIMEOUT)
+               TUX_BUG();
+       ftp_send_async_message(req, CLOSE_TIMEOUT, 421);
+}
+
+static void ftp_close (tux_req_t *req, int cachemiss)
+{
+       Dprintk("called ftp_close(%p)\n", req);
+       ftp_send_async_message(req, CLOSE, 500);
+}
+
+static void ftp_pre_log (tux_req_t *req)
+{
+       if (tux_ftp_log_retr_only && (req->ftp_command != FTP_COMM_RETR))
+               req->status = 0;
+       else
+               req->status = req->ftp_command;
+}
+
+tux_proto_t tux_proto_ftp = {
+       defer_accept: 0,
+       can_redirect: 0,
+       got_request: ftp_got_request,
+       parse_message: parse_ftp_message,
+       illegal_request: ftp_close,
+       request_timeout: ftp_timeout,
+       pre_log: ftp_pre_log,
+       check_req_err: ftp_check_req_err,
+       print_dir_line: ftp_print_dir_line,
+       name: "ftp",
+};
+
diff --git a/net/tux/proto_http.c b/net/tux/proto_http.c
new file mode 100644 (file)
index 0000000..192dd4f
--- /dev/null
@@ -0,0 +1,2199 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * proto_http.c: HTTP application protocol support
+ *
+ * Right now we detect simple GET headers, anything more
+ * subtle gets redirected to secondary server port.
+ */
+
+#include <net/tux.h>
+#include "parser.h"
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+/* 
+ * Parse the HTTP message and put results into the request structure.
+ * CISAPI extensions do not see the actual message buffer.
+ *
+ * Any perceived irregularity is honored with a redirect to the
+ * secondary server - which in most cases should be Apache. So
+ * if TUX gets confused by some strange request we fall back
+ * to Apache to be RFC-correct.
+ *
+ * The parser is 'optimistic', ie. it's optimized for the case where
+ * the whole message is available and correct. The parser is also
+ * supposed to be 'robust', ie. it can be called multiple times with
+ * an incomplete message, as new packets arrive.
+ */
+
+static inline int TOHEX (char c)
+{
+       switch (c) {
+               case '0' ... '9': c -= '0'; break;
+               case 'a' ... 'f': c -= 'a'-10; break;
+               case 'A' ... 'F': c -= 'A'-10; break;
+       default:
+               c = -1;
+       }
+       return c;
+}
+
+/*
+ * This function determines whether the client supports
+ * gzip-type content-encoding.
+ */
+static int may_gzip (const char *str, int len)
+{
+       const char *tmp, *curr;
+       int i;
+
+       if (len <= 4)
+               return 0;
+       tmp = str;
+       for (i = 0; i <= len-6; i++) {
+               Dprintk("gzip-checking: {%s}\n", tmp);
+               if (memcmp(tmp, " gzip", 5)) {
+                       tmp++;
+                       continue;
+               }
+               curr = tmp + 5;
+
+               if (*curr == ',' || *curr == '\r')
+                       return 1;
+               if (memcmp(curr, ";q=", 3))
+                       return 0;
+               curr += 3;
+               /*
+                * Every qvalue except explicitly zero is accepted.
+                * Zero values are "q=0.0", "q=0.00", "q=0.000".
+                * Parsing is optimized.
+                */
+               if (*curr == '0') {
+                       curr += 2;
+                       if (*curr == '0') {
+                               curr++;
+                               if (*curr == ' ' || *curr == '\r')
+                                       return 0;
+                               if (*curr == '0') {
+                                       curr++;
+                                       if (*curr == ' ' || *curr == '\r')
+                                               return 0;
+                                       if (*curr == '0') {
+                                               curr++;
+                                               if (*curr == ' ' ||
+                                                               *curr == '\r')
+                                                       return 0;
+                                       }
+                               }
+                       }
+               }
+               return 1;
+       }
+       return 0;
+}
+
+/*
+ * This function strips off 'strip_host_tail' number of hostname
+ * components from the tail of the hostname.
+ *
+ * Eg. with a value of '1', the "somesite.hosting.com" hostname gets
+ * transformed into the "somesite" string.
+ */
+static void strip_hostname(tux_req_t *req)
+{
+       int strip = strip_host_tail;
+       int left = req->host_len;
+       int component = 0;
+
+       if (!strip || !left)
+               return;
+
+       while (--left) {
+               if (req->host[left] != '.')
+                       continue;
+               if (++component == strip)
+                       break;
+       }
+       if (!left)
+               return;
+       req->host[left] = 0;
+       req->host_len = left;
+}
+
+static void http_lookup_vhost (tux_req_t *req, int cachemiss);
+static void http_process_message (tux_req_t *req, int cachemiss);
+
+int parse_http_message (tux_req_t *req, const int total_len)
+{
+       int hexhex = 0, hex_val_0 = 0, hex_val_1 = 0;
+       const char *curr, *uri, *message;
+       unsigned int objectname_len, left;
+       unsigned int have_r = 0;
+       char c;
+
+       left = total_len;
+       message = req->headers;
+       Dprintk("parsing request:\n---\n%s\n---\n", message);
+/*
+ * RFC 2616, 5.1:
+ *
+ *      Request-Line   = Method SP Request-URI SP HTTP-Version CRLF
+ */
+
+       if (!total_len)
+               TUX_BUG();
+
+       curr = message;
+
+#define GOTO_INCOMPLETE do { Dprintk("incomplete at %s:%d.\n", __FILE__, __LINE__); goto incomplete_message; } while (0)
+#define GOTO_REDIR do { TDprintk("redirect secondary at %s:%d.\n", __FILE__, __LINE__); goto error; } while (0)
+
+#define PRINT_MESSAGE_LEFT \
+    Dprintk("message left (%d) at %s:%d:\n--->{%s}<---\n", left, __FILE__, __LINE__, curr)
+
+       switch (*curr) {
+               case 'G':
+                       if (PARSE_METHOD(req,curr,GET,left))
+                               break;
+                       GOTO_REDIR;
+
+               case 'H':
+                       if (PARSE_METHOD(req,curr,HEAD,left))
+                               break;
+                       GOTO_REDIR;
+
+               case 'P':
+                       if (PARSE_METHOD(req,curr,POST,left))
+                               break;
+                       if (PARSE_METHOD(req,curr,PUT,left))
+                               break;
+                       GOTO_REDIR;
+
+               default:
+                       GOTO_REDIR;
+       }
+
+       req->method_str = message;
+       req->method_len = curr-message-1;
+
+       Dprintk("got method %d\n", req->method);
+
+       PRINT_MESSAGE_LEFT;
+
+       /*
+        * Ok, we got one of the methods we can handle, parse
+        * the URI:
+        */
+
+       {
+               // Do not allow leading "../" and intermediate "/../"
+               int dotdot = 1;
+               char *tmp = req->objectname;
+               int slashcheck = 1;
+
+               req->uri_str = uri = curr;
+
+               for (;;) {
+                       c = get_c(curr,left);
+                       if (slashcheck) {
+                               if (c == '/')
+                                       continue;
+                               slashcheck = 0;
+                       }
+
+                       PRINT_MESSAGE_LEFT;
+                       if (c == ' ' || ((c == '?') && (tux_ignore_query != 1)) || c == '\r' || c == '\n')
+                               break;
+                       if (c == '#')
+                               GOTO_REDIR;
+
+                       Dprintk("hexhex: %d.\n", hexhex);
+                       /*
+                        * First handle HEX HEX encoding
+                        */
+                       switch (hexhex) {
+                               case 0:
+                                       if (c == '%') {
+                                               hexhex = 1;
+                                               goto continue_parsing;
+                                       }
+                                       break;
+                               case 1:
+                                       hex_val_0 = TOHEX(c);
+                                       if (hex_val_0 < 0)
+                                               GOTO_REDIR;
+                                       hexhex = 2;
+                                       goto continue_parsing;
+                               case 2:
+                                       hex_val_1 = TOHEX(c);
+                                       if (hex_val_1 < 0)
+                                               GOTO_REDIR;
+                                       c = (hex_val_0 << 4) | hex_val_1;
+                                       if (!c)
+                                               GOTO_REDIR;
+                                       hexhex = 0;
+                                       break;
+                               default:
+                                       TUX_BUG();
+                       }
+                       if (hexhex)
+                               TUX_BUG();
+
+                       switch (dotdot) {
+                               case 0:
+                                       break;
+                               case 1:
+                                       if (c == '.')
+                                               dotdot = 2;
+                                       else
+                                               dotdot = 0;
+                                       break;
+                               case 2:
+                                       if (c == '.')
+                                               dotdot = 3;
+                                       else
+                                               dotdot = 0;
+                                       break;
+                               case 3:
+                                       if (c == '/')
+                                               GOTO_REDIR;
+                                       else
+                                               dotdot = 0;
+                                       break;
+                               default:
+                                       TUX_BUG();
+                       }
+                       if (!dotdot && (c == '/'))
+                               dotdot = 1;
+
+                       *(tmp++) = c;
+continue_parsing:
+                       if (curr - uri >= MAX_OBJECTNAME_LEN)
+                               GOTO_REDIR;
+               }
+               PRINT_MESSAGE_LEFT;
+               *tmp = 0;
+
+               // handle trailing "/.."
+               if (dotdot == 3)
+                       GOTO_REDIR;
+
+               objectname_len = tmp - req->objectname;
+               req->objectname_len = objectname_len;
+       }
+       Dprintk("got filename %s (%d)\n", req->objectname, req->objectname_len);
+
+       PRINT_MESSAGE_LEFT;
+
+       /*
+        * Parse optional query string. Copy until end-of-string or space.
+        */
+       if (c == '?') {
+               int query_len;
+               const char *query;
+
+               req->query_str = query = curr;
+
+               for (;;) {
+                       c = get_c(curr,left);
+                       if (c == ' ')
+                               break;
+                       if (c == '#')
+                               GOTO_REDIR;
+               }
+               if (unlikely(tux_ignore_query == 2))
+                       req->query_str = NULL;
+               else {
+                       query_len = curr-query-1;
+                       req->query_len = query_len;
+               }
+       }
+       if (req->query_len)
+               Dprintk("got query string %s (%d)\n", req->query_str, req->query_len);
+       req->uri_len = curr-uri-1;
+       if (!req->uri_len)
+               GOTO_REDIR;
+       Dprintk("got URI %s (%d)\n", req->uri_str, req->uri_len);
+
+       PRINT_MESSAGE_LEFT;
+       /*
+        * Parse the HTTP version field:
+        */
+       req->version_str = curr;
+       if (!PARSE_TOKEN(curr,"HTTP/1.",left))
+               GOTO_REDIR;
+
+       switch (get_c(curr,left)) {
+               case '0':
+                       req->version = HTTP_1_0;
+                       break;
+               case '1':
+                       req->version = HTTP_1_1;
+                       break;
+               default:
+                       GOTO_REDIR;
+       }
+       /*
+        * We default to keepalive in the HTTP/1.1 case and default
+        * to non-keepalive in the HTTP/1.0 case. If max_keepalives
+        * is 0 then we do no keepalives.
+        */
+       clear_keepalive(req);
+       if (tux_max_keepalives && (req->version == HTTP_1_1))
+               req->keep_alive = 1;
+       req->version_len = curr - req->version_str;
+
+       if (get_c(curr,left) != '\r')
+               GOTO_REDIR;
+       if (get_c(curr,left) != '\n')
+               GOTO_REDIR;
+
+       Dprintk("got version %d [%d]\n", req->version, req->version_len);
+       PRINT_MESSAGE_LEFT;
+
+       /*
+        * Now parse (optional) request header fields:
+        */
+       for (;;) {
+               char c;
+
+               c = get_c(curr,left);
+               switch (c) {
+               case '\r':
+                       if (have_r)
+                               GOTO_REDIR;
+                       have_r = 1;
+                       continue;
+               case '\n':
+                       if (!have_r)
+                               GOTO_REDIR;
+                       goto out;
+               default:
+                       if (have_r)
+                               GOTO_REDIR;
+               }
+
+#define PARSE_STR_FIELD(char,field,str,len)                            \
+       if (PARSE_TOKEN(curr,field,left)) {                             \
+               req->str = curr;                                        \
+               SKIP_LINE(curr,left);                                   \
+               req->len = curr - req->str - 2;                         \
+               Dprintk(char field "field: %s.\n", req->str);           \
+               break;                                                  \
+       }
+
+#define ALLOW_UNKNOWN_FIELDS 1
+#ifdef ALLOW_UNKNOWN_FIELDS
+# define UNKNOWN_FIELD { SKIP_LINE(curr,left); break; }
+#else
+# define UNKNOWN_FIELD GOTO_REDIR
+#endif
+
+               switch (c) {
+               case 'A':
+                       PARSE_STR_FIELD("A","ccept: ",
+                               accept_str,accept_len);
+                       if (PARSE_TOKEN(curr,"ccept-Encoding: ",left)) {
+                               const char *str = curr-1;
+
+                               req->accept_encoding_str = curr;
+                               SKIP_LINE(curr,left);
+                               req->accept_encoding_len = curr - req->accept_encoding_str - 2;
+                               Dprintk("Accept-Encoding field: {%s}.\n", str);
+
+                               if (tux_compression && may_gzip(str,curr-str)) {
+                                       Dprintk("client accepts gzip!.\n");
+                                       req->may_send_gzip = 1;
+                               }
+                               break;
+                       }
+                       PARSE_STR_FIELD("A","ccept-Charset: ",
+                               accept_charset_str,accept_charset_len);
+                       PARSE_STR_FIELD("A","ccept-Language: ",
+                               accept_language_str,accept_language_len);
+                       UNKNOWN_FIELD;
+
+               case 'C':
+                       if (PARSE_TOKEN(curr,"onnection: ",left)) {
+next_token:
+                       switch (get_c(curr,left)) {
+                       case 'K':
+                               if (!PARSE_TOKEN(curr,"eep-Alive",left))
+                                       GOTO_REDIR;
+                               if (tux_max_keepalives)
+                                       req->keep_alive = 1;
+                               break;
+
+                       case 'C':
+                       case 'c':
+                               if (!PARSE_TOKEN(curr,"lose",left))
+                                       GOTO_REDIR;
+                               clear_keepalive(req);
+                               break;
+
+                       case 'k':
+                               if (!PARSE_TOKEN(curr,"eep-alive",left))
+                                       GOTO_REDIR;
+                               if (tux_max_keepalives)
+                                       req->keep_alive = 1;
+                               break;
+                       case 'T':
+                               if (PARSE_TOKEN(curr,"E",left))
+                                       break;
+                               if (PARSE_TOKEN(curr,"railers",left))
+                                       break;
+                               if (PARSE_TOKEN(curr,"ransfer-Encoding",left))
+                                       break;
+                               GOTO_REDIR;
+                       case 'P':
+                               if (PARSE_TOKEN(curr,"roxy-Authenticate",left))
+                                       break;
+                               if (PARSE_TOKEN(curr,"roxy-Authorization",left))
+                                       break;
+                               GOTO_REDIR;
+                       case 'U':
+                               if (!PARSE_TOKEN(curr,"pgrade",left))
+                                       GOTO_REDIR;
+                               break;
+                       case ' ':
+                               PRINT_MESSAGE_LEFT;
+                               goto next_token;
+                       case ',':
+                               PRINT_MESSAGE_LEFT;
+                               goto next_token;
+                       default:
+                               GOTO_REDIR;
+                       }
+                       PRINT_MESSAGE_LEFT;
+                       if (*curr != '\r')
+                               goto next_token;
+                       // allow other tokens.
+                       SKIP_LINE(curr,left);
+                       break;
+                       }
+
+                       PARSE_STR_FIELD("C","ookie: ",
+                               cookies_str,cookies_len);
+                       PARSE_STR_FIELD("C","ontent-Type: ",
+                               content_type_str,content_type_len);
+
+                       if (PARSE_TOKEN(curr,"ontent-Length: ",left) ||
+                           PARSE_TOKEN(curr,"ontent-length: ",left)) {
+                               const char *tmp;
+                               req->contentlen_str = curr;
+                               SKIP_LINE(curr,left);
+                               req->contentlen_len = curr - req->contentlen_str - 2;
+                               if (req->contentlen_len) {
+                                       tmp = req->contentlen_str;
+                                       req->content_len = simple_strtoul(tmp, NULL, 10);
+                               }
+                               Dprintk("Content-Length field: %s [%d].\n", req->contentlen_str, req->contentlen_len);
+                               Dprintk("Content-Length value: %d.\n", req->content_len);
+                               break;
+                       }
+                       PARSE_STR_FIELD("C","ache-Control: ",
+                               cache_control_str,cache_control_len);
+                       UNKNOWN_FIELD;
+
+               case 'H':
+                       if (PARSE_TOKEN(curr,"ost: ",left)) {
+                               const char *tmp = curr;
+                               char *tmp2 = req->host;
+
+                               /*
+                                * canonize the hostname:
+                                *
+                                * 1) strip off preceding 'www.' variants,
+                                * 2) transform it to lowercase.
+                                * 3) strip trailing dots
+                                * 4) potentially strip off tail
+                                */
+                               
+#define is_w(n) ((curr[n] == 'w') || (curr[n] == 'W'))
+
+                               if ((left > 4) && is_w(0) && is_w(1) &&
+                                               is_w(2) && curr[3] == '.') {
+                                       curr += 4;
+                                       left -= 4;
+                                       tmp = curr;
+                               }
+                        
+                               COPY_LINE_TOLOWER(curr, tmp2, left, req->host+MAX_HOST_LEN-2);
+                               req->host_len = curr - tmp - 2;
+                               while (req->host[req->host_len] == '.') {
+                                       if (!req->host_len)
+                                               break;
+                                       req->host_len--;
+                               }
+                               req->host[req->host_len] = 0;
+                               if (strip_host_tail)
+                                       strip_hostname(req);
+                               Dprintk("Host field: %s [%d].\n", req->host, req->host_len);
+                               break;
+                       }
+                       UNKNOWN_FIELD;
+
+               case 'I':
+                       PARSE_STR_FIELD("I","f-None-Match: ",
+                               if_none_match_str,if_none_match_len);
+                       PARSE_STR_FIELD("I","f-Modified-Since: ",
+                               if_modified_since_str,if_modified_since_len);
+                       PARSE_STR_FIELD("I","f-Range: ",
+                               if_range_str,if_range_len);
+                       UNKNOWN_FIELD;
+
+               case 'N':
+                       PARSE_STR_FIELD("N","egotiate: ",
+                               negotiate_str,negotiate_len);
+                       UNKNOWN_FIELD;
+
+               case 'P':
+                       PARSE_STR_FIELD("P","ragma: ",
+                               pragma_str,pragma_len);
+                       UNKNOWN_FIELD;
+
+               case 'R':
+
+                       PARSE_STR_FIELD("R","eferer: ",
+                               referer_str,referer_len);
+                       if (!PARSE_TOKEN(curr,"ange: bytes=",left))
+                               UNKNOWN_FIELD;
+               {
+                       const char *tmp = curr;
+                       char *tmp2 = (char *)curr;
+                       unsigned int offset_start = 0, offset_end = 0;
+
+                       if (*tmp2 != '-')
+                               offset_start = simple_strtoul(tmp2, &tmp2, 10);
+                       if (*tmp2 == '-') {
+                               tmp2++;
+                               if (*tmp2 != '\r')
+                                       offset_end = simple_strtoul(tmp2, &tmp2, 10) +1;
+                       }
+                       curr = tmp2;
+                       left -= tmp2-tmp;
+
+                       req->offset_start = offset_start;
+                       req->offset_end = offset_end;
+
+                       SKIP_LINE(curr,left);
+                       Dprintk("Range field: %s [%d] (%d-%d).\n", tmp, curr-tmp, offset_start, offset_end);
+                       break;
+               }
+
+               case 'U':
+                       PARSE_STR_FIELD("U","ser-Agent: ",
+                               user_agent_str,user_agent_len);
+                       UNKNOWN_FIELD;
+
+               default:
+                       UNKNOWN_FIELD;
+               }
+               PRINT_MESSAGE_LEFT;
+       }
+out:
+       /*
+        * POST data.
+        */
+       if ((req->method == METHOD_POST) && req->content_len) {
+               PRINT_MESSAGE_LEFT;
+               if (curr + req->content_len > message + total_len)
+                       GOTO_INCOMPLETE;
+               req->post_data_str = curr;
+               req->post_data_len = req->content_len;
+               curr += req->content_len;
+               left -= req->content_len;
+               Dprintk("POST-ed data: {%s}\n", req->post_data_str);
+       }
+
+       switch (req->method) {
+               default:
+                       GOTO_REDIR;
+               case METHOD_GET:
+               case METHOD_HEAD:
+               case METHOD_POST:
+               case METHOD_PUT:
+                       ;
+       }
+
+#define TUX_SCHEME "http://"
+#define TUX_SCHEME_LEN (sizeof(TUX_SCHEME)-1)
+
+       if (!memcmp(req->objectname, TUX_SCHEME, TUX_SCHEME_LEN)) {
+
+               /* http://user:password@host:port/object */
+
+               const char *head, *tail, *end, *host, *port;
+               int host_len, objectname_len;
+
+               head = req->objectname + TUX_SCHEME_LEN;
+               end = req->objectname + req->objectname_len;
+
+               tail = memchr(head, '/', end - head);
+               if (!tail)
+                       GOTO_REDIR;
+               host = memchr(head, '@', tail - head);
+               if (!host)
+                       host = head;
+               else
+                       host++;
+               if (!*host)
+                       GOTO_REDIR;
+               port = memchr(host, ':', tail - host);
+               if (port)
+                       host_len = port - host;
+               else
+                       host_len = tail - host;
+               if (host_len >= MAX_HOST_LEN)
+                       GOTO_REDIR;
+               memcpy(req->host, host, host_len);
+               req->host_len = host_len;
+               req->host[host_len] = 0;
+
+               if (*tail != '/')
+                       TUX_BUG();
+
+               req->uri_str = tail;
+               req->uri_len = end - tail;
+
+               tail++;
+               while (*tail == '/')
+                       tail++;
+
+               objectname_len = end - tail;
+               memcpy(req->objectname, tail, objectname_len);
+               req->objectname_len = objectname_len;
+               req->objectname[objectname_len] = 0;
+       } else
+               if (req->uri_str[0] != '/')
+                       GOTO_REDIR;
+
+       if ((req->version == HTTP_1_1) && !req->host_len)
+               GOTO_REDIR;
+       if (req->objectname[0] == '/')
+               GOTO_REDIR;
+       /*
+        * Lets make sure nobody plays games with the host
+        * header in a virtual hosting environment:
+        */
+       if (req->virtual && req->host_len) {
+               if (memchr(req->host, '/', req->host_len))
+                       GOTO_REDIR;
+               if (req->host[0] == '.') {
+                       if (req->host_len == 1)
+                               GOTO_REDIR;
+                       if ((req->host_len == 2) && (req->host[0] == '.'))
+                               GOTO_REDIR;
+               }
+       }
+       /*
+        * From this point on the request is for the main TUX engine:
+        */
+       Dprintk("ok, request accepted.\n");
+
+       if (req->keep_alive) {
+               req->nr_keepalives++;
+               if (req->nr_keepalives == -1)
+                       req->nr_keepalives--;
+               INC_STAT(nr_keepalive_reqs);
+       } else
+               INC_STAT(nr_nonkeepalive_reqs);
+       INC_STAT(keepalive_hist[req->nr_keepalives]);
+
+       PRINT_MESSAGE_LEFT;
+       req->parsed_len = curr-message;
+       if (req->dentry)
+               TUX_BUG();
+       req->virtual = tux_virtual_server;
+       if (req->virtual)
+               add_tux_atom(req, http_lookup_vhost);
+       else {
+               req->docroot_dentry = dget(req->proto->main_docroot.dentry);
+               req->docroot_mnt = mntget(req->proto->main_docroot.mnt);
+               add_tux_atom(req, http_process_message);
+       }
+
+       return req->parsed_len;
+
+incomplete_message:
+       Dprintk("incomplete message!\n");
+       PRINT_MESSAGE_LEFT;
+
+       return 0;
+
+error:
+       if (total_len > 0)
+               req->parsed_len = total_len;
+       else
+               req->parsed_len = 0;
+       PRINT_MESSAGE_LEFT;
+       if (tux_TDprintk) {
+               TDprintk("redirecting message to secondary server.\n");
+               print_req(req);
+       }
+       return -1;
+}
+
+static int lookup_url (tux_req_t *req, const unsigned int flag)
+{
+       /*
+        * -1 : no previous checks made
+        *  0 : previous check failed, do not check farther, 
+        *  1 : previous check successed, check farther
+        */
+       int not_modified = -1;
+       int perm = 0, i;
+       struct dentry *dentry = NULL;
+       struct vfsmount *mnt = NULL;
+       struct inode *inode;
+       const char *filename;
+
+       /*
+        * Do not do any etag or last_modified header checking
+        * if both unset.
+        */
+       if (!tux_generate_etags && !tux_generate_last_mod)
+               not_modified = 0;
+
+repeat_lookup:
+       if (req->dentry)
+               TUX_BUG();
+
+       filename = req->objectname;
+       Dprintk("will look up {%s} (%d)\n", filename, req->objectname_len);
+       Dprintk("current->fsuid: %d, current->fsgid: %d, ngroups: %d\n",
+               current->fsuid, current->fsgid, current->group_info->ngroups);
+       for (i = 0; i < current->group_info->ngroups; i++)
+               Dprintk(".. group #%d: %d.\n", i, current->groups[i]);
+
+       dentry = tux_lookup(req, filename, flag, &mnt);
+
+#define INDEX "/index.html"
+
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO)
+                       goto cachemiss;
+
+               if (tux_http_dir_indexing && (req->lookup_dir == 1)) {
+                       // undo the index.html appending:
+                       req->objectname_len -= sizeof(INDEX)-1;
+                       req->objectname[req->objectname_len] = 0;
+                       req->lookup_dir = 2;
+                       goto repeat_lookup;
+               }
+               if (!req->lookup_404) {
+                       int len = strlen(tux_404_page);
+                       memcpy(req->objectname, tux_404_page, len);
+                       req->objectname[len] = 0;
+                       req->objectname_len = len;
+                       req->lookup_404 = 1;
+                       req->status = 404;
+                       goto repeat_lookup;
+               }
+               TDprintk("abort - lookup error.\n");
+               goto abort;
+       }
+
+       Dprintk("SUCCESS, looked up {%s} == dentry %p (inode %p, count %d.)\n", filename, dentry, dentry->d_inode, atomic_read(&dentry->d_count));
+       inode = dentry->d_inode;
+
+       /*
+        * At this point we have a real, non-negative dentry.
+        */
+       perm = tux_permission(inode);
+
+       if ((perm < 0) || (!S_ISDIR(dentry->d_inode->i_mode)
+                               && !S_ISREG(dentry->d_inode->i_mode))) {
+               Dprintk("FAILED trusted dentry %p permission %d.\n", dentry, perm);
+               req->status = 403;
+               goto abort;
+       }
+       if ((req->lookup_dir != 2) && S_ISDIR(dentry->d_inode->i_mode)) {
+               if (req->lookup_dir || (req->objectname_len +
+                                sizeof(INDEX) >= MAX_OBJECTNAME_LEN)) {
+                       req->status = 403;
+                       goto abort;
+               }
+               if (req->objectname_len && (req->objectname[req->objectname_len-1] != '/')) {
+                       dput(dentry);
+                       mntput(mnt);
+                       req->lookup_dir = 0;
+                       return 2;
+               }
+               memcpy(req->objectname + req->objectname_len,
+                                               INDEX, sizeof(INDEX));
+               req->objectname_len += sizeof(INDEX)-1;
+               req->lookup_dir = 1;
+               dput(dentry);
+               mntput(mnt);
+               mnt = NULL;
+               dentry = NULL;
+               goto repeat_lookup;
+       }
+       if (tux_max_object_size && (inode->i_size > tux_max_object_size)) {
+               TDprintk("too big object, %Ld bytes.\n", inode->i_size);
+               req->status = 403;
+               goto abort;
+       }
+       req->total_file_len = inode->i_size;
+       req->mtime = inode->i_mtime.tv_sec;
+
+       {
+               loff_t num = req->total_file_len;
+               int nr_digits = 0;
+               unsigned long modulo;
+               char * etag_p = req->etag;
+               char digits [30];
+
+               do {
+                       modulo = do_div(num, 10);
+                       digits[nr_digits++] = '0' + modulo;
+               } while (num);
+
+               req->lendigits = nr_digits;
+               req->etaglen = nr_digits;
+
+               while (nr_digits)
+                       *etag_p++ = digits[--nr_digits];
+
+               *etag_p++ = '-';
+               num = req->mtime;
+               nr_digits = 0;
+
+               do {
+                       digits[nr_digits++] = 'a' + num % 16;
+                               num /= 16;
+               } while (num);
+               req->etaglen += nr_digits+1;
+               while (nr_digits)
+                       *etag_p++ = digits[--nr_digits];
+               *etag_p = 0;
+       }
+
+       if ((req->if_none_match_len >= req->etaglen) && (abs(not_modified) == 1)) {
+
+               char * etag_p = req->etag;
+               const char * match_p = req->if_none_match_str;
+               int pos = req->etaglen - 1;
+               int matchpos = req->etaglen - 1;
+
+               do {
+                       while (etag_p[matchpos--] == match_p[pos--])
+                               if (matchpos < 0)
+                                       break;
+                       if (matchpos < 0)
+                               pos = req->if_none_match_len;
+                       else {
+                               if (match_p[pos+1] == ',')
+                                       pos += req->etaglen + 2;
+                               else
+                                       pos += req->etaglen-matchpos;
+                               matchpos = req->etaglen - 1;
+                       }
+               } while (pos < req->if_none_match_len);
+
+               if (matchpos < 0) {
+                       not_modified = 1;
+                       TDprintk("Etag matched.\n");
+               } else
+                       not_modified = 0; 
+       }
+
+        if ((req->if_modified_since_len >= 24) && (abs(not_modified) == 1)) {
+                if (parse_time(req->if_modified_since_str, req->if_modified_since_len) >= req->mtime ) {
+                       not_modified = 1;
+                        Dprintk("Last-Modified matched.\n");
+                } else
+                       not_modified = 0;
+        }
+
+       if (not_modified == 1) {
+               req->status = 304;
+               goto abort;
+       }
+
+       Dprintk("looked up cached dentry %p, (count %d.)\n", dentry, dentry ? atomic_read(&dentry->d_count) : -1 );
+
+       url_hist_hit(req->total_file_len);
+out:
+       install_req_dentry(req, dentry, mnt);
+       req->lookup_dir = 0;
+       return 0;
+
+cachemiss:
+       return 1;
+
+abort:
+       if (dentry) {
+               if (!IS_ERR(dentry))
+                       dput(dentry);
+               dentry = NULL;
+       }
+       if (mnt) {
+               if (!IS_ERR(mnt))
+                       mntput(mnt);
+               mnt = NULL;
+       }
+#if CONFIG_TUX_DEBUG
+       if (!not_modified) {
+               TDprintk("req %p has lookup errors!\n", req);
+               if (tux_TDprintk)
+                       print_req(req);
+       }
+#endif
+       req_err(req);
+       goto out;
+}
+
+int handle_gzip_req (tux_req_t *req, unsigned int flags)
+{
+       char *curr = req->objectname + req->objectname_len;
+       struct dentry *dentry;
+       struct vfsmount *mnt = NULL;
+       struct inode *inode, *orig_inode;
+       loff_t size, orig_size;
+
+       *curr++ = '.';
+       *curr++ = 'g';
+       *curr++ = 'z';
+       *curr++ = 0;
+       req->objectname_len += 3;
+
+       dentry = tux_lookup(req, req->objectname, flags, &mnt);
+
+       req->objectname_len -= 3;
+       req->objectname[req->objectname_len] = 0;
+
+       if (!dentry)
+               return 0;
+       if (IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       release_req_dentry(req);
+                       return 1;
+               }
+               return 0;
+       }
+
+       inode = dentry->d_inode;
+       size = inode->i_size;
+       orig_inode = req->dentry->d_inode;
+       orig_size = orig_inode->i_size;
+
+       if (!tux_permission(inode)
+                       && (size < orig_size)
+                       && (inode->i_mtime.tv_sec >= orig_inode->i_mtime.tv_sec)) {
+
+               release_req_dentry(req);
+               install_req_dentry(req, dentry, mnt);
+               req->total_file_len = req->output_len = size;
+               Dprintk("content WILL be gzipped!\n");
+               req->content_gzipped = 1;
+       } else {
+               dput(dentry);
+               mntput(mnt);
+       }
+
+       return 0;
+}
+
+static spinlock_t mimetypes_lock = SPIN_LOCK_UNLOCKED;
+
+static LIST_HEAD(mimetypes_head);
+
+static mimetype_t default_mimetype = { type: "text/plain", type_len: 10, expire_str: "", expire_str_len: 0 };
+
+#define MAX_MIMETYPE_LEN 128
+#define MAX_CACHE_CONTROL_AGE_LEN 30
+
+void add_mimetype (char *new_ext, char *new_type, char *new_expire)
+{
+       int type_len = strlen(new_type);
+       int ext_len = strlen(new_ext);
+       int expire_len = strlen(new_expire);
+       mimetype_t *mime;
+       char *ext, *type, *expire;
+
+        if (type_len > MAX_MIMETYPE_LEN)
+                type_len = MAX_MIMETYPE_LEN;
+        if (ext_len > MAX_URI_LEN)
+                ext_len = MAX_URI_LEN;
+        if (expire_len > MAX_CACHE_CONTROL_AGE_LEN)
+                expire_len = MAX_CACHE_CONTROL_AGE_LEN;
+
+       mime = tux_kmalloc(sizeof(*mime));
+       memset(mime, 0, sizeof(*mime));
+       ext = tux_kmalloc(ext_len + 1);
+       type = tux_kmalloc(type_len + 1);
+       expire = tux_kmalloc(expire_len + 1);
+
+       strncpy(ext, new_ext, ext_len);
+       strncpy(type, new_type, type_len);
+       strncpy(expire, new_expire, expire_len);
+       
+       // in case one of the above parameters was too long :
+
+       ext[ext_len] = '\0';
+       type[type_len] = '\0';
+       expire[expire_len] = '\0';
+
+       mime->ext = ext;
+       mime->ext_len = ext_len;
+
+       mime->type = type;
+       mime->type_len = type_len;
+
+       mime->expire_str = expire;
+       mime->expire_str_len = expire_len;
+
+       mime->special = NORMAL_MIME_TYPE;
+       if (!strcmp(type, "TUX/redirect"))
+               mime->special = MIME_TYPE_REDIRECT;
+       if (!strcmp(type, "TUX/CGI"))
+               mime->special = MIME_TYPE_CGI;
+       if (!strcmp(type, "TUX/module"))
+               mime->special = MIME_TYPE_MODULE;
+
+       spin_lock(&mimetypes_lock);
+       list_add(&mime->list, &mimetypes_head);
+       spin_unlock(&mimetypes_lock);
+}
+
+static inline int ext_matches (char *file, int len, char *ext, int extlen)
+{
+       int i;
+       char *tmp = file + len-1;
+       char *tmp2 = ext + extlen-1;
+
+       if (len < extlen)
+               return 0;
+
+       for (i = 0; i < extlen; i++) {
+               if (*tmp != *tmp2)
+                       return 0;
+               tmp--;
+               tmp2--;
+       }
+       return 1;
+}
+
+/*
+ * Overhead is not a problem, we cache the MIME type
+ * in the dentry.
+ */
+static mimetype_t * lookup_mimetype (tux_req_t *req)
+{
+       char *objectname = req->objectname;
+       int len = req->objectname_len;
+       mimetype_t *mime = NULL;
+       struct list_head *head, *tmp, *tmp1, *tmp2, *tmp3;
+
+       if (!memchr(objectname, '.', len))
+               goto out;
+
+       spin_lock(&mimetypes_lock);
+       head = &mimetypes_head;
+       tmp = head->next;
+
+       while (tmp != head) {
+               mime = list_entry(tmp, mimetype_t, list);
+               if (ext_matches(objectname, len, mime->ext, mime->ext_len)) {
+                       /*
+                        * Percolate often-used mimetypes up:
+                        */
+                       if (tmp->prev != &mimetypes_head) {
+                               tmp1 = tmp;
+                               tmp2 = tmp->prev;
+                               tmp3 = tmp->prev->prev;
+                               list_del(tmp1);
+                               list_del(tmp2);
+                               list_add(tmp, tmp3);
+                               list_add(tmp2, tmp);
+                       }
+                       break;
+               } else
+                       mime = NULL;
+               tmp = tmp->next;
+       }
+       spin_unlock(&mimetypes_lock);
+
+out:
+       if (!mime)
+               mime = &default_mimetype;
+       return mime;
+}
+
+void free_mimetypes (void)
+{
+       struct list_head *head, *tmp, *next;
+       mimetype_t *mime;
+
+       spin_lock(&mimetypes_lock);
+       head = &mimetypes_head;
+       tmp = head->next;
+
+       while (tmp != head) {
+               next = tmp->next;
+               mime = list_entry(tmp, mimetype_t, list);
+               list_del(tmp);
+
+               kfree(mime->ext);
+               mime->ext = NULL;
+               kfree(mime->type);
+               mime->type = NULL;
+               kfree(mime);
+
+               tmp = next;
+       }
+       spin_unlock(&mimetypes_lock);
+}
+
+/*
+ * Various constant HTTP responses:
+ */
+
+static const char forbidden[] =
+       "HTTP/1.1 403 Forbidden\r\n"
+       "Connection: Keep-Alive\r\n" \
+       "Content-Length: 24\r\n\r\n"
+       "<HTML> Forbidden </HTML>";
+
+static const char not_found[] =
+       "HTTP/1.1 404 Not Found\r\n"
+       "Connection: Keep-Alive\r\n" \
+       "Content-Length: 29\r\n\r\n"
+       "<HTML> Page Not Found </HTML>";
+
+#define NOTMODIFIED_1 \
+       "HTTP/1.1 304 Not Modified\r\n" \
+       "Connection: Keep-Alive\r\n" \
+       "Date: "
+
+#define NOTMODIFIED_1_LEN (sizeof(NOTMODIFIED_1) - 1)
+
+#define NOTMODIFIED_2 \
+       "\r\nETag: \""
+
+#define NOTMODIFIED_2_LEN (sizeof(NOTMODIFIED_2) - 1)
+
+#define NOTMODIFIED_3 \
+       "\"\r\n\r\n"
+
+#define NOTMODIFIED_3_LEN (sizeof(NOTMODIFIED_3) - 1)
+
+#define REDIRECT_1 \
+       "HTTP/1.1 301 Moved Permanently\r\n" \
+       "Location: http://"
+
+#define REDIRECT_1_LEN (sizeof(REDIRECT_1) - 1)
+
+#define REDIRECT_2 \
+       "/\r\nContent-Length: 36\r\n" \
+       "Connection: Keep-Alive\r\n" \
+       "Content-Type: text/html\r\n\r\n" \
+       "<HTML> 301 Moved Permanently </HTML>"
+
+#define REDIRECT_2_LEN (sizeof(REDIRECT_2) - 1)
+
+void send_async_err_forbidden (tux_req_t *req)
+{
+       send_async_message(req, forbidden, 403, 1);
+}
+
+void send_async_err_not_found (tux_req_t *req)
+{
+       send_async_message(req, not_found, 404, 1);
+}
+
+static void send_ret_notmodified (tux_req_t *req)
+{
+       char *buf;
+       int size;
+
+       size = NOTMODIFIED_1_LEN + DATE_LEN - 1 + NOTMODIFIED_2_LEN + req->etaglen + NOTMODIFIED_3_LEN;
+       buf = get_abuf(req, size); 
+       memcpy(buf, NOTMODIFIED_1, NOTMODIFIED_1_LEN);
+       buf += NOTMODIFIED_1_LEN;
+       memcpy(buf, tux_date, DATE_LEN-1);
+       buf += DATE_LEN-1; 
+       memcpy(buf, NOTMODIFIED_2, NOTMODIFIED_2_LEN);
+       buf += NOTMODIFIED_2_LEN;
+       memcpy(buf, &req->etag, req->etaglen);
+       buf += req->etaglen;
+       memcpy(buf, NOTMODIFIED_3, NOTMODIFIED_3_LEN);
+       buf += NOTMODIFIED_3_LEN;
+
+       req->status = 304;
+       send_abuf(req, size, MSG_DONTWAIT);
+       add_req_to_workqueue(req);
+}
+
+static void send_ret_redirect (tux_req_t *req, int cachemiss)
+{
+       char *buf;
+       unsigned int size;
+       unsigned int uts_len = 0;
+
+       size = REDIRECT_1_LEN;
+       if (req->host_len)
+               size += req->host_len;
+       else {
+               down_read(&uts_sem);
+               uts_len = strlen(system_utsname.nodename);
+               size += uts_len;
+       }
+       if (req->objectname[0] != '/')
+               size++;
+       size += req->objectname_len;
+       size += REDIRECT_2_LEN;
+
+       if (size > PAGE_SIZE) {
+               req->error = TUX_ERROR_CONN_CLOSE;
+               zap_request(req, cachemiss);
+               return;
+       }
+
+       buf = get_abuf(req, size);
+
+       memcpy(buf, REDIRECT_1, REDIRECT_1_LEN);
+       buf += REDIRECT_1_LEN;
+
+       Dprintk("req %p, host: %s, host_len: %d.\n", req, req->host, req->host_len);
+       if (req->host_len) {
+               memcpy(buf, req->host, req->host_len);
+               buf += req->host_len;
+       } else {
+               memcpy(buf, system_utsname.nodename, uts_len);
+               up_read(&uts_sem);
+               buf += uts_len;
+       }
+       if (req->objectname[0] != '/') {
+               buf[0] = '/';
+               buf++;
+       }
+
+       memcpy(buf, req->objectname, req->objectname_len);
+       buf += req->objectname_len;
+
+       memcpy(buf, REDIRECT_2, REDIRECT_2_LEN);
+       buf += REDIRECT_2_LEN;
+
+       req->status = 301;
+       send_abuf(req, size, MSG_DONTWAIT);
+       add_req_to_workqueue(req);
+}
+
+static void http_got_request (tux_req_t *req)
+{
+       req->host[0] = 0;
+       req->host_len = 0;
+       add_tux_atom(req, parse_request);
+       add_req_to_workqueue(req);
+}
+
+
+tux_attribute_t * lookup_tux_attribute (tux_req_t *req)
+{
+       tux_attribute_t *attr;
+       struct inode *inode;
+       mimetype_t *mime;
+
+       attr = tux_kmalloc(sizeof(*attr));
+       memset(attr, 0, sizeof(*attr));
+
+       mime = lookup_mimetype(req);
+
+       inode = req->dentry->d_inode;
+       if (!inode->i_uid && !inode->i_gid) {
+               if (mime->special == MIME_TYPE_MODULE) {
+                       attr->tcapi = lookup_tuxmodule(req->objectname);
+                       if (!attr->tcapi) {
+                               req_err(req);
+                               mime = &default_mimetype;
+                       }
+               }
+       } else {
+               if (mime->special && (mime->special != MIME_TYPE_REDIRECT))
+                       mime = &default_mimetype;
+       }
+       attr->mime = mime;
+
+       return attr;
+}
+
+static void handle_range(tux_req_t *req)
+{
+       if (req->if_range_len) {
+               time_t range_time;
+
+               range_time = parse_time(req->if_range_str, req->if_range_len);
+
+               /*
+                * If the file is newer then we send the whole file.
+                */
+               if (range_time < req->mtime )
+                       goto out_no_range;
+       }
+       /* if no offset_end was specified then default to 'end of file': */
+       if (!req->offset_end)
+               req->offset_end = req->total_file_len;
+       /*
+        * Sanity checks:
+        *
+        *  - is the range between 0...file_len-1 ?
+        *  - is offset_end after offset_start?
+        *
+        * (note that offset_end is higher by 1)
+        */
+       if ((req->offset_end > req->total_file_len) ||
+                       (req->offset_start >= req->total_file_len) ||
+                       (req->offset_end <= req->offset_start))
+               goto out_no_range;
+       /*
+        * If the range is 0...file_len-1 then send the whole file:
+        */
+       if (!req->offset_start && (req->offset_end == req->total_file_len))
+               goto out_no_range;
+
+       /* ok, the range is valid, use it: */
+
+       req->output_len = req->offset_end - req->offset_start;
+       req->in_file.f_pos = req->offset_start;
+       return;
+
+out_no_range:
+       req->offset_start = 0;
+       req->offset_end = 0;
+}
+
+static void http_pre_header (tux_req_t *req, int push);
+static void http_post_header (tux_req_t *req, int cachemiss);
+static void http_send_body (tux_req_t *req, int cachemiss);
+
+#define DIRLIST_HEAD_1 "\
+<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">\
+<HTML><HEAD><TITLE>Index of %s</TITLE></HEAD><BODY>\
+<H1>Index of %s </H1><PRE><HR>\n%s"
+
+#define DIRLIST_HEAD_2 "\
+<IMG SRC=\"/icons/back.gif\"ALT=\"[DIR]\"> <A HREF=\"../\">Parent Directory</A>\n"
+
+#define DIRLIST_HEAD_SIZE (sizeof(DIRLIST_HEAD_1) + sizeof(DIRLIST_HEAD_2))
+
+static void http_dirlist_head (tux_req_t *req, int cachemiss)
+{
+       char *buf1, *buf2, *path;
+       int len;
+
+       buf1 = (char *)__get_free_page(GFP_KERNEL);
+       buf2 = (char *)__get_free_page(GFP_KERNEL);
+       if (!buf1 || !buf2)
+               goto out;
+       path = tux_print_path(req, req->dentry, req->mnt, buf1, PAGE_SIZE);
+       if (path[0] == '/' && path[1] == '/' && !path[3])
+               path = "/";
+       if (2*strlen(path) + DIRLIST_HEAD_SIZE >= PAGE_SIZE)
+               goto out;
+       len = sprintf(buf2, DIRLIST_HEAD_1, path, path, req->dentry == req->docroot_dentry ? "" : DIRLIST_HEAD_2);
+       __send_async_message(req, buf2, 200, len, 0);
+
+out:
+       if (buf1)
+               free_page((unsigned long)buf1);
+       if (buf2)
+               free_page((unsigned long)buf2);
+}
+
+#define DIRLIST_TAIL "\
+</PRE><HR><ADDRESS><IMG SRC=\"/icons/tuxlogo.gif\"ALIGN=\"MIDDLE\"ALT=\"[TUX]\">Powered by Linux/TUX 3.0</ADDRESS>\n</BODY></HTML>"
+
+static void http_dirlist_tail (tux_req_t *req, int cachemiss)
+{
+       __send_async_message(req, DIRLIST_TAIL, 200, sizeof(DIRLIST_TAIL)-1, 1);
+}
+
+static void http_dirlist (tux_req_t *req, int cachemiss)
+{
+       int head = (req->method == METHOD_HEAD);
+
+       req->lookup_dir = 3;
+       clear_keepalive(req);
+       if (!head) {
+               add_tux_atom(req, http_dirlist_tail);
+               add_tux_atom(req, list_directory);
+               add_tux_atom(req, http_dirlist_head);
+       }
+       http_pre_header(req, head);
+       add_req_to_workqueue(req);
+}
+
+static char *host_path_hash(tux_req_t *req, char *tmp)
+{
+       if (req->host_len < 2)
+               return NULL;
+
+       switch (mass_hosting_hash) {
+               default:
+               case 0:
+                       return req->host;
+               case 1:
+
+                       // www.ABCDEFG.com => A/ABCDEFG.com
+
+                       tmp[0] = req->host[0];
+                       tmp[1] = '/';
+                       memcpy(tmp + 2, req->host, req->host_len);
+                       tmp[req->host_len + 2] = 0;
+
+                       return tmp;
+               case 2:
+                       // www.ABCDEFG.com => A/AB/ABCDEFG.com
+
+                       tmp[0] = req->host[0];
+                       tmp[1] = '/';
+                       tmp[2] = req->host[0];
+                       tmp[3] = req->host[1];
+                       tmp[4] = '/';
+                       memcpy(tmp + 5, req->host, req->host_len);
+                       tmp[req->host_len + 5] = 0;
+
+                       return tmp;
+               case 3:
+                       // www.ABCDEFG.com => A/AB/ABC/ABCDEFG.com
+
+                       tmp[0] = req->host[0];
+                       tmp[1] = '/';
+                       tmp[2] = req->host[0];
+                       tmp[3] = req->host[1];
+                       tmp[4] = '/';
+                       tmp[5] = req->host[0];
+                       tmp[6] = req->host[1];
+                       tmp[7] = req->host[2];
+                       tmp[8] = '/';
+                       memcpy(tmp + 9, req->host, req->host_len);
+                       tmp[req->host_len + 9] = 0;
+
+                       return tmp;
+       }
+}
+
+static struct dentry * vhost_lookup (tux_req_t *req, struct nameidata* base, struct vfsmount **mnt)
+{
+       struct dentry *dentry = NULL;
+       // 255.255.255.255
+       char ip [3+1+3+1+3+1+3 + 2];
+
+       if (req->virtual >= TUX_VHOST_IP) {
+               sprintf(ip, "%d.%d.%d.%d",
+                               NIPQUAD(inet_sk(req->sock->sk)->rcv_saddr));
+               dentry = __tux_lookup (req, ip, base, mnt);
+               if (!dentry || IS_ERR(dentry)) {
+                       if (PTR_ERR(dentry) == -EWOULDBLOCKIO)
+                               return dentry;
+                       base->dentry = dget(req->proto->main_docroot.dentry);
+                       base->mnt = mntget(req->proto->main_docroot.mnt);
+                       goto lookup_default;
+               }
+               if (req->virtual == TUX_VHOST_IP)
+                       goto done;
+
+               // fall through in mixed mode:
+       }
+
+       if (!req->host_len) {
+lookup_default:
+               *mnt = NULL;
+               dentry = __tux_lookup (req, tux_default_vhost, base, mnt);
+       } else {
+               char tmp [MAX_HOST_LEN*2];
+               char *host_path;
+
+               host_path = host_path_hash(req, tmp);
+               Dprintk("host path hash returned: {%s}\n", host_path);
+
+               dentry = NULL;
+               if (host_path) {
+                       *mnt = NULL;
+                       dentry = __tux_lookup (req, host_path, base, mnt);
+               }
+               if (!dentry || IS_ERR(dentry)) {
+                       if (PTR_ERR(dentry) == -EWOULDBLOCKIO)
+                               return dentry;
+                       base->dentry = dget(req->proto->main_docroot.dentry);
+                       base->mnt = mntget(req->proto->main_docroot.mnt);
+                       if (req->virtual >= TUX_VHOST_IP) {
+                               *mnt = NULL;
+                               dentry = __tux_lookup (req, ip, base, mnt);
+                               if (!dentry || IS_ERR(dentry)) {
+                                       if (PTR_ERR(dentry) == -EWOULDBLOCKIO)
+                                               return dentry;
+                                       base->dentry = dget(req->proto->main_docroot.dentry);
+                                       base->mnt = mntget(req->proto->main_docroot.mnt);
+                               }
+                       }
+                       goto lookup_default;
+               }
+       }
+done:
+       return dentry;
+}
+
+static void http_lookup_vhost (tux_req_t *req, int cachemiss)
+{
+       struct dentry *dentry;
+       struct nameidata base;
+       struct vfsmount *mnt = NULL;
+       unsigned int flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+       
+       Dprintk("http_lookup_vhost(%p, %d, virtual: %d, host: %s (%d).)\n", req, flag, req->virtual, req->host, req->host_len);
+
+       base.flags = LOOKUP_FOLLOW|flag;
+       base.last_type = LAST_ROOT;
+       base.dentry = dget(req->proto->main_docroot.dentry);
+       base.mnt = mntget(req->proto->main_docroot.mnt);
+
+       dentry = vhost_lookup(req, &base, &mnt);
+
+       Dprintk("looked up dentry %p.\n", dentry);
+
+       if (dentry && !IS_ERR(dentry) && !dentry->d_inode)
+               TUX_BUG();
+
+       if (!dentry || IS_ERR(dentry)) {
+               if (PTR_ERR(dentry) == -EWOULDBLOCKIO) {
+                       add_tux_atom(req, http_lookup_vhost);
+                       queue_cachemiss(req);
+                       return;
+               }
+               goto abort;
+       }
+
+       req->docroot_dentry = dentry;
+       req->docroot_mnt = mnt;
+
+       add_tux_atom(req, http_process_message);
+       add_req_to_workqueue(req);
+       return;
+abort:
+       if (dentry) {
+               if (!IS_ERR(dentry))
+                       dput(dentry);
+               dentry = NULL;
+       }
+       if (mnt) {
+               if (!IS_ERR(mnt))
+                       mntput(mnt);
+               mnt = NULL;
+       }
+       req_err(req);
+       add_req_to_workqueue(req);
+}
+
+static void http_process_message (tux_req_t *req, int cachemiss)
+{
+       tux_attribute_t *attr;
+       int missed;
+       unsigned int lookup_flag = cachemiss ? 0 : LOOKUP_ATOMIC;
+
+       Dprintk("handling req %p, cachemiss: %d.\n", req, cachemiss);
+
+       /*
+        * URL redirection support - redirect all valid requests
+        * to the first userspace module.
+        */
+       if (tux_all_userspace) {
+               tcapi_template_t *tcapi = get_first_usermodule();
+               if (tcapi) {
+                       req->usermode = 1;
+                       req->usermodule_idx = tcapi->userspace_id;
+                       goto usermode;
+               }
+       }
+       missed = lookup_url(req, lookup_flag);
+       if (missed == 2) {
+               if (req->query_str) {
+                       req->error = TUX_ERROR_REDIRECT;
+                       goto error;
+               }
+               send_ret_redirect(req, cachemiss);
+               return;
+       }
+       if (req->error)
+               goto error;
+       if (missed) {
+cachemiss:
+               if (cachemiss)
+                       TUX_BUG();
+               Dprintk("uncached request.\n");
+               INC_STAT(static_lookup_cachemisses);
+               if (req->dentry)
+                       TUX_BUG();
+               add_tux_atom(req, http_process_message);
+               queue_cachemiss(req);
+               return;
+       }
+       /*
+        * HTML directory indexing.
+        */
+       if (S_ISDIR(req->dentry->d_inode->i_mode))
+               return http_dirlist(req, cachemiss);
+       if (!S_ISREG(req->dentry->d_inode->i_mode))
+               TUX_BUG();
+
+
+       attr = req->dentry->d_extra_attributes;
+       if (!attr) {
+               attr = lookup_tux_attribute(req);
+               if (!attr)
+                       TUX_BUG();
+               req->dentry->d_extra_attributes = attr;
+       }
+       if (attr->mime)
+               Dprintk("using MIME type %s:%s, %d.\n", attr->mime->type, attr->mime->ext, attr->mime->special);
+       if (attr->tcapi) {
+               req->usermode = 1;
+               req->usermodule_idx = attr->tcapi->userspace_id;
+               if (req->module_dentry)
+                       TUX_BUG();
+               req->module_dentry = dget(req->dentry);
+               release_req_dentry(req);
+               goto usermode;
+       }
+
+       switch (attr->mime->special) {
+               case MIME_TYPE_MODULE:
+                       req->usermode = 1;
+                       goto usermode;
+
+               case MIME_TYPE_REDIRECT:
+                       req->error = TUX_ERROR_REDIRECT;
+                       goto error;
+
+               case MIME_TYPE_CGI:
+#if CONFIG_TUX_EXTCGI
+                       Dprintk("CGI request %p.\n", req);
+                       query_extcgi(req);
+                       return;
+#endif
+
+               default:
+                       if (req->query_str) {
+                               req->error = TUX_ERROR_REDIRECT;
+                               goto error;
+                       }
+       }
+       req->attr = attr;
+       switch (req->method) {
+               case METHOD_GET:
+               case METHOD_HEAD:
+                       break;
+               default:
+                       req->error = TUX_ERROR_REDIRECT;
+                       goto error;
+       }
+       if (req->usermode)
+               TUX_BUG();
+
+       req->output_len = req->total_file_len;
+       /*
+        * Do range calculations.
+        */
+       if (req->offset_end || req->offset_start)
+               handle_range(req);
+
+       if (req->may_send_gzip && !req->offset_start && !req->offset_end) {
+               if (handle_gzip_req(req, lookup_flag))
+                       goto cachemiss;
+               if ((tux_compression >= 2) && !req->content_gzipped)
+                       req->content_gzipped = 2;
+       }
+       if (req->parsed_len)
+               trunc_headers(req);
+
+       if (req->error)
+               goto error;
+
+       add_tux_atom(req, http_send_body);
+       add_tux_atom(req, http_post_header);
+
+       http_pre_header(req, req->method == METHOD_HEAD);
+
+       add_req_to_workqueue(req);
+       return;
+
+error:
+       if (req->error)
+               zap_request(req, cachemiss);
+       return;
+
+usermode:
+       add_req_to_workqueue(req);
+}
+
+static void http_post_header (tux_req_t *req, int cachemiss)
+{
+#if CONFIG_TUX_DEBUG
+       req->bytes_expected = req->output_len;
+#endif
+       req->bytes_sent = 0; // data comes now.
+
+       add_req_to_workqueue(req);
+}
+
+static void http_send_body (tux_req_t *req, int cachemiss)
+{
+       int ret;
+
+       Dprintk("SEND req %p <%p> (sock %p, sk %p) (keepalive: %d, status: %d)\n", req, __builtin_return_address(0), req->sock, req->sock->sk, req->keep_alive, req->status);
+
+       SET_TIMESTAMP(req->output_timestamp);
+
+       if (req->error) {
+#if CONFIG_TUX_DEBUG
+               req->bytes_expected = 0;
+#endif
+               req->in_file.f_pos = 0;
+               /*
+                * We are in the middle of a file transfer,
+                * zap it immediately:
+                */
+               TDprintk("req->error = TUX_ERROR_CONN_CLOSE.\n");
+               req->error = TUX_ERROR_CONN_CLOSE;
+               zap_request(req, cachemiss);
+               return;
+       }
+
+repeat:
+       ret = 0;
+       if (!req->status)
+               req->status = 200;
+       if (req->method != METHOD_HEAD) {
+               ret = generic_send_file(req, req->sock, cachemiss);
+               Dprintk("body send-file returned: %d.\n", ret);
+       } else {
+#if CONFIG_TUX_DEBUG
+               req->bytes_expected = 0;
+#endif
+       }
+
+       switch (ret) {
+               case -5:
+                       add_tux_atom(req, http_send_body);
+                       output_timeout(req);
+                       break;
+               case -4:
+                       add_tux_atom(req, http_send_body);
+                       if (add_output_space_event(req, req->sock)) {
+                               del_tux_atom(req);
+                               goto repeat;
+                       }
+                       break;
+               case -3:
+                       INC_STAT(static_sendfile_cachemisses);
+                       add_tux_atom(req, http_send_body);
+                       queue_cachemiss(req);
+                       break;
+               case -1:
+                       break;
+               default:
+                       req->in_file.f_pos = 0;
+                       add_req_to_workqueue(req);
+                       break;
+       }
+}
+
+#define DEFAULT_DATE "Wed, 01 Jan 1970 00:00:01 GMT"
+
+char tux_date [DATE_LEN] = DEFAULT_DATE;
+
+/*
+ * HTTP header
+ */
+
+#define HEADER_PART1A \
+               "HTTP/1.1 200 OK\r\n" \
+               "Content-Type: "
+
+#define HEADER_PART1B \
+               "HTTP/1.1 200 OK" 
+
+#define HEADER_PART1AP \
+               "HTTP/1.1 206 Partial Content\r\n" \
+               "Content-Type: "
+
+#define HEADER_PART1BP \
+               "HTTP/1.1 206 Partial Content" 
+
+#define HEADER_PART1C \
+               "HTTP/1.1 404 Page Not Found\r\n" \
+               "Content-Type: "
+
+#define HEADER_PART1D \
+               "HTTP/1.1 200 OK\r\n" \
+               "Content-Type: text/html\r\n" \
+               "Connection: close\r\n"
+
+#define HEADER_PART2_keepalive "\r\nConnection: Keep-Alive\r\nDate: "
+
+#define HEADER_PART2_close "\r\nConnection: close\r\nDate: "
+
+#define HEADER_PART2_none "\r\nDate: "
+
+// date "%s"
+
+#define HEADER_PART3A "\r\nContent-Encoding: gzip"
+#define HEADER_PART3BX "\r\nContent-Length: "
+
+/*
+ * Please acknowledge our hard work by not changing this define, or
+ * at least please acknowledge us by leaving "TUX/2.0 (Linux)" in
+ * the ID string. Thanks! :-)
+ */
+#define HEADER_PART3BY "\r\nServer: TUX/2.0 (Linux)\r\nContent-Length: "
+#define HEADER_PART3C "\r\nETag: \""
+#define HEADER_PART3ACC "\r\nAccept-Ranges: bytes"
+#define HEADER_PART3L "\r\nLast-Modified: "
+#define HEADER_PART3P "\r\nContent-Range: bytes "
+#define HEADER_PART3CA "\r\nCache-Control: max-age="
+#define HEADER_PART4 "\r\n\r\n"
+
+#define MAX_OUT_HEADER_LEN (sizeof(HEADER_PART1AP) + MAX_MIMETYPE_LEN + \
+               sizeof(HEADER_PART2_keepalive) + DATE_LEN + \
+               sizeof(HEADER_PART3A) + sizeof(HEADER_PART3BY) + \
+               12 + sizeof(HEADER_PART3C) + 21 + sizeof(HEADER_PART3L) + \
+               sizeof(HEADER_PART3P) + 32 + \
+               DATE_LEN + sizeof(HEADER_PART4) + sizeof(tux_extra_html_header) \
+               + sizeof(HEADER_PART3CA) + MAX_CACHE_CONTROL_AGE_LEN)
+
+static void http_pre_header (tux_req_t *req, int head)
+{
+       int partial = req->offset_start | req->offset_end;
+       unsigned long flags;
+       char *buf, *curr;
+       mimetype_t *mime = NULL;
+       int size;
+
+
+       if (MAX_OUT_HEADER_LEN > PAGE_SIZE)
+               TUX_BUG();
+       if ((req->attr && req->attr->tcapi) || req->usermode)
+               TUX_BUG();
+
+#define COPY_STATIC_PART(nr,curr)                                      \
+       do {    \
+               memcpy(curr, HEADER_PART##nr, sizeof(HEADER_PART##nr)-1); \
+               curr += sizeof(HEADER_PART##nr)-1;                      \
+       } while (0)
+
+       buf = curr = get_abuf(req, MAX_OUT_HEADER_LEN);
+
+       if (req->lookup_dir) {
+               COPY_STATIC_PART(1D, curr);
+               goto dir_next;
+       }
+       mime = req->attr->mime;
+       if (!mime)
+               TUX_BUG();
+
+       if (req->status == 404) {
+               COPY_STATIC_PART(1C, curr);
+               memcpy(curr, mime->type, mime->type_len);
+               curr += mime->type_len;
+       } else {
+               if (tux_noid && (mime == &default_mimetype)) {
+                       if (partial)
+                               COPY_STATIC_PART(1BP, curr);
+                       else
+                               COPY_STATIC_PART(1B, curr);
+               } else {
+                       if (partial)
+                               COPY_STATIC_PART(1AP, curr);
+                       else
+                               COPY_STATIC_PART(1A, curr);
+                       memcpy(curr, mime->type, mime->type_len);
+                       curr += mime->type_len;
+               }
+       }
+
+       if (tux_generate_cache_control && mime->expire_str_len) {
+               COPY_STATIC_PART(3CA, curr);
+               memcpy(curr, mime->expire_str, mime->expire_str_len);
+               curr += mime->expire_str_len;
+       }
+
+       if (req->keep_alive /* && (req->version == HTTP_1_0) */)
+               COPY_STATIC_PART(2_keepalive, curr);
+       else if (!req->keep_alive && (req->version == HTTP_1_1))
+               COPY_STATIC_PART(2_close, curr);
+       else
+               // HTTP/1.0 default means close
+               COPY_STATIC_PART(2_none, curr);
+
+dir_next:
+       memcpy(curr, tux_date, DATE_LEN-1);
+       curr += DATE_LEN-1;
+
+       if (req->content_gzipped)
+               COPY_STATIC_PART(3A, curr);
+
+       /*
+        * Content-Length:
+        */
+       if (!req->lookup_dir) {
+               if (tux_noid)
+                       COPY_STATIC_PART(3BX, curr);
+               else
+                       COPY_STATIC_PART(3BY, curr);
+
+               if (partial)
+                       curr += sprintf(curr, "%Ld", req->output_len);
+               else {
+                       if (req->content_gzipped)
+                               curr += sprintf(curr, "%Ld",
+                                                       req->total_file_len);
+                       else {
+                               memcpy(curr, &req->etag, req->lendigits);
+                               curr += req->lendigits;
+                       }
+               }
+               if (tux_generate_etags && (req->status != 404)) {
+                       COPY_STATIC_PART(3C, curr);
+                       memcpy(curr, &req->etag, req->etaglen);
+                       curr += req->etaglen;
+                       curr[0] = '"';
+                       curr++;
+               }
+               if (tux_generate_last_mod || tux_generate_etags)
+                       COPY_STATIC_PART(3ACC, curr);
+       }
+        if (tux_generate_last_mod && (req->status != 404)) {
+                COPY_STATIC_PART(3L, curr);
+               last_mod_time(curr, req->mtime);
+               curr += DATE_LEN-1;
+        }
+       if (partial) {
+               COPY_STATIC_PART(3P, curr);
+               curr += sprintf(curr, "%Ld-%Ld/%Ld", req->offset_start,
+                               req->offset_end-1, req->total_file_len);
+       }
+       COPY_STATIC_PART(4, curr);
+       /*
+        * Possibly add an extra HTML header:
+        */
+       if (tux_extra_html_header_size && mime && !strcmp(mime->type, "text/html")) {
+               unsigned int len = tux_extra_html_header_size;
+
+               memcpy(curr, tux_extra_html_header, len);
+               curr += len;
+       }
+
+       size = curr-buf;
+
+#if CONFIG_TUX_DEBUG
+       *curr = 0;
+       Dprintk("{%s} [%d/%d]\n", buf, size, strlen(buf));
+#endif
+
+       flags = MSG_DONTWAIT;
+       if (!head)
+               flags |= MSG_MORE;
+       send_abuf(req, size, flags);
+}
+
+void http_illegal_request (tux_req_t *req, int cachemiss)
+{
+       if (req->status == 304)
+               send_ret_notmodified(req);
+       else {
+               if (req->status == 403)
+                       send_async_err_forbidden(req);
+               else
+                       send_async_err_not_found(req);
+       }
+}
+
+static int http_check_req_err (tux_req_t *req, int cachemiss)
+{
+       if ((req->sock->sk->sk_state <= TCP_SYN_RECV) &&
+               !tcp_sk(req->sock->sk)->urg_data)
+                       return 0;
+       Dprintk("http_check_req_err(%p,%d): 1 (state: %d, urg: %d)\n",
+               req, cachemiss, req->sock->sk->sk_state,
+               tcp_sk(req->sock->sk)->urg_data);
+#if CONFIG_TUX_DEBUG
+       req->bytes_expected = 0;
+#endif
+       req->in_file.f_pos = 0;
+       req->error = TUX_ERROR_CONN_CLOSE;
+       zap_request(req, cachemiss);
+
+       return 1;
+}
+
+#define COPY_STR(str) \
+       do { memcpy(tmp, str, sizeof(str)-1); \
+       tmp += sizeof(str)-1; } while (0)
+
+static char * http_print_dir_line (tux_req_t *req, char *tmp, char *d_name, int d_len, int d_type, struct dentry *dentry, struct inode *inode)
+{
+       int len, spaces;
+       loff_t size;
+
+       switch (d_type) {
+       case DT_DIR:
+               COPY_STR("<IMG SRC=\"/icons/dir.gif\" ALT=\"[DIR]\">");
+               break;
+       case DT_REG:
+               if ((d_len >= 3) &&
+                       (d_name[d_len-3] == '.') &&
+                       (d_name[d_len-2] == 'g') &&
+                       (d_name[d_len-1] == 'z'))
+                       COPY_STR("<IMG SRC=\"/icons/compressed.gif\" ALT=\"[   ]\">");
+               else
+               if ((d_len >= 4) &&
+                       (d_name[d_len-4] == '.') &&
+                       (d_name[d_len-3] == 't') &&
+                       (d_name[d_len-2] == 'g') &&
+                       (d_name[d_len-1] == 'z'))
+                       COPY_STR("<IMG SRC=\"/icons/compressed.gif\" ALT=\"[   ]\">");
+               else
+               if ((d_len >= 4) &&
+                       (d_name[d_len-4] == '.') &&
+                       (d_name[d_len-3] == 't') &&
+                       (d_name[d_len-2] == 'x') &&
+                       (d_name[d_len-1] == 't'))
+                       COPY_STR("<IMG SRC=\"/icons/text.gif\" ALT=\"[   ]\">");
+               else
+               if ((d_len >= 4) &&
+                       (d_name[d_len-4] == '.') &&
+                       (d_name[d_len-3] == 'b') &&
+                       (d_name[d_len-2] == 'z') &&
+                       (d_name[d_len-1] == '2'))
+                       COPY_STR("<IMG SRC=\"/icons/compressed.gif\" ALT=\"[   ]\">");
+               else
+               if ((d_len >= 4) &&
+                       (d_name[d_len-4] == '.') &&
+                       (d_name[d_len-3] == 'z') &&
+                       (d_name[d_len-2] == 'i') &&
+                       (d_name[d_len-1] == 'p'))
+                       COPY_STR("<IMG SRC=\"/icons/compressed.gif\" ALT=\"[   ]\">");
+               else
+                       COPY_STR("<IMG SRC=\"/icons/file.gif\" ALT=\"[   ]\">");
+               break;
+       case DT_LNK:
+               COPY_STR("<IMG SRC=\"/icons/link.gif\" ALT=\"[LNK]\">");
+               break;
+       default:
+               if (tux_hide_unreadable)
+                       goto out_dput;
+               COPY_STR("<IMG SRC=\"/icons/unknown.gif\" ALT=\"[   ]\">");
+               break;
+       }
+
+#define LIST_1 " <A HREF=\""
+#define LIST_2 "\">"
+#define LIST_2_DIR "/\">"
+#define LIST_3 "</A> "
+
+       COPY_STR(LIST_1);
+       memcpy(tmp, d_name, d_len);
+       tmp += d_len;
+       if (d_type == DT_DIR)
+               COPY_STR(LIST_2_DIR);
+       else
+               COPY_STR(LIST_2);
+       spaces = 0;
+       len = d_len;
+
+       if (len > 25)
+               len = 25;
+       memcpy(tmp, d_name, len);
+       tmp += len;
+       if (len != d_len) {
+               *tmp++ = '.';
+               *tmp++ = '.';
+       } else {
+               if (d_type == DT_DIR)
+                       *tmp++ = '/';
+               else
+                       spaces++;
+               spaces++;
+       }
+       COPY_STR(LIST_3);
+       while (spaces) {
+               *tmp++ = ' ';
+               spaces--;
+       }
+#define FILL 25
+       if (d_len < FILL) {
+               memset(tmp, ' ', FILL-d_len);
+               tmp += FILL-d_len;
+       }
+
+       tmp += time_unix2ls(inode->i_mtime.tv_sec, tmp);
+       *tmp++ = ' ';
+
+       if (d_type != DT_REG) {
+               COPY_STR("        - ");
+               goto out_size;
+       }
+       size = inode->i_size >> 10;
+       if (size < 1024) {
+               tmp += sprintf(tmp, "%8Lik ", size);
+               goto out_size;
+       }
+       size >>= 10;
+       if (size < 1024) {
+               tmp += sprintf(tmp, "%8LiM ", size);
+               goto out_size;
+       }
+       size >>= 10;
+       if (size < 1024) {
+               tmp += sprintf(tmp, "%8LiG ", size);
+               goto out_size;
+       }
+       size >>= 10;
+       if (size < 1024) {
+               tmp += sprintf(tmp, "%8LiT ", size);
+               goto out_size;
+       }
+       size >>= 10;
+       tmp += sprintf(tmp, "%8LiT ", size);
+
+out_size:
+       *tmp++ = '\n';
+       *tmp = 0;
+
+       return tmp;
+out_dput:
+       return NULL;
+}
+
+tux_proto_t tux_proto_http = {
+       defer_accept: 1,
+       can_redirect: 1,
+       got_request: http_got_request,
+       parse_message: parse_http_message,
+       illegal_request: http_illegal_request,
+       check_req_err: http_check_req_err,
+       print_dir_line: http_print_dir_line,
+       name: "http",
+};
+
diff --git a/net/tux/redirect.c b/net/tux/redirect.c
new file mode 100644 (file)
index 0000000..86b5300
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * redirect.c: redirect requests to other server sockets (such as Apache).
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+static void dummy_destructor(struct open_request *req)
+{
+}
+
+static struct or_calltable dummy = 
+{
+       0,
+       NULL,
+       NULL,
+       &dummy_destructor,
+       NULL
+};
+
+static int redirect_sock (tux_req_t *req, const int port)
+{
+       struct socket *sock = req->sock;
+       struct open_request *tcpreq;
+       struct sock *sk, *oldsk;
+       int err = -1;
+
+       /*
+        * Look up (optional) listening user-space socket.
+        */
+       local_bh_disable();
+       sk = tcp_v4_lookup_listener(INADDR_ANY, port, 0);
+       /*
+        * Look up localhost listeners as well.
+        */
+       if (!sk) {
+               u32 daddr;
+               ((unsigned char *)&daddr)[0] = 127;
+               ((unsigned char *)&daddr)[1] = 0;
+               ((unsigned char *)&daddr)[2] = 0;
+               ((unsigned char *)&daddr)[3] = 1;
+               sk = tcp_v4_lookup_listener(daddr, port, 0);
+       }
+       local_bh_enable();
+
+       /* No secondary server found */
+       if (!sk)
+               goto out;
+
+       /*
+        * Requeue the 'old' socket as an accept-socket of
+        * the listening socket. This way we can shuffle
+        * a socket around. Since we've read the input data
+        * via the non-destructive MSG_PEEK, the secondary
+        * server can be used transparently.
+        */
+       oldsk = sock->sk;
+       lock_sock(sk);
+
+       if (sk->sk_state != TCP_LISTEN)
+               goto out_unlock;
+
+       tcpreq = tcp_openreq_alloc();
+       if (!tcpreq)
+               goto out_unlock;
+
+       unlink_tux_socket(req);
+
+       sock->sk = NULL;
+       sock->state = SS_UNCONNECTED;
+
+       tcpreq->class = &dummy;
+       write_lock_irq(&oldsk->sk_callback_lock);
+       oldsk->sk_socket = NULL;
+        oldsk->sk_sleep = NULL;
+       write_unlock_irq(&oldsk->sk_callback_lock);
+
+       tcp_sk(oldsk)->nonagle = 0;
+
+       tcp_acceptq_queue(sk, tcpreq, oldsk);
+
+       sk->sk_data_ready(sk, 0);
+
+       /*
+        * It's now completely up to the secondary
+        * server to handle this request.
+        */
+       sock_release(req->sock);
+       req->sock = NULL;
+       req->parsed_len = 0;
+       err = 0;
+       Dprintk("req %p redirected to secondary server!\n", req);
+
+out_unlock:
+       release_sock(sk);
+       sock_put(sk);
+out:
+       if (err)
+               Dprintk("NO secondary server for req %p!\n", req);
+       return err;
+}
+
+void redirect_request (tux_req_t *req, int cachemiss)
+{
+       if (tux_TDprintk && (req->status != 304)) {
+               TDprintk("trying to redirect req %p, req->error: %d, req->status: %d.\n", req, req->error, req->status);
+               print_req(req);
+       }
+
+       if (cachemiss)
+               TUX_BUG();
+       if (req->error == TUX_ERROR_CONN_CLOSE)
+               goto out_flush;
+       if (!req->sock)
+               TUX_BUG();
+
+       if (!req->status)
+               req->status = -1;
+       if (!req->proto->can_redirect || (req->status == 304) || redirect_sock(req, tux_clientport)) {
+               if (req->parsed_len)
+                       trunc_headers(req);
+               req->proto->illegal_request(req, cachemiss);
+               return;
+       } else {
+               if (req->data_sock)
+                       BUG();
+       }
+out_flush:
+       clear_keepalive(req);
+       if (!tux_redirect_logging)
+               req->status = 0;
+       flush_request(req, cachemiss);
+}
+
diff --git a/net/tux/times.c b/net/tux/times.c
new file mode 100644 (file)
index 0000000..3388f63
--- /dev/null
@@ -0,0 +1,392 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * times.c: time conversion routines.
+ *
+ * Original time convserion code Copyright (C) 1999 by Arjan van de Ven
+ */
+
+/****************************************************************
+ *     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; if not, write to the Free Software
+ *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
+#include <linux/time.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/ctype.h>
+
+
+#include "times.h"
+
+char *dayName[7] = {
+       "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+static char *monthName[12] = {
+       "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+       "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+char itoa_h[60]={'0','0','0','0','0','0','0','0','0','0',
+                '1','1','1','1','1','1','1','1','1','1',
+                '2','2','2','2','2','2','2','2','2','2',
+                '3','3','3','3','3','3','3','3','3','3',
+                '4','4','4','4','4','4','4','4','4','4',
+                '5','5','5','5','5','5','5','5','5','5'};
+               
+char itoa_l[60]={'0','1','2','3','4','5','6','7','8','9',
+                '0','1','2','3','4','5','6','7','8','9',
+                '0','1','2','3','4','5','6','7','8','9',
+                '0','1','2','3','4','5','6','7','8','9',
+                '0','1','2','3','4','5','6','7','8','9',
+                '0','1','2','3','4','5','6','7','8','9'};
+
+int time_unix2ls(time_t zulu, char *buf)
+{
+       int Y=0,M=0,D=0;
+       int H=0,Min=0,S=0,WD=0;
+       int I,I2;
+       time_t rest, delta;
+
+       if (zulu > xtime.tv_sec)
+               zulu = xtime.tv_sec;
+
+       I=0;
+       while (I<TUX_NUMYEARS) {
+               if (TimeDays[I][0]>zulu) 
+                  break;
+               I++;
+       }
+       
+       Y=--I;
+       if (I<0) {
+               Y=0;
+               goto BuildYear;
+       }
+       I2=0;
+       while (I2<=12) {
+               if (TimeDays[I][I2]>zulu) 
+                  break;
+               I2++;
+       }                          
+       
+       M=I2-1;
+       
+       rest=zulu - TimeDays[Y][M];
+       WD=WeekDays[Y][M];
+       D=rest/86400;
+       rest=rest%86400;
+       WD+=D;
+       WD=WD%7;
+       H=rest/3600;
+       rest=rest%3600;
+       Min=rest/60;
+       rest=rest%60;
+       S=rest;
+       
+BuildYear:
+       Y+=TUX_YEAROFFSET;
+       
+       
+       /* Format:  Day, 01 Mon 1999 01:01:01 GMT */
+
+       delta = xtime.tv_sec - zulu;
+       if (delta > 6*30*24*60)
+               //               "May 23   2000"
+               return sprintf( buf, "%s %02i  %04i", monthName[M], D+1, Y);
+       else
+               //                "May 23 10:14"
+               return sprintf( buf, "%s %02i %02i:%02i",
+                       monthName[M], D+1, H, Min);
+}
+
+static int MonthHash[32] =
+       {0,0,7,0,0,0,0,0,0,0,0,3,0,0,0,2,6,0,5,0,9,8,4,0,0,11,1,10,0,0,0,0};
+
+#define is_digit(c)    ((c) >= '0' && (c) <= '9')
+
+static inline int skip_atoi(char **s)
+{
+       int i=0;
+
+       while (is_digit(**s))
+               i = i*10 + *((*s)++) - '0';
+       return i;
+}
+
+time_t mimetime_to_unixtime(char *Q)
+{
+       int Y,M,D,H,Min,S;
+       unsigned int Hash;
+       time_t Temp;
+       char *s,**s2;
+       
+       s=Q;
+       s2=&s;
+       
+       if (strlen(s)<30) return 0;
+       if (s[3]!=',') return 0;
+       if (s[19]!=':') return 0;
+       
+       s+=5; /* Skip day of week */
+       D = skip_atoi(s2);  /*  Day of month */
+       s++;
+       Hash = (char)s[0]+(char)s[2];
+       Hash = (Hash<<1) + (char)s[1];
+       Hash = (Hash&63)>>1;
+       M = MonthHash[Hash];
+       s+=4;
+       Y = skip_atoi(s2); /* Year */
+       s++;
+       H = skip_atoi(s2); /* Hour */
+       s++;
+       Min = skip_atoi(s2); /* Minutes */
+       s++;
+       S = skip_atoi(s2); /* Seconds */
+       s++;
+       if ((s[0]!='G')||(s[1]!='M')||(s[2]!='T')) 
+       {       
+               return 0; /* No GMT */
+       }
+
+       if (Y<TUX_YEAROFFSET) Y = TUX_YEAROFFSET;
+       if (Y>TUX_YEAROFFSET+9) Y = TUX_YEAROFFSET+9;
+       
+       Temp =  TimeDays[Y-TUX_YEAROFFSET][M];
+       Temp += D*86400+H*3600+Min*60+S;
+       
+       return Temp;  
+}
+
+// writes the full http date, corresponding to time_t received
+
+void last_mod_time(char * curr, const time_t t)
+{
+       int day, tod, year, wday, mon, hour, min, sec;
+       tod = t % 86400;
+       day = t / 86400;
+       if (tod < 0) {
+               tod += 86400;
+               --day;
+       }
+       hour = tod / 3600;
+       tod %= 3600;
+       min = tod / 60;
+       sec = tod % 60;
+       wday = (day + 4) % 7;
+       if (wday < 0)
+               wday += 7;
+       day -= 11017;
+       /* day 0 is march 1, 2000 */
+       year = 5 + day / 146097;
+       day = day % 146097;
+       if (day < 0) {
+               day += 146097;
+               --year;
+       }
+       /* from now on, day is nonnegative */
+       year *= 4;
+       if (day == 146096) {
+               year += 3;
+               day = 36524;
+       } else {
+               year += day / 36524;
+               day %= 36524;
+       }
+       year *= 25;
+       year += day / 1461;
+       day %= 1461;
+       year *= 4;
+       if (day == 1460) {
+               year += 3;
+               day = 365;
+       } else {
+               year += day / 365;
+               day %= 365;
+       }
+       day *= 10;
+       mon = (day + 5) / 306;
+       day = day + 5 - 306 * mon;
+       day /= 10;
+       if (mon >= 10) {
+               ++year;
+               mon -= 10;
+       } else
+               mon += 2;
+       sprintf(curr, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", dayName[wday],
+               day+1, monthName[mon], year, hour, min, sec);
+}
+
+// writes the full date in ISO8601 format,
+// corresponding to time_t received
+// example: 20011126224910
+
+int mdtm_time(char * curr, const time_t t)
+{
+       int day, tod, year, wday, mon, hour, min, sec;
+       tod = t % 86400;
+       day = t / 86400;
+       if (tod < 0) {
+               tod += 86400;
+               --day;
+       }
+       hour = tod / 3600;
+       tod %= 3600;
+       min = tod / 60;
+       sec = tod % 60;
+       wday = (day + 4) % 7;
+       if (wday < 0)
+               wday += 7;
+       day -= 11017;
+       /* day 0 is march 1, 2000 */
+       year = 5 + day / 146097;
+       day = day % 146097;
+       if (day < 0) {
+               day += 146097;
+               --year;
+       }
+       /* from now on, day is nonnegative */
+       year *= 4;
+       if (day == 146096) {
+               year += 3;
+               day = 36524;
+       } else {
+               year += day / 36524;
+               day %= 36524;
+       }
+       year *= 25;
+       year += day / 1461;
+       day %= 1461;
+       year *= 4;
+       if (day == 1460) {
+               year += 3;
+               day = 365;
+       } else {
+               year += day / 365;
+               day %= 365;
+       }
+       day *= 10;
+       mon = (day + 5) / 306;
+       day = day + 5 - 306 * mon;
+       day /= 10;
+       if (mon >= 10) {
+               ++year;
+               mon -= 10;
+       } else
+               mon += 2;
+       return sprintf(curr, "213 %.4d%.2d%.2d%.2d%.2d%.2d\r\n",
+               year, mon+1, day+1, hour, min, sec);
+}
+
+static inline int make_num(const char *s)
+{
+       if (*s >= '0' && *s <= '9')
+               return 10 * (*s - '0') + *(s + 1) - '0';
+       else
+               return *(s + 1) - '0';
+}
+
+static inline int make_month(const char *s)
+{
+       int i;
+
+       for (i = 0; i < 12; i++)
+               if (!strncmp(monthName[i], s, 3))
+                       return i+1;
+       return 0;
+}
+
+time_t parse_time(const char *str, const int str_len)
+{
+       int hour;
+       int min;
+       int sec;
+       int mday;
+       int mon;
+       int year;
+
+       if (str[3] == ',') {
+               /* Thu, 09 Jan 1993 01:29:59 GMT */
+
+               if (str_len < 29) 
+                       return -1;
+
+               mday = make_num(str+5);
+               mon = make_month(str + 8);
+               year = 100 * make_num(str + 12) + make_num(str + 14);
+               hour = make_num(str + 17);
+               min = make_num(str + 20);
+               sec = make_num(str + 23);
+       }
+       else {
+               const char *s;
+               s = strchr(str, ',');
+               if (!s || (str_len - (s - str) < 24)) {
+                       /* Wed Jun  9 01:29:59 1993 */
+
+                       if (str_len < 24)
+                               return -1;
+
+                       mon = make_month(str+4);
+                       mday = make_num(str+8);
+                       hour = make_num(str+11);
+                       min = make_num(str+14);
+                       sec = make_num(str+17);
+                       year = make_num(str+20)*100 + make_num(str+22);
+               }
+               else {
+                       /* Thursday, 10-Jun-93 01:29:59 GMT */
+
+                       mday = make_num(s + 2);
+                       mon = make_month(s + 5);
+                       year = make_num(s + 9) + 1900;
+                       if (year < 1970)
+                               year += 100;
+                       hour = make_num(s + 12);
+                       min = make_num(s + 15);
+                       sec = make_num(s + 18);
+               }
+       }
+
+       if (sec < 0 || sec > 59)
+               return -1;
+       if (min < 0 || min > 59)
+               return -1;
+       if (hour < 0 || hour > 23)
+               return -1;
+       if (mday < 1 || mday > 31)
+               return -1;
+       if (mon < 1 || mon > 12)
+               return -1;
+       if (year < 1970 || year > 2020)
+               return -1;
+
+       return mktime(year, mon, mday, hour, min, sec);
+}
diff --git a/net/tux/times.h b/net/tux/times.h
new file mode 100644 (file)
index 0000000..09c389f
--- /dev/null
@@ -0,0 +1,26 @@
+static time_t TimeDays[10][13] = { 
+ { 852073200,  854751600,      857170800,      859849200,      862441200,      865119600,      867711600,      870390000,      873068400,      875660400,      878338800,      880930800,      883609200 } ,
+ { 883609200,  886287600,      888706800,      891385200,      893977200,      896655600,      899247600,      901926000,      904604400,      907196400,      909874800,      912466800,      915145200 } ,
+ { 915145200,  917823600,      920242800,      922921200,      925513200,      928191600,      930783600,      933462000,      936140400,      938732400,      941410800,      944002800,      946681200 } ,
+ { 946681200,  949359600,      951865200,      954543600,      957135600,      959814000,      962406000,      965084400,      967762800,      970354800,      973033200,      975625200,      978303600 } ,
+ { 978303600,  980982000,      983401200,      986079600,      988671600,      991350000,      993942000,      996620400,      999298800,      1001890800,     1004569200,     1007161200,     1009839600 } ,
+ { 1009839600, 1012518000,     1014937200,     1017615600,     1020207600,     1022886000,     1025478000,     1028156400,     1030834800,     1033426800,     1036105200,     1038697200,     1041375600 } ,
+ { 1041375600, 1044054000,     1046473200,     1049151600,     1051743600,     1054422000,     1057014000,     1059692400,     1062370800,     1064962800,     1067641200,     1070233200,     1072911600 } ,
+ { 1072911600, 1075590000,     1078095600,     1080774000,     1083366000,     1086044400,     1088636400,     1091314800,     1093993200,     1096585200,     1099263600,     1101855600,     1104534000 } ,
+ { 1104534000, 1107212400,     1109631600,     1112310000,     1114902000,     1117580400,     1120172400,     1122850800,     1125529200,     1128121200,     1130799600,     1133391600,     1136070000 } ,
+ { 1136070000, 1138748400,     1141167600,     1143846000,     1146438000,     1149116400,     1151708400,     1154386800,     1157065200,     1159657200,     1162335600,     1164927600,     1167606000 } 
+};
+static int WeekDays[10][13] = { 
+ { 3,  6,      6,      2,      4,      0,      2,      5,      1,      3,      6,      1,      4 } ,
+ { 4,  0,      0,      3,      5,      1,      3,      6,      2,      4,      0,      2,      5 } ,
+ { 5,  1,      1,      4,      6,      2,      4,      0,      3,      5,      1,      3,      6 } ,
+ { 6,  2,      3,      6,      1,      4,      6,      2,      5,      0,      3,      5,      1 } ,
+ { 1,  4,      4,      0,      2,      5,      0,      3,      6,      1,      4,      6,      2 } ,
+ { 2,  5,      5,      1,      3,      6,      1,      4,      0,      2,      5,      0,      3 } ,
+ { 3,  6,      6,      2,      4,      0,      2,      5,      1,      3,      6,      1,      4 } ,
+ { 4,  0,      1,      4,      6,      2,      4,      0,      3,      5,      1,      3,      6 } ,
+ { 6,  2,      2,      5,      0,      3,      5,      1,      4,      6,      2,      4,      0 } ,
+ { 0,  3,      3,      6,      1,      4,      6,      2,      5,      0,      3,      5,      1 } 
+};
+#define TUX_YEAROFFSET   1997
+#define TUX_NUMYEARS     10
diff --git a/net/tux/userspace.c b/net/tux/userspace.c
new file mode 100644 (file)
index 0000000..effd45d
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * TUX - Integrated Application Protocols Layer and Object Cache
+ *
+ * Copyright (C) 2000, 2001, Ingo Molnar <mingo@redhat.com>
+ *
+ * userspace.c: handle userspace-module requests
+ */
+
+#include <net/tux.h>
+
+/****************************************************************
+ *      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; if not, write to the Free Software
+ *      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************/
+
index e77179c..f727549 100644 (file)
@@ -35,7 +35,6 @@ EXPORT_SYMBOL(xfrm_parse_spi);
 EXPORT_SYMBOL(xfrm4_rcv);
 EXPORT_SYMBOL(xfrm4_tunnel_register);
 EXPORT_SYMBOL(xfrm4_tunnel_deregister);
-EXPORT_SYMBOL(xfrm4_tunnel_check_size);
 EXPORT_SYMBOL(xfrm_register_type);
 EXPORT_SYMBOL(xfrm_unregister_type);
 EXPORT_SYMBOL(xfrm_get_type);
index 2e60c84..e7db9f8 100644 (file)
@@ -204,6 +204,7 @@ out:
        return;
 
 expired:
+       read_unlock(&xp->lock);
        km_policy_expired(xp, dir, 1);
        xfrm_policy_delete(xp, dir);
        xfrm_pol_put(xp);
@@ -535,8 +536,11 @@ void xfrm_policy_delete(struct xfrm_policy *pol, int dir)
        write_lock_bh(&xfrm_policy_lock);
        pol = __xfrm_policy_unlink(pol, dir);
        write_unlock_bh(&xfrm_policy_lock);
-       if (pol)
+       if (pol) {
+               if (dir < XFRM_POLICY_MAX)
+                       atomic_inc(&flow_cache_genid);
                xfrm_policy_kill(pol);
+       }
 }
 
 int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
index 160bb61..f45fa55 100644 (file)
@@ -65,7 +65,6 @@ static void xfrm_state_gc_destroy(struct xfrm_state *x)
                xfrm_put_type(x->type);
        }
        kfree(x);
-       wake_up(&km_waitq);
 }
 
 static void xfrm_state_gc_task(void *data)
@@ -82,6 +81,7 @@ static void xfrm_state_gc_task(void *data)
                x = list_entry(entry, struct xfrm_state, bydst);
                xfrm_state_gc_destroy(x);
        }
+       wake_up(&km_waitq);
 }
 
 static inline unsigned long make_jiffies(long secs)
@@ -400,23 +400,17 @@ int xfrm_state_add(struct xfrm_state *x)
        spin_lock_bh(&xfrm_state_lock);
 
        x1 = afinfo->state_lookup(&x->id.daddr, x->id.spi, x->id.proto);
-       if (!x1) {
-               x1 = afinfo->find_acq(
-                       x->props.mode, x->props.reqid, x->id.proto,
-                       &x->id.daddr, &x->props.saddr, 0);
-               if (x1 && x1->id.spi != x->id.spi && x1->id.spi) {
-                       xfrm_state_put(x1);
-                       x1 = NULL;
-               }
-       }
-
-       if (x1 && x1->id.spi) {
+       if (x1) {
                xfrm_state_put(x1);
                x1 = NULL;
                err = -EEXIST;
                goto out;
        }
 
+       x1 = afinfo->find_acq(
+               x->props.mode, x->props.reqid, x->id.proto,
+               &x->id.daddr, &x->props.saddr, 0);
+
        __xfrm_state_insert(x);
        err = 0;
 
@@ -630,11 +624,12 @@ xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi)
                for (h=0; h<maxspi-minspi+1; h++) {
                        spi = minspi + net_random()%(maxspi-minspi+1);
                        x0 = xfrm_state_lookup(&x->id.daddr, htonl(spi), x->id.proto, x->props.family);
-                       if (x0 == NULL)
+                       if (x0 == NULL) {
+                               x->id.spi = htonl(spi);
                                break;
+                       }
                        xfrm_state_put(x0);
                }
-               x->id.spi = htonl(spi);
        }
        if (x->id.spi) {
                spin_lock_bh(&xfrm_state_lock);
index 99edfc6..eccc023 100644 (file)
@@ -267,6 +267,8 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma)
        if (err)
                return err;
 
+       xfrm_probe_algs();
+
        x = xfrm_state_construct(p, (struct rtattr **) xfrma, &err);
        if (!x)
                return err;
index 4931b3e..81c913c 100644 (file)
@@ -5,24 +5,11 @@
 # docproc:      Preprocess .tmpl file in order to generate .sgml docs
 # conmakehash:  Create arrays for initializing the kernel console tables
 
-host-progs     := conmakehash kallsyms modpost mk_elfconfig pnmtologo bin2c
-always         := $(host-progs) empty.o
-
-modpost-objs   := modpost.o file2alias.o sumversion.o
+host-progs     := conmakehash kallsyms pnmtologo bin2c
+always         := $(host-progs)
 
 subdir-$(CONFIG_MODVERSIONS)   += genksyms
+subdir-y       += mod
 
 # Let clean descend into subdirs
 subdir-        += basic lxdialog kconfig package
-
-# dependencies on generated files need to be listed explicitly
-
-$(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h
-
-quiet_cmd_elfconfig = MKELF   $@
-      cmd_elfconfig = $(obj)/mk_elfconfig $(ARCH) < $< > $@
-
-$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE
-       $(call if_changed,elfconfig)
-
-targets += elfconfig.h
index 9566309..19f5345 100644 (file)
@@ -50,7 +50,7 @@ _modpost: $(modules)
 # Step 2), invoke modpost
 #  Includes step 3,4
 quiet_cmd_modpost = MODPOST
-      cmd_modpost = scripts/modpost \
+      cmd_modpost = scripts/mod/modpost \
        $(if $(KBUILD_EXTMOD),-i,-o) $(symverfile) \
        $(filter-out FORCE,$^)
 
diff --git a/scripts/empty.c b/scripts/empty.c
deleted file mode 100644 (file)
index 49839cc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/* empty file to figure out endianness / word size */
diff --git a/scripts/file2alias.c b/scripts/file2alias.c
deleted file mode 100644 (file)
index fa8fd16..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-/* Simple code to turn various tables in an ELF file into alias definitions.
- * This deals with kernel datastructures where they should be
- * dealt with: in the kernel source.
- *
- * Copyright 2002-2003  Rusty Russell, IBM Corporation
- *           2003       Kai Germaschewski
- *           
- *
- * This software may be used and distributed according to the terms
- * of the GNU General Public License, incorporated herein by reference.
- */
-
-#include "modpost.h"
-
-/* We use the ELF typedefs, since we can't rely on stdint.h being present. */
-
-#if KERNEL_ELFCLASS == ELFCLASS32
-typedef Elf32_Addr     kernel_ulong_t;
-#else
-typedef Elf64_Addr     kernel_ulong_t;
-#endif
-
-typedef Elf32_Word     __u32;
-typedef Elf32_Half     __u16;
-typedef unsigned char  __u8;
-
-/* Big exception to the "don't include kernel headers into userspace, which
- * even potentially has different endianness and word sizes, since 
- * we handle those differences explicitly below */
-#include "../include/linux/mod_devicetable.h"
-
-#define ADD(str, sep, cond, field)                              \
-do {                                                            \
-        strcat(str, sep);                                       \
-        if (cond)                                               \
-                sprintf(str + strlen(str),                      \
-                        sizeof(field) == 1 ? "%02X" :           \
-                        sizeof(field) == 2 ? "%04X" :           \
-                        sizeof(field) == 4 ? "%08X" : "",       \
-                        field);                                 \
-        else                                                    \
-                sprintf(str + strlen(str), "*");                \
-} while(0)
-
-/* Looks like "usb:vNpNdlNdhNdcNdscNdpNicNiscNipN" */
-static int do_usb_entry(const char *filename,
-                       struct usb_device_id *id, char *alias)
-{
-       id->match_flags = TO_NATIVE(id->match_flags);
-       id->idVendor = TO_NATIVE(id->idVendor);
-       id->idProduct = TO_NATIVE(id->idProduct);
-       id->bcdDevice_lo = TO_NATIVE(id->bcdDevice_lo);
-       id->bcdDevice_hi = TO_NATIVE(id->bcdDevice_hi);
-
-       /*
-        * Some modules (visor) have empty slots as placeholder for
-        * run-time specification that results in catch-all alias
-        */
-       if (!(id->idVendor | id->bDeviceClass | id->bInterfaceClass))
-               return 1;
-
-       strcpy(alias, "usb:");
-       ADD(alias, "v", id->match_flags&USB_DEVICE_ID_MATCH_VENDOR,
-           id->idVendor);
-       ADD(alias, "p", id->match_flags&USB_DEVICE_ID_MATCH_PRODUCT,
-           id->idProduct);
-       ADD(alias, "dl", id->match_flags&USB_DEVICE_ID_MATCH_DEV_LO,
-           id->bcdDevice_lo);
-       ADD(alias, "dh", id->match_flags&USB_DEVICE_ID_MATCH_DEV_HI,
-           id->bcdDevice_hi);
-       ADD(alias, "dc", id->match_flags&USB_DEVICE_ID_MATCH_DEV_CLASS,
-           id->bDeviceClass);
-       ADD(alias, "dsc",
-           id->match_flags&USB_DEVICE_ID_MATCH_DEV_SUBCLASS,
-           id->bDeviceSubClass);
-       ADD(alias, "dp",
-           id->match_flags&USB_DEVICE_ID_MATCH_DEV_PROTOCOL,
-           id->bDeviceProtocol);
-       ADD(alias, "ic",
-           id->match_flags&USB_DEVICE_ID_MATCH_INT_CLASS,
-           id->bInterfaceClass);
-       ADD(alias, "isc",
-           id->match_flags&USB_DEVICE_ID_MATCH_INT_SUBCLASS,
-           id->bInterfaceSubClass);
-       ADD(alias, "ip",
-           id->match_flags&USB_DEVICE_ID_MATCH_INT_PROTOCOL,
-           id->bInterfaceProtocol);
-       return 1;
-}
-
-/* Looks like: ieee1394:venNmoNspNverN */
-static int do_ieee1394_entry(const char *filename,
-                            struct ieee1394_device_id *id, char *alias)
-{
-       id->match_flags = TO_NATIVE(id->match_flags);
-       id->vendor_id = TO_NATIVE(id->vendor_id);
-       id->model_id = TO_NATIVE(id->model_id);
-       id->specifier_id = TO_NATIVE(id->specifier_id);
-       id->version = TO_NATIVE(id->version);
-
-       strcpy(alias, "ieee1394:");
-       ADD(alias, "ven", id->match_flags & IEEE1394_MATCH_VENDOR_ID,
-           id->vendor_id);
-       ADD(alias, "mo", id->match_flags & IEEE1394_MATCH_MODEL_ID,
-           id->model_id);
-       ADD(alias, "sp", id->match_flags & IEEE1394_MATCH_SPECIFIER_ID,
-           id->specifier_id);
-       ADD(alias, "ver", id->match_flags & IEEE1394_MATCH_VERSION,
-           id->version);
-
-       return 1;
-}
-
-/* Looks like: pci:vNdNsvNsdNbcNscNiN. */
-static int do_pci_entry(const char *filename,
-                       struct pci_device_id *id, char *alias)
-{
-       /* Class field can be divided into these three. */
-       unsigned char baseclass, subclass, interface,
-               baseclass_mask, subclass_mask, interface_mask;
-
-       id->vendor = TO_NATIVE(id->vendor);
-       id->device = TO_NATIVE(id->device);
-       id->subvendor = TO_NATIVE(id->subvendor);
-       id->subdevice = TO_NATIVE(id->subdevice);
-       id->class = TO_NATIVE(id->class);
-       id->class_mask = TO_NATIVE(id->class_mask);
-
-       strcpy(alias, "pci:");
-       ADD(alias, "v", id->vendor != PCI_ANY_ID, id->vendor);
-       ADD(alias, "d", id->device != PCI_ANY_ID, id->device);
-       ADD(alias, "sv", id->subvendor != PCI_ANY_ID, id->subvendor);
-       ADD(alias, "sd", id->subdevice != PCI_ANY_ID, id->subdevice);
-
-       baseclass = (id->class) >> 16;
-       baseclass_mask = (id->class_mask) >> 16;
-       subclass = (id->class) >> 8;
-       subclass_mask = (id->class_mask) >> 8;
-       interface = id->class;
-       interface_mask = id->class_mask;
-
-       if ((baseclass_mask != 0 && baseclass_mask != 0xFF)
-           || (subclass_mask != 0 && subclass_mask != 0xFF)
-           || (interface_mask != 0 && interface_mask != 0xFF)) {
-               fprintf(stderr,
-                       "*** Warning: Can't handle masks in %s:%04X\n",
-                       filename, id->class_mask);
-               return 0;
-       }
-
-       ADD(alias, "bc", baseclass_mask == 0xFF, baseclass);
-       ADD(alias, "sc", subclass_mask == 0xFF, subclass);
-       ADD(alias, "i", interface_mask == 0xFF, interface);
-       return 1;
-}
-
-/* looks like: "ccw:tNmNdtNdmN" */ 
-static int do_ccw_entry(const char *filename,
-                       struct ccw_device_id *id, char *alias)
-{
-       id->match_flags = TO_NATIVE(id->match_flags);
-       id->cu_type = TO_NATIVE(id->cu_type);
-       id->cu_model = TO_NATIVE(id->cu_model);
-       id->dev_type = TO_NATIVE(id->dev_type);
-       id->dev_model = TO_NATIVE(id->dev_model);
-
-       strcpy(alias, "ccw:");
-       ADD(alias, "t", id->match_flags&CCW_DEVICE_ID_MATCH_CU_TYPE,
-           id->cu_type);
-       ADD(alias, "m", id->match_flags&CCW_DEVICE_ID_MATCH_CU_MODEL,
-           id->cu_model);
-       ADD(alias, "dt", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_TYPE,
-           id->dev_type);
-       ADD(alias, "dm", id->match_flags&CCW_DEVICE_ID_MATCH_DEVICE_TYPE,
-           id->dev_model);
-       return 1;
-}
-
-/* looks like: "pnp:dD" */
-static int do_pnp_entry(const char *filename,
-                       struct pnp_device_id *id, char *alias)
-{
-       sprintf(alias, "pnp:d%s", id->id);
-       return 1;
-}
-
-/* looks like: "pnp:cCdD..." */
-static int do_pnp_card_entry(const char *filename,
-                       struct pnp_card_device_id *id, char *alias)
-{
-       int i;
-
-       sprintf(alias, "pnp:c%s", id->id);
-       for (i = 0; i < PNP_MAX_DEVICES; i++) {
-               if (! *id->devs[i].id)
-                       break;
-               sprintf(alias + strlen(alias), "d%s", id->devs[i].id);
-       }
-       return 1;
-}
-
-/* Ignore any prefix, eg. v850 prepends _ */
-static inline int sym_is(const char *symbol, const char *name)
-{
-       const char *match;
-
-       match = strstr(symbol, name);
-       if (!match)
-               return 0;
-       return match[strlen(symbol)] == '\0';
-}
-
-static void do_table(void *symval, unsigned long size,
-                    unsigned long id_size,
-                    void *function,
-                    struct module *mod)
-{
-       unsigned int i;
-       char alias[500];
-       int (*do_entry)(const char *, void *entry, char *alias) = function;
-
-       if (size % id_size || size < id_size) {
-               fprintf(stderr, "*** Warning: %s ids %lu bad size "
-                       "(each on %lu)\n", mod->name, size, id_size);
-       }
-       /* Leave last one: it's the terminator. */
-       size -= id_size;
-
-       for (i = 0; i < size; i += id_size) {
-               if (do_entry(mod->name, symval+i, alias)) {
-                       /* Always end in a wildcard, for future extension */
-                       if (alias[strlen(alias)-1] != '*')
-                               strcat(alias, "*");
-                       buf_printf(&mod->dev_table_buf,
-                                  "MODULE_ALIAS(\"%s\");\n", alias);
-               }
-       }
-}
-
-/* Create MODULE_ALIAS() statements.
- * At this time, we cannot write the actual output C source yet,
- * so we write into the mod->dev_table_buf buffer. */
-void handle_moddevtable(struct module *mod, struct elf_info *info,
-                       Elf_Sym *sym, const char *symname)
-{
-       void *symval;
-
-       /* We're looking for a section relative symbol */
-       if (!sym->st_shndx || sym->st_shndx >= info->hdr->e_shnum)
-               return;
-
-       symval = (void *)info->hdr
-               + info->sechdrs[sym->st_shndx].sh_offset
-               + sym->st_value;
-
-       if (sym_is(symname, "__mod_pci_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct pci_device_id),
-                        do_pci_entry, mod);
-       else if (sym_is(symname, "__mod_usb_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct usb_device_id),
-                        do_usb_entry, mod);
-       else if (sym_is(symname, "__mod_ieee1394_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct ieee1394_device_id),
-                        do_ieee1394_entry, mod);
-       else if (sym_is(symname, "__mod_ccw_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct ccw_device_id),
-                        do_ccw_entry, mod);
-       else if (sym_is(symname, "__mod_pnp_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct pnp_device_id),
-                        do_pnp_entry, mod);
-       else if (sym_is(symname, "__mod_pnp_card_device_table"))
-               do_table(symval, sym->st_size, sizeof(struct pnp_card_device_id),
-                        do_pnp_card_entry, mod);
-}
-
-/* Now add out buffered information to the generated C source */
-void add_moddevtable(struct buffer *buf, struct module *mod)
-{
-       buf_printf(buf, "\n");
-       buf_write(buf, mod->dev_table_buf.p, mod->dev_table_buf.pos);
-       free(mod->dev_table_buf.p);
-}
index ea7408f..4cffc5b 100644 (file)
@@ -18,7 +18,7 @@ Summary: The Linux kernel (the core of the Linux operating system)
 # that the kernel isn't the stock distribution kernel, for example by
 # adding some text to the end of the version number.
 #
-%define sublevel 7
+%define sublevel 8
 %define kversion 2.6.%{sublevel}
 %define rpmversion 2.6.%{sublevel}
 %define rhbsys  %([ -r /etc/beehive-root ] && echo  || echo .`whoami`)
@@ -83,9 +83,7 @@ AutoReqProv: no
 # List the packages used during the kernel build
 #
 BuildPreReq: module-init-tools, patch >= 2.5.4, bash >= 2.03, sh-utils, tar
-BuildPreReq: bzip2, findutils, gzip, m4, perl, make >= 3.78, gnupg, kernel-utils >= 2.4-12.1.139
-# temporary req since modutils changed output format 
-#BuildPreReq: modutils >= 2.4.26-14
+BuildPreReq: bzip2, findutils, gzip, m4, perl, make >= 3.78, gnupg, kernel-utils >= 1:2.4-12.1.142
 BuildRequires: gcc >= 2.96-98, binutils >= 2.12, redhat-rpm-config
 BuildConflicts: rhbuildsys(DiskFree) < 500Mb
 BuildArchitectures: i686
@@ -495,10 +493,60 @@ fi
 %endif
 
 %changelog
+* Thu Sep 16 2004 Mark Huang <mlhuang@cs.princeton.edu>
+- merge to Fedora Core 2 2.6.8-1.521
+
+* Tue Aug 31 2004 Arjan van de Ven <arjanv@redhat.com>
+- fix execshield buglet with legacy binaries
+- 2.6.9-rc1-bk7
+
+* Mon Aug 30 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.9-rc1-bk6
+
+* Sat Aug 28 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.9-rc1-bk4, now with i915 DRM driver
+
+* Fri Aug 27 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.9-rc1-bk2 
+
+* Mon Aug 23 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8.1-bk2
+
+* Sat Aug 21 2004 Arjan van de Ven <arjanv@redhat.com>
+- attempt to fix early-udev bug
+
+* Fri Aug 13 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8-rc4-bk3
+- split execshield up some more
+
+* Fri Aug 13 2004 Dave Jones <davej@redhat.com>
+- Update SCSI whitelist again with some more card readers.
+
+* Mon Aug 9 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8-rc3-bk3
+
 * Thu Aug  5 2004 Mark Huang <mlhuang@cs.princeton.edu>
 - adapt for Fedora Core 2 based PlanetLab 3.0 (remove Source and Patch
   sections, most non-x86 sections, and GPG sections)
 
+* Wed Aug 4 2004 Arjan van de Ven <arjanv@redhat.com>
+- Add the flex-mmap bits for s390/s390x (Pete Zaitcev)
+- Add flex-mmap for x86-64 32 bit emulation
+- 2.6.8-rc3
+
+* Mon Aug 2 2004 Arjan van de Ven <arjanv@redhat.com>
+- Add Rik's token trashing control patch
+
+* Sun Aug 1 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8-rc2-bk11
+
+* Fri Jul 30 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8-rc2-bk8
+
+* Wed Jul 28 2004 Arjan van de Ven <arjanv@redhat.com>
+- 2.6.8-rc2-bk6
+- make a start at splitting up the execshield patchkit
+
 * Fri Jul 16 2004 Arjan van de Ven <arjanv@redhat.com>
 - ppc32 embedded updates
 
diff --git a/scripts/mk_elfconfig.c b/scripts/mk_elfconfig.c
deleted file mode 100644 (file)
index de2aabf..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <elf.h>
-
-int
-main(int argc, char **argv)
-{
-       unsigned char ei[EI_NIDENT];    
-       union { short s; char c[2]; } endian_test;
-
-       if (argc != 2) {
-               fprintf(stderr, "Error: no arch\n");
-       }
-       if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) {
-               fprintf(stderr, "Error: input truncated\n");
-               return 1;
-       }
-       if (memcmp(ei, ELFMAG, SELFMAG) != 0) {
-               fprintf(stderr, "Error: not ELF\n");
-               return 1;
-       }
-       switch (ei[EI_CLASS]) {
-       case ELFCLASS32:
-               printf("#define KERNEL_ELFCLASS ELFCLASS32\n");
-               break;
-       case ELFCLASS64:
-               printf("#define KERNEL_ELFCLASS ELFCLASS64\n");
-               break;
-       default:
-               abort();
-       }
-       switch (ei[EI_DATA]) {
-       case ELFDATA2LSB:
-               printf("#define KERNEL_ELFDATA ELFDATA2LSB\n");
-               break;
-       case ELFDATA2MSB:
-               printf("#define KERNEL_ELFDATA ELFDATA2MSB\n");
-               break;
-       default:
-               abort();
-       }
-
-       if (sizeof(unsigned long) == 4) {
-               printf("#define HOST_ELFCLASS ELFCLASS32\n");
-       } else if (sizeof(unsigned long) == 8) {
-               printf("#define HOST_ELFCLASS ELFCLASS64\n");
-       }
-
-       endian_test.s = 0x0102;
-       if (memcmp(endian_test.c, "\x01\x02", 2) == 0)
-               printf("#define HOST_ELFDATA ELFDATA2MSB\n");
-       else if (memcmp(endian_test.c, "\x02\x01", 2) == 0)
-               printf("#define HOST_ELFDATA ELFDATA2LSB\n");
-       else
-               abort();
-
-       if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0))
-               printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
-       else 
-               printf("#define MODULE_SYMBOL_PREFIX \"\"\n");
-
-       return 0;
-}
-
diff --git a/scripts/mkconfigs b/scripts/mkconfigs
deleted file mode 100755 (executable)
index abf711d..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2002 Khalid Aziz <khalid_aziz@hp.com>
-# Copyright (C) 2002 Randy Dunlap <rddunlap@osdl.org>
-# Copyright (C) 2002 Al Stone <ahs3@fc.hp.com>
-# Copyright (C) 2002 Hewlett-Packard Company
-#
-#   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.
-#
-# 
-# Rules to generate ikconfig.h from linux/.config:
-#      - Retain lines that begin with "CONFIG_"
-#      - Retain lines that begin with "# CONFIG_"
-#      - lines that use double-quotes must \\-escape-quote them
-
-if [ $# -lt 2 ]
-then
-       echo "Usage: `basename $0` <configuration_file> <Makefile>"
-       exit 1
-fi
-
-config=$1
-makefile=$2
-
-cat << EOF
-#ifndef _IKCONFIG_H
-#define _IKCONFIG_H
-/*
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * 
- * This file is generated automatically by scripts/mkconfigs. Do not edit.
- *
- */
-static char const ikconfig_config[] __attribute__((unused)) =
-"CONFIG_BEGIN=n\\n\\
-$(sed < $config -n 's/"/\\"/g;/^#\? \?CONFIG_/s/.*/&\\n\\/p')
-CONFIG_END=n\\n";
-#endif /* _IKCONFIG_H */
-EOF
diff --git a/scripts/modpost.c b/scripts/modpost.c
deleted file mode 100644 (file)
index 662e75b..0000000
+++ /dev/null
@@ -1,739 +0,0 @@
-/* Postprocess module symbol versions
- *
- * Copyright 2003       Kai Germaschewski
- *           2002-2003  Rusty Russell, IBM Corporation
- *
- * Based in part on module-init-tools/depmod.c,file2alias
- *
- * This software may be used and distributed according to the terms
- * of the GNU General Public License, incorporated herein by reference.
- *
- * Usage: modpost vmlinux module1.o module2.o ...
- */
-
-#include <ctype.h>
-#include "modpost.h"
-
-/* Are we using CONFIG_MODVERSIONS? */
-int modversions = 0;
-/* Warn about undefined symbols? (do so if we have vmlinux) */
-int have_vmlinux = 0;
-
-void
-fatal(const char *fmt, ...)
-{
-       va_list arglist;
-
-       fprintf(stderr, "FATAL: ");
-
-       va_start(arglist, fmt);
-       vfprintf(stderr, fmt, arglist);
-       va_end(arglist);
-
-       exit(1);
-}
-
-void
-warn(const char *fmt, ...)
-{
-       va_list arglist;
-
-       fprintf(stderr, "WARNING: ");
-
-       va_start(arglist, fmt);
-       vfprintf(stderr, fmt, arglist);
-       va_end(arglist);
-}
-
-void *do_nofail(void *ptr, const char *file, int line, const char *expr)
-{
-       if (!ptr) {
-               fatal("Memory allocation failure %s line %d: %s.\n",
-                     file, line, expr);
-       }
-       return ptr;
-}
-
-/* A list of all modules we processed */
-
-static struct module *modules;
-
-struct module *
-find_module(char *modname)
-{
-       struct module *mod;
-
-       for (mod = modules; mod; mod = mod->next)
-               if (strcmp(mod->name, modname) == 0)
-                       break;
-       return mod;
-}
-
-struct module *
-new_module(char *modname)
-{
-       struct module *mod;
-       char *p, *s;
-       
-       mod = NOFAIL(malloc(sizeof(*mod)));
-       memset(mod, 0, sizeof(*mod));
-       p = NOFAIL(strdup(modname));
-
-       /* strip trailing .o */
-       if ((s = strrchr(p, '.')) != NULL)
-               if (strcmp(s, ".o") == 0)
-                       *s = '\0';
-
-       /* add to list */
-       mod->name = p;
-       mod->next = modules;
-       modules = mod;
-
-       return mod;
-}
-
-/* A hash of all exported symbols,
- * struct symbol is also used for lists of unresolved symbols */
-
-#define SYMBOL_HASH_SIZE 1024
-
-struct symbol {
-       struct symbol *next;
-       struct module *module;
-       unsigned int crc;
-       int crc_valid;
-       char name[0];
-};
-
-static struct symbol *symbolhash[SYMBOL_HASH_SIZE];
-
-/* This is based on the hash agorithm from gdbm, via tdb */
-static inline unsigned int tdb_hash(const char *name)
-{
-       unsigned value; /* Used to compute the hash value.  */
-       unsigned   i;   /* Used to cycle through random values. */
-
-       /* Set the initial value from the key size. */
-       for (value = 0x238F13AF * strlen(name), i=0; name[i]; i++)
-               value = (value + (((unsigned char *)name)[i] << (i*5 % 24)));
-
-       return (1103515243 * value + 12345);
-}
-
-/* Allocate a new symbols for use in the hash of exported symbols or
- * the list of unresolved symbols per module */
-
-struct symbol *
-alloc_symbol(const char *name, struct symbol *next)
-{
-       struct symbol *s = NOFAIL(malloc(sizeof(*s) + strlen(name) + 1));
-
-       memset(s, 0, sizeof(*s));
-       strcpy(s->name, name);
-       s->next = next;
-       return s;
-}
-
-/* For the hash of exported symbols */
-
-void
-new_symbol(const char *name, struct module *module, unsigned int *crc)
-{
-       unsigned int hash;
-       struct symbol *new;
-
-       hash = tdb_hash(name) % SYMBOL_HASH_SIZE;
-       new = symbolhash[hash] = alloc_symbol(name, symbolhash[hash]);
-       new->module = module;
-       if (crc) {
-               new->crc = *crc;
-               new->crc_valid = 1;
-       }
-}
-
-struct symbol *
-find_symbol(const char *name)
-{
-       struct symbol *s;
-
-       /* For our purposes, .foo matches foo.  PPC64 needs this. */
-       if (name[0] == '.')
-               name++;
-
-       for (s = symbolhash[tdb_hash(name) % SYMBOL_HASH_SIZE]; s; s=s->next) {
-               if (strcmp(s->name, name) == 0)
-                       return s;
-       }
-       return NULL;
-}
-
-/* Add an exported symbol - it may have already been added without a
- * CRC, in this case just update the CRC */
-void
-add_exported_symbol(const char *name, struct module *module, unsigned int *crc)
-{
-       struct symbol *s = find_symbol(name);
-
-       if (!s) {
-               new_symbol(name, module, crc);
-               return;
-       }
-       if (crc) {
-               s->crc = *crc;
-               s->crc_valid = 1;
-       }
-}
-
-void *
-grab_file(const char *filename, unsigned long *size)
-{
-       struct stat st;
-       void *map;
-       int fd;
-
-       fd = open(filename, O_RDONLY);
-       if (fd < 0 || fstat(fd, &st) != 0)
-               return NULL;
-
-       *size = st.st_size;
-       map = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
-       close(fd);
-
-       if (map == MAP_FAILED)
-               return NULL;
-       return map;
-}
-
-/*
-   Return a copy of the next line in a mmap'ed file.
-   spaces in the beginning of the line is trimmed away.
-   Return a pointer to a static buffer.
-*/
-char*
-get_next_line(unsigned long *pos, void *file, unsigned long size)
-{
-       static char line[4096];
-       int skip = 1;
-       size_t len = 0;
-       char *p = (char *)file + *pos;
-       char *s = line;
-
-       for (; *pos < size ; (*pos)++)
-       {
-               if (skip && isspace(*p)) {
-                       p++;
-                       continue;
-               }
-               skip = 0;
-               if (*p != '\n' && (*pos < size)) {
-                       len++;
-                       *s++ = *p++;
-                       if (len > 4095)
-                               break; /* Too long, stop */
-               } else {
-                       /* End of string */
-                       *s = '\0';
-                       return line;
-               }
-       }
-       /* End of buffer */
-       return NULL;
-}
-
-void
-release_file(void *file, unsigned long size)
-{
-       munmap(file, size);
-}
-
-void
-parse_elf(struct elf_info *info, const char *filename)
-{
-       unsigned int i;
-       Elf_Ehdr *hdr = info->hdr;
-       Elf_Shdr *sechdrs;
-       Elf_Sym  *sym;
-
-       hdr = grab_file(filename, &info->size);
-       if (!hdr) {
-               perror(filename);
-               abort();
-       }
-       info->hdr = hdr;
-       if (info->size < sizeof(*hdr))
-               goto truncated;
-
-       /* Fix endianness in ELF header */
-       hdr->e_shoff    = TO_NATIVE(hdr->e_shoff);
-       hdr->e_shstrndx = TO_NATIVE(hdr->e_shstrndx);
-       hdr->e_shnum    = TO_NATIVE(hdr->e_shnum);
-       hdr->e_machine  = TO_NATIVE(hdr->e_machine);
-       sechdrs = (void *)hdr + hdr->e_shoff;
-       info->sechdrs = sechdrs;
-
-       /* Fix endianness in section headers */
-       for (i = 0; i < hdr->e_shnum; i++) {
-               sechdrs[i].sh_type   = TO_NATIVE(sechdrs[i].sh_type);
-               sechdrs[i].sh_offset = TO_NATIVE(sechdrs[i].sh_offset);
-               sechdrs[i].sh_size   = TO_NATIVE(sechdrs[i].sh_size);
-               sechdrs[i].sh_link   = TO_NATIVE(sechdrs[i].sh_link);
-               sechdrs[i].sh_name   = TO_NATIVE(sechdrs[i].sh_name);
-       }
-       /* Find symbol table. */
-       for (i = 1; i < hdr->e_shnum; i++) {
-               const char *secstrings
-                       = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset;
-
-               if (sechdrs[i].sh_offset > info->size)
-                       goto truncated;
-               if (strcmp(secstrings+sechdrs[i].sh_name, ".modinfo") == 0) {
-                       info->modinfo = (void *)hdr + sechdrs[i].sh_offset;
-                       info->modinfo_len = sechdrs[i].sh_size;
-               }
-               if (sechdrs[i].sh_type != SHT_SYMTAB)
-                       continue;
-
-               info->symtab_start = (void *)hdr + sechdrs[i].sh_offset;
-               info->symtab_stop  = (void *)hdr + sechdrs[i].sh_offset 
-                                                + sechdrs[i].sh_size;
-               info->strtab       = (void *)hdr + 
-                                    sechdrs[sechdrs[i].sh_link].sh_offset;
-       }
-       if (!info->symtab_start) {
-               fprintf(stderr, "modpost: %s no symtab?\n", filename);
-               abort();
-       }
-       /* Fix endianness in symbols */
-       for (sym = info->symtab_start; sym < info->symtab_stop; sym++) {
-               sym->st_shndx = TO_NATIVE(sym->st_shndx);
-               sym->st_name  = TO_NATIVE(sym->st_name);
-               sym->st_value = TO_NATIVE(sym->st_value);
-               sym->st_size  = TO_NATIVE(sym->st_size);
-       }
-       return;
-
- truncated:
-       fprintf(stderr, "modpost: %s is truncated.\n", filename);
-       abort();
-}
-
-void
-parse_elf_finish(struct elf_info *info)
-{
-       release_file(info->hdr, info->size);
-}
-
-#define CRC_PFX     MODULE_SYMBOL_PREFIX "__crc_"
-#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_"
-
-void
-handle_modversions(struct module *mod, struct elf_info *info,
-                  Elf_Sym *sym, const char *symname)
-{
-       unsigned int crc;
-
-       switch (sym->st_shndx) {
-       case SHN_COMMON:
-               fprintf(stderr, "*** Warning: \"%s\" [%s] is COMMON symbol\n",
-                       symname, mod->name);
-               break;
-       case SHN_ABS:
-               /* CRC'd symbol */
-               if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) {
-                       crc = (unsigned int) sym->st_value;
-                       add_exported_symbol(symname + strlen(CRC_PFX),
-                                           mod, &crc);
-                       modversions = 1;
-               }
-               break;
-       case SHN_UNDEF:
-               /* undefined symbol */
-               if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL)
-                       break;
-               /* ignore global offset table */
-               if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
-                       break;
-               /* ignore __this_module, it will be resolved shortly */
-               if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0)
-                       break;
-#ifdef STT_REGISTER
-               if (info->hdr->e_machine == EM_SPARC ||
-                   info->hdr->e_machine == EM_SPARCV9) {
-                       /* Ignore register directives. */
-                       if (ELF_ST_TYPE(sym->st_info) == STT_REGISTER)
-                               break;
-               }
-#endif
-               
-               if (memcmp(symname, MODULE_SYMBOL_PREFIX,
-                          strlen(MODULE_SYMBOL_PREFIX)) == 0)
-                       mod->unres = alloc_symbol(symname +
-                                                 strlen(MODULE_SYMBOL_PREFIX),
-                                                 mod->unres);
-               break;
-       default:
-               /* All exported symbols */
-               if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) {
-                       add_exported_symbol(symname + strlen(KSYMTAB_PFX),
-                                           mod, NULL);
-               }
-               break;
-       }
-}
-
-int
-is_vmlinux(const char *modname)
-{
-       const char *myname;
-
-       if ((myname = strrchr(modname, '/')))
-               myname++;
-       else
-               myname = modname;
-
-       return strcmp(myname, "vmlinux") == 0;
-}
-
-void
-read_symbols(char *modname)
-{
-       const char *symname;
-       struct module *mod;
-       struct elf_info info = { };
-       Elf_Sym *sym;
-
-       parse_elf(&info, modname);
-
-       mod = new_module(modname);
-
-       /* When there's no vmlinux, don't print warnings about
-        * unresolved symbols (since there'll be too many ;) */
-       if (is_vmlinux(modname)) {
-               unsigned int fake_crc = 0;
-               have_vmlinux = 1;
-               /* May not have this if !CONFIG_MODULE_UNLOAD: fake it.
-                  If it appears, we'll get the real CRC. */
-               add_exported_symbol("cleanup_module", mod, &fake_crc);
-               add_exported_symbol("struct_module", mod, &fake_crc);
-               mod->skip = 1;
-       }
-
-       for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
-               symname = info.strtab + sym->st_name;
-
-               handle_modversions(mod, &info, sym, symname);
-               handle_moddevtable(mod, &info, sym, symname);
-       }
-       maybe_frob_version(modname, info.modinfo, info.modinfo_len,
-                          (void *)info.modinfo - (void *)info.hdr);
-       parse_elf_finish(&info);
-
-       /* Our trick to get versioning for struct_module - it's
-        * never passed as an argument to an exported function, so
-        * the automatic versioning doesn't pick it up, but it's really
-        * important anyhow */
-       if (modversions) {
-               mod->unres = alloc_symbol("struct_module", mod->unres);
-
-               /* Always version init_module and cleanup_module, in
-                * case module doesn't have its own. */
-               mod->unres = alloc_symbol("init_module", mod->unres);
-               mod->unres = alloc_symbol("cleanup_module", mod->unres);
-       }
-}
-
-#define SZ 500
-
-/* We first write the generated file into memory using the
- * following helper, then compare to the file on disk and
- * only update the later if anything changed */
-
-void __attribute__((format(printf, 2, 3)))
-buf_printf(struct buffer *buf, const char *fmt, ...)
-{
-       char tmp[SZ];
-       int len;
-       va_list ap;
-       
-       va_start(ap, fmt);
-       len = vsnprintf(tmp, SZ, fmt, ap);
-       if (buf->size - buf->pos < len + 1) {
-               buf->size += 128;
-               buf->p = realloc(buf->p, buf->size);
-       }
-       strncpy(buf->p + buf->pos, tmp, len + 1);
-       buf->pos += len;
-       va_end(ap);
-}
-
-void
-buf_write(struct buffer *buf, const char *s, int len)
-{
-       if (buf->size - buf->pos < len) {
-               buf->size += len;
-               buf->p = realloc(buf->p, buf->size);
-       }
-       strncpy(buf->p + buf->pos, s, len);
-       buf->pos += len;
-}
-
-/* Header for the generated file */
-
-void
-add_header(struct buffer *b)
-{
-       buf_printf(b, "#include <linux/module.h>\n");
-       buf_printf(b, "#include <linux/vermagic.h>\n");
-       buf_printf(b, "#include <linux/compiler.h>\n");
-       buf_printf(b, "\n");
-       buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n");
-       buf_printf(b, "\n");
-       buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */
-       buf_printf(b, "struct module __this_module\n");
-       buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n");
-       buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n");
-       buf_printf(b, " .init = init_module,\n");
-       buf_printf(b, "#ifdef CONFIG_MODULE_UNLOAD\n");
-       buf_printf(b, " .exit = cleanup_module,\n");
-       buf_printf(b, "#endif\n");
-       buf_printf(b, "};\n");
-}
-
-/* Record CRCs for unresolved symbols */
-
-void
-add_versions(struct buffer *b, struct module *mod)
-{
-       struct symbol *s, *exp;
-
-       for (s = mod->unres; s; s = s->next) {
-               exp = find_symbol(s->name);
-               if (!exp || exp->module == mod) {
-                       if (have_vmlinux)
-                               fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
-                               "undefined!\n", s->name, mod->name);
-                       continue;
-               }
-               s->module = exp->module;
-               s->crc_valid = exp->crc_valid;
-               s->crc = exp->crc;
-       }
-
-       if (!modversions)
-               return;
-
-       buf_printf(b, "\n");
-       buf_printf(b, "static const struct modversion_info ____versions[]\n");
-       buf_printf(b, "__attribute_used__\n");
-       buf_printf(b, "__attribute__((section(\"__versions\"))) = {\n");
-
-       for (s = mod->unres; s; s = s->next) {
-               if (!s->module) {
-                       continue;
-               }
-               if (!s->crc_valid) {
-                       fprintf(stderr, "*** Warning: \"%s\" [%s.ko] "
-                               "has no CRC!\n",
-                               s->name, mod->name);
-                       continue;
-               }
-               buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name);
-       }
-
-       buf_printf(b, "};\n");
-}
-
-void
-add_depends(struct buffer *b, struct module *mod, struct module *modules)
-{
-       struct symbol *s;
-       struct module *m;
-       int first = 1;
-
-       for (m = modules; m; m = m->next) {
-               m->seen = is_vmlinux(m->name);
-       }
-
-       buf_printf(b, "\n");
-       buf_printf(b, "static const char __module_depends[]\n");
-       buf_printf(b, "__attribute_used__\n");
-       buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
-       buf_printf(b, "\"depends=");
-       for (s = mod->unres; s; s = s->next) {
-               if (!s->module)
-                       continue;
-
-               if (s->module->seen)
-                       continue;
-
-               s->module->seen = 1;
-               buf_printf(b, "%s%s", first ? "" : ",",
-                          strrchr(s->module->name, '/') + 1);
-               first = 0;
-       }
-       buf_printf(b, "\";\n");
-}
-
-void
-write_if_changed(struct buffer *b, const char *fname)
-{
-       char *tmp;
-       FILE *file;
-       struct stat st;
-
-       file = fopen(fname, "r");
-       if (!file)
-               goto write;
-
-       if (fstat(fileno(file), &st) < 0)
-               goto close_write;
-
-       if (st.st_size != b->pos)
-               goto close_write;
-
-       tmp = NOFAIL(malloc(b->pos));
-       if (fread(tmp, 1, b->pos, file) != b->pos)
-               goto free_write;
-
-       if (memcmp(tmp, b->p, b->pos) != 0)
-               goto free_write;
-
-       free(tmp);
-       fclose(file);
-       return;
-
- free_write:
-       free(tmp);
- close_write:
-       fclose(file);
- write:
-       file = fopen(fname, "w");
-       if (!file) {
-               perror(fname);
-               exit(1);
-       }
-       if (fwrite(b->p, 1, b->pos, file) != b->pos) {
-               perror(fname);
-               exit(1);
-       }
-       fclose(file);
-}
-
-void
-read_dump(const char *fname)
-{
-       unsigned long size, pos = 0;
-       void *file = grab_file(fname, &size);
-       char *line;
-
-        if (!file)
-               /* No symbol versions, silently ignore */
-               return;
-
-       while ((line = get_next_line(&pos, file, size))) {
-               char *symname, *modname, *d;
-               unsigned int crc;
-               struct module *mod;
-
-               if (!(symname = strchr(line, '\t')))
-                       goto fail;
-               *symname++ = '\0';
-               if (!(modname = strchr(symname, '\t')))
-                       goto fail;
-               *modname++ = '\0';
-               if (strchr(modname, '\t'))
-                       goto fail;
-               crc = strtoul(line, &d, 16);
-               if (*symname == '\0' || *modname == '\0' || *d != '\0')
-                       goto fail;
-
-               if (!(mod = find_module(modname))) {
-                       if (is_vmlinux(modname)) {
-                               modversions = 1;
-                               have_vmlinux = 1;
-                       }
-                       mod = new_module(NOFAIL(strdup(modname)));
-                       mod->skip = 1;
-               }
-               add_exported_symbol(symname, mod, &crc);
-       }
-       return;
-fail:
-       fatal("parse error in symbol dump file\n");
-}
-
-void
-write_dump(const char *fname)
-{
-       struct buffer buf = { };
-       struct symbol *symbol;
-       int n;
-
-       for (n = 0; n < SYMBOL_HASH_SIZE ; n++) {
-               symbol = symbolhash[n];
-               while (symbol) {
-                       symbol = symbol->next;
-               }
-       }
-
-       for (n = 0; n < SYMBOL_HASH_SIZE ; n++) {
-               symbol = symbolhash[n];
-               while (symbol) {
-                       buf_printf(&buf, "0x%08x\t%s\t%s\n", symbol->crc,
-                               symbol->name, symbol->module->name);
-                       symbol = symbol->next;
-               }
-       }
-       write_if_changed(&buf, fname);
-}
-
-int
-main(int argc, char **argv)
-{
-       struct module *mod;
-       struct buffer buf = { };
-       char fname[SZ];
-       char *dump_read = NULL, *dump_write = NULL;
-       int opt;
-
-       while ((opt = getopt(argc, argv, "i:o:")) != -1) {
-               switch(opt) {
-                       case 'i':
-                               dump_read = optarg;
-                               break;
-                       case 'o':
-                               dump_write = optarg;
-                               break;
-                       default:
-                               exit(1);
-               }
-       }
-
-       if (dump_read)
-               read_dump(dump_read);
-
-       while (optind < argc) {
-               read_symbols(argv[optind++]);
-       }
-
-       for (mod = modules; mod; mod = mod->next) {
-               if (mod->skip)
-                       continue;
-
-               buf.pos = 0;
-
-               add_header(&buf);
-               add_versions(&buf, mod);
-               add_depends(&buf, mod, modules);
-               add_moddevtable(&buf, mod);
-
-               sprintf(fname, "%s.mod.c", mod->name);
-               write_if_changed(&buf, fname);
-       }
-
-       if (dump_write)
-               write_dump(dump_write);
-
-       return 0;
-}
-
diff --git a/scripts/modpost.h b/scripts/modpost.h
deleted file mode 100644 (file)
index ddb013d..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <elf.h>
-
-#include "elfconfig.h"
-
-#if KERNEL_ELFCLASS == ELFCLASS32
-
-#define Elf_Ehdr    Elf32_Ehdr 
-#define Elf_Shdr    Elf32_Shdr 
-#define Elf_Sym     Elf32_Sym
-#define ELF_ST_BIND ELF32_ST_BIND
-#define ELF_ST_TYPE ELF32_ST_TYPE
-
-#else
-
-#define Elf_Ehdr    Elf64_Ehdr 
-#define Elf_Shdr    Elf64_Shdr 
-#define Elf_Sym     Elf64_Sym
-#define ELF_ST_BIND ELF64_ST_BIND
-#define ELF_ST_TYPE ELF64_ST_TYPE
-
-#endif
-
-#if KERNEL_ELFDATA != HOST_ELFDATA
-
-static inline void __endian(const void *src, void *dest, unsigned int size)
-{
-       unsigned int i;
-       for (i = 0; i < size; i++)
-               ((unsigned char*)dest)[i] = ((unsigned char*)src)[size - i-1];
-}
-
-
-
-#define TO_NATIVE(x)                                           \
-({                                                             \
-       typeof(x) __x;                                          \
-       __endian(&(x), &(__x), sizeof(__x));                    \
-       __x;                                                    \
-})
-
-#else /* endianness matches */
-
-#define TO_NATIVE(x) (x)
-
-#endif
-
-#define NOFAIL(ptr)   do_nofail((ptr), __FILE__, __LINE__, #ptr)
-void *do_nofail(void *ptr, const char *file, int line, const char *expr);
-
-struct buffer {
-       char *p;
-       int pos;
-       int size;
-};
-
-void __attribute__((format(printf, 2, 3)))
-buf_printf(struct buffer *buf, const char *fmt, ...);
-
-void
-buf_write(struct buffer *buf, const char *s, int len);
-
-struct module {
-       struct module *next;
-       const char *name;
-       struct symbol *unres;
-       int seen;
-       int skip;
-       struct buffer dev_table_buf;
-};
-
-struct elf_info {
-       unsigned long size;
-       Elf_Ehdr     *hdr;
-       Elf_Shdr     *sechdrs;
-       Elf_Sym      *symtab_start;
-       Elf_Sym      *symtab_stop;
-       const char   *strtab;
-       char         *modinfo;
-       unsigned int modinfo_len;
-};
-
-void handle_moddevtable(struct module *mod, struct elf_info *info,
-                       Elf_Sym *sym, const char *symname);
-
-void add_moddevtable(struct buffer *buf, struct module *mod);
-
-void maybe_frob_version(const char *modfilename,
-                       void *modinfo,
-                       unsigned long modinfo_len,
-                       unsigned long modinfo_offset);
-
-void *grab_file(const char *filename, unsigned long *size);
-char* get_next_line(unsigned long *pos, void *file, unsigned long size);
-void release_file(void *file, unsigned long size);
diff --git a/scripts/sumversion.c b/scripts/sumversion.c
deleted file mode 100644 (file)
index b41b718..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-#include <netinet/in.h>
-#include <stdint.h>
-#include <ctype.h>
-#include <errno.h>
-#include <string.h>
-#include "modpost.h"
-
-/* Parse tag=value strings from .modinfo section */
-static char *next_string(char *string, unsigned long *secsize)
-{
-       /* Skip non-zero chars */
-       while (string[0]) {
-               string++;
-               if ((*secsize)-- <= 1)
-                       return NULL;
-       }
-
-       /* Skip any zero padding. */
-       while (!string[0]) {
-               string++;
-               if ((*secsize)-- <= 1)
-                       return NULL;
-       }
-       return string;
-}
-
-static char *get_modinfo(void *modinfo, unsigned long modinfo_len,
-                        const char *tag)
-{
-       char *p;
-       unsigned int taglen = strlen(tag);
-       unsigned long size = modinfo_len;
-
-       for (p = modinfo; p; p = next_string(p, &size)) {
-               if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=')
-                       return p + taglen + 1;
-       }
-       return NULL;
-}
-
-/*
- * Stolen form Cryptographic API.
- *
- * MD4 Message Digest Algorithm (RFC1320).
- *
- * Implementation derived from Andrew Tridgell and Steve French's
- * CIFS MD4 implementation, and the cryptoapi implementation
- * originally based on the public domain implementation written
- * by Colin Plumb in 1993.
- *
- * Copyright (c) Andrew Tridgell 1997-1998.
- * Modified by Steve French (sfrench@us.ibm.com) 2002
- * Copyright (c) Cryptoapi developers.
- * Copyright (c) 2002 David S. Miller (davem@redhat.com)
- * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- */
-#define MD4_DIGEST_SIZE                16
-#define MD4_HMAC_BLOCK_SIZE    64
-#define MD4_BLOCK_WORDS                16
-#define MD4_HASH_WORDS         4
-
-struct md4_ctx {
-       uint32_t hash[MD4_HASH_WORDS];
-       uint32_t block[MD4_BLOCK_WORDS];
-       uint64_t byte_count;
-};
-
-static inline uint32_t lshift(uint32_t x, unsigned int s)
-{
-       x &= 0xFFFFFFFF;
-       return ((x << s) & 0xFFFFFFFF) | (x >> (32 - s));
-}
-
-static inline uint32_t F(uint32_t x, uint32_t y, uint32_t z)
-{
-       return (x & y) | ((~x) & z);
-}
-
-static inline uint32_t G(uint32_t x, uint32_t y, uint32_t z)
-{
-       return (x & y) | (x & z) | (y & z);
-}
-
-static inline uint32_t H(uint32_t x, uint32_t y, uint32_t z)
-{
-       return x ^ y ^ z;
-}
-
-#define ROUND1(a,b,c,d,k,s) (a = lshift(a + F(b,c,d) + k, s))
-#define ROUND2(a,b,c,d,k,s) (a = lshift(a + G(b,c,d) + k + (uint32_t)0x5A827999,s))
-#define ROUND3(a,b,c,d,k,s) (a = lshift(a + H(b,c,d) + k + (uint32_t)0x6ED9EBA1,s))
-
-/* XXX: this stuff can be optimized */
-static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words)
-{
-       while (words--) {
-               *buf = ntohl(*buf);
-               buf++;
-       }
-}
-
-static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words)
-{
-       while (words--) {
-               *buf = htonl(*buf);
-               buf++;
-       }
-}
-
-static void md4_transform(uint32_t *hash, uint32_t const *in)
-{
-       uint32_t a, b, c, d;
-
-       a = hash[0];
-       b = hash[1];
-       c = hash[2];
-       d = hash[3];
-
-       ROUND1(a, b, c, d, in[0], 3);
-       ROUND1(d, a, b, c, in[1], 7);
-       ROUND1(c, d, a, b, in[2], 11);
-       ROUND1(b, c, d, a, in[3], 19);
-       ROUND1(a, b, c, d, in[4], 3);
-       ROUND1(d, a, b, c, in[5], 7);
-       ROUND1(c, d, a, b, in[6], 11);
-       ROUND1(b, c, d, a, in[7], 19);
-       ROUND1(a, b, c, d, in[8], 3);
-       ROUND1(d, a, b, c, in[9], 7);
-       ROUND1(c, d, a, b, in[10], 11);
-       ROUND1(b, c, d, a, in[11], 19);
-       ROUND1(a, b, c, d, in[12], 3);
-       ROUND1(d, a, b, c, in[13], 7);
-       ROUND1(c, d, a, b, in[14], 11);
-       ROUND1(b, c, d, a, in[15], 19);
-
-       ROUND2(a, b, c, d,in[ 0], 3);
-       ROUND2(d, a, b, c, in[4], 5);
-       ROUND2(c, d, a, b, in[8], 9);
-       ROUND2(b, c, d, a, in[12], 13);
-       ROUND2(a, b, c, d, in[1], 3);
-       ROUND2(d, a, b, c, in[5], 5);
-       ROUND2(c, d, a, b, in[9], 9);
-       ROUND2(b, c, d, a, in[13], 13);
-       ROUND2(a, b, c, d, in[2], 3);
-       ROUND2(d, a, b, c, in[6], 5);
-       ROUND2(c, d, a, b, in[10], 9);
-       ROUND2(b, c, d, a, in[14], 13);
-       ROUND2(a, b, c, d, in[3], 3);
-       ROUND2(d, a, b, c, in[7], 5);
-       ROUND2(c, d, a, b, in[11], 9);
-       ROUND2(b, c, d, a, in[15], 13);
-
-       ROUND3(a, b, c, d,in[ 0], 3);
-       ROUND3(d, a, b, c, in[8], 9);
-       ROUND3(c, d, a, b, in[4], 11);
-       ROUND3(b, c, d, a, in[12], 15);
-       ROUND3(a, b, c, d, in[2], 3);
-       ROUND3(d, a, b, c, in[10], 9);
-       ROUND3(c, d, a, b, in[6], 11);
-       ROUND3(b, c, d, a, in[14], 15);
-       ROUND3(a, b, c, d, in[1], 3);
-       ROUND3(d, a, b, c, in[9], 9);
-       ROUND3(c, d, a, b, in[5], 11);
-       ROUND3(b, c, d, a, in[13], 15);
-       ROUND3(a, b, c, d, in[3], 3);
-       ROUND3(d, a, b, c, in[11], 9);
-       ROUND3(c, d, a, b, in[7], 11);
-       ROUND3(b, c, d, a, in[15], 15);
-
-       hash[0] += a;
-       hash[1] += b;
-       hash[2] += c;
-       hash[3] += d;
-}
-
-static inline void md4_transform_helper(struct md4_ctx *ctx)
-{
-       le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(uint32_t));
-       md4_transform(ctx->hash, ctx->block);
-}
-
-static void md4_init(struct md4_ctx *mctx)
-{
-       mctx->hash[0] = 0x67452301;
-       mctx->hash[1] = 0xefcdab89;
-       mctx->hash[2] = 0x98badcfe;
-       mctx->hash[3] = 0x10325476;
-       mctx->byte_count = 0;
-}
-
-static void md4_update(struct md4_ctx *mctx,
-                      const unsigned char *data, unsigned int len)
-{
-       const uint32_t avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f);
-
-       mctx->byte_count += len;
-
-       if (avail > len) {
-               memcpy((char *)mctx->block + (sizeof(mctx->block) - avail),
-                      data, len);
-               return;
-       }
-
-       memcpy((char *)mctx->block + (sizeof(mctx->block) - avail),
-              data, avail);
-
-       md4_transform_helper(mctx);
-       data += avail;
-       len -= avail;
-
-       while (len >= sizeof(mctx->block)) {
-               memcpy(mctx->block, data, sizeof(mctx->block));
-               md4_transform_helper(mctx);
-               data += sizeof(mctx->block);
-               len -= sizeof(mctx->block);
-       }
-
-       memcpy(mctx->block, data, len);
-}
-
-static void md4_final_ascii(struct md4_ctx *mctx, char *out, unsigned int len)
-{
-       const unsigned int offset = mctx->byte_count & 0x3f;
-       char *p = (char *)mctx->block + offset;
-       int padding = 56 - (offset + 1);
-
-       *p++ = 0x80;
-       if (padding < 0) {
-               memset(p, 0x00, padding + sizeof (uint64_t));
-               md4_transform_helper(mctx);
-               p = (char *)mctx->block;
-               padding = 56;
-       }
-
-       memset(p, 0, padding);
-       mctx->block[14] = mctx->byte_count << 3;
-       mctx->block[15] = mctx->byte_count >> 29;
-       le32_to_cpu_array(mctx->block, (sizeof(mctx->block) -
-                         sizeof(uint64_t)) / sizeof(uint32_t));
-       md4_transform(mctx->hash, mctx->block);
-       cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(uint32_t));
-
-       snprintf(out, len, "%08X%08X%08X%08X",
-                mctx->hash[0], mctx->hash[1], mctx->hash[2], mctx->hash[3]);
-}
-
-static inline void add_char(unsigned char c, struct md4_ctx *md)
-{
-       md4_update(md, &c, 1);
-}
-
-static int parse_string(const char *file, unsigned long len,
-                       struct md4_ctx *md)
-{
-       unsigned long i;
-
-       add_char(file[0], md);
-       for (i = 1; i < len; i++) {
-               add_char(file[i], md);
-               if (file[i] == '"' && file[i-1] != '\\')
-                       break;
-       }
-       return i;
-}
-
-static int parse_comment(const char *file, unsigned long len)
-{
-       unsigned long i;
-
-       for (i = 2; i < len; i++) {
-               if (file[i-1] == '*' && file[i] == '/')
-                       break;
-       }
-       return i;
-}
-
-/* FIXME: Handle .s files differently (eg. # starts comments) --RR */
-static int parse_file(const char *fname, struct md4_ctx *md)
-{
-       char *file;
-       unsigned long i, len;
-
-       file = grab_file(fname, &len);
-       if (!file)
-               return 0;
-
-       for (i = 0; i < len; i++) {
-               /* Collapse and ignore \ and CR. */
-               if (file[i] == '\\' && (i+1 < len) && file[i+1] == '\n') {
-                       i++;
-                       continue;
-               }
-
-               /* Ignore whitespace */
-               if (isspace(file[i]))
-                       continue;
-
-               /* Handle strings as whole units */
-               if (file[i] == '"') {
-                       i += parse_string(file+i, len - i, md);
-                       continue;
-               }
-
-               /* Comments: ignore */
-               if (file[i] == '/' && file[i+1] == '*') {
-                       i += parse_comment(file+i, len - i);
-                       continue;
-               }
-
-               add_char(file[i], md);
-       }
-       release_file(file, len);
-       return 1;
-}
-
-/* We have dir/file.o.  Open dir/.file.o.cmd, look for deps_ line to
- * figure out source file. */
-static int parse_source_files(const char *objfile, struct md4_ctx *md)
-{
-       char *cmd, *file, *line, *dir;
-       const char *base;
-       unsigned long flen, pos = 0;
-       int dirlen, ret = 0, check_files = 0;
-
-       cmd = NOFAIL(malloc(strlen(objfile) + sizeof("..cmd")));
-
-       base = strrchr(objfile, '/');
-       if (base) {
-               base++;
-               dirlen = base - objfile;
-               sprintf(cmd, "%.*s.%s.cmd", dirlen, objfile, base);
-       } else {
-               dirlen = 0;
-               sprintf(cmd, ".%s.cmd", objfile);
-       }
-       dir = NOFAIL(malloc(dirlen + 1));
-       strncpy(dir, objfile, dirlen);
-       dir[dirlen] = '\0';
-
-       file = grab_file(cmd, &flen);
-       if (!file) {
-               fprintf(stderr, "Warning: could not find %s for %s\n",
-                       cmd, objfile);
-               goto out;
-       }
-
-       /* There will be a line like so:
-               deps_drivers/net/dummy.o := \
-                 drivers/net/dummy.c \
-                   $(wildcard include/config/net/fastroute.h) \
-                 include/linux/config.h \
-                   $(wildcard include/config/h.h) \
-                 include/linux/module.h \
-
-          Sum all files in the same dir or subdirs.
-       */
-       while ((line = get_next_line(&pos, file, flen)) != NULL) {
-               char* p = line;
-               if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
-                       check_files = 1;
-                       continue;
-               }
-               if (!check_files)
-                       continue;
-
-               /* Continue until line does not end with '\' */
-               if ( *(p + strlen(p)-1) != '\\')
-                       break;
-               /* Terminate line at first space, to get rid of final ' \' */
-               while (*p) {
-                       if (isspace(*p)) {
-                               *p = '\0';
-                               break;
-                       }
-                       p++;
-               }
-
-               /* 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));
-                               goto out_file;
-                       }
-
-               }
-
-       }
-
-       /* Everyone parsed OK */
-       ret = 1;
-out_file:
-       release_file(file, flen);
-out:
-       free(dir);
-       free(cmd);
-       return ret;
-}
-
-static int get_version(const char *modname, char sum[])
-{
-       void *file;
-       unsigned long len;
-       int ret = 0;
-       struct md4_ctx md;
-       char *sources, *end, *fname;
-       const char *basename;
-       char filelist[sizeof(".tmp_versions/%s.mod") + strlen(modname)];
-
-       /* Source files for module are in .tmp_versions/modname.mod,
-          after the first line. */
-       if (strrchr(modname, '/'))
-               basename = strrchr(modname, '/') + 1;
-       else
-               basename = modname;
-       sprintf(filelist, ".tmp_versions/%s", basename);
-       /* Truncate .o, add .mod */
-       strcpy(filelist + strlen(filelist)-2, ".mod");
-
-       file = grab_file(filelist, &len);
-       if (!file) {
-               fprintf(stderr, "Warning: could not find versions for %s\n",
-                       filelist);
-               return 0;
-       }
-
-       sources = strchr(file, '\n');
-       if (!sources) {
-               fprintf(stderr, "Warning: 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);
-               goto release;
-       }
-       *end = '\0';
-
-       md4_init(&md);
-       for (fname = strtok(sources, " "); fname; fname = strtok(NULL, " ")) {
-               if (!parse_source_files(fname, &md))
-                       goto release;
-       }
-
-       /* sum is of form \0<padding>. */
-       md4_final_ascii(&md, sum, 1 + strlen(sum+1));
-       ret = 1;
-release:
-       release_file(file, len);
-       return ret;
-}
-
-static void write_version(const char *filename, const char *sum,
-                         unsigned long offset)
-{
-       int fd;
-
-       fd = open(filename, O_RDWR);
-       if (fd < 0) {
-               fprintf(stderr, "Warning: 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",
-                       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",
-                       filename, strerror(errno));
-               goto out;
-       }
-out:
-       close(fd);
-}
-
-void strip_rcs_crap(char *version)
-{
-       unsigned int len, full_len;
-
-       if (strncmp(version, "$Revision", strlen("$Revision")) != 0)
-               return;
-
-       /* Space for version string follows. */
-       full_len = strlen(version) + strlen(version + strlen(version) + 1) + 2;
-
-       /* Move string to start with version number: prefix will be
-        * $Revision$ or $Revision: */
-       len = strlen("$Revision");
-       if (version[len] == ':' || version[len] == '$')
-               len++;
-       while (isspace(version[len]))
-               len++;
-       memmove(version, version+len, full_len-len);
-       full_len -= len;
-
-       /* Preserve up to next whitespace. */
-       len = 0;
-       while (version[len] && !isspace(version[len]))
-               len++;
-       memmove(version + len, version + strlen(version),
-               full_len - strlen(version));
-}
-
-/* If the modinfo contains a "version" value, then set this. */
-void maybe_frob_version(const char *modfilename,
-                       void *modinfo,
-                       unsigned long modinfo_len,
-                       unsigned long modinfo_offset)
-{
-       char *version, *csum;
-
-       version = get_modinfo(modinfo, modinfo_len, "version");
-       if (!version)
-               return;
-
-       /* RCS $Revision gets stripped out. */
-       strip_rcs_crap(version);
-
-       /* Check against double sumversion */
-       if (strchr(version, ' '))
-               return;
-
-       /* Version contains embedded NUL: second half has space for checksum */
-       csum = version + strlen(version);
-       *(csum++) = ' ';
-       if (get_version(modfilename, csum))
-               write_version(modfilename, version,
-                             modinfo_offset + (version - (char *)modinfo));
-}
index 72cd0e5..52fa3cf 100644 (file)
@@ -63,6 +63,7 @@
 #include <net/ipv6.h>
 #include <linux/hugetlb.h>
 #include <linux/major.h>
+#include <linux/personality.h>
 
 #include "avc.h"
 #include "objsec.h"
@@ -1684,6 +1685,9 @@ static int selinux_bprm_set_security(struct linux_binprm *bprm)
                if (rc)
                        return rc;
 
+               /* Clear any possibly unsafe personality bits on exec: */
+               current->personality &= ~PER_CLEAR_ON_SETID;
+
                /* Set the security field to the new SID. */
                bsec->sid = newsid;
        }
index 3c42016..86e50e5 100644 (file)
@@ -672,7 +672,7 @@ snd_pcm_sframes_t snd_pcm_oss_read3(snd_pcm_substream_t *substream, char *ptr, s
                        else
                                printk("pcm_oss: read: recovering from SUSPEND\n");
 #endif
-                       ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, 0);
+                       ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
                        if (ret < 0)
                                break;
                } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) {
@@ -693,7 +693,7 @@ snd_pcm_sframes_t snd_pcm_oss_read3(snd_pcm_substream_t *substream, char *ptr, s
                }
                if (ret == -EPIPE) {
                        if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
-                               ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, 0);
+                               ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
                                if (ret < 0)
                                        break;
                        }
@@ -754,7 +754,7 @@ snd_pcm_sframes_t snd_pcm_oss_readv3(snd_pcm_substream_t *substream, void **bufs
                        else
                                printk("pcm_oss: readv: recovering from SUSPEND\n");
 #endif
-                       ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, 0);
+                       ret = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DRAIN, NULL);
                        if (ret < 0)
                                break;
                } else if (runtime->status->state == SNDRV_PCM_STATE_SETUP) {
@@ -1807,8 +1807,13 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file)
        snd_pcm_oss_setup_t *psetup = NULL, *csetup = NULL;
        int nonblock;
        wait_queue_t wait;
-       
-       printk("application %s uses obsolete OSS audio interface\n",current->comm);
+       static char printed_comm[16];
+
+       if (strncmp(printed_comm, current->comm, 16)) {
+               printk("application %s uses obsolete OSS audio interface\n",
+                      current->comm);
+               memcpy(printed_comm, current->comm, 16);
+       }
 
        snd_assert(cardnum >= 0 && cardnum < SNDRV_CARDS, return -ENXIO);
        device = SNDRV_MINOR_OSS_DEVICE(minor) == SNDRV_MINOR_OSS_PCM1 ?
index 1e639ae..2662f5c 100644 (file)
@@ -674,7 +674,7 @@ static void snd_uart16550_output_write(snd_rawmidi_substream_t * substream)
                                break;
                        if (snd_rawmidi_transmit(substream, &midi_byte, 1) != 1)
                                break;
-#if SNDRV_SERIAL_MS124W_MB_NOCOMBO
+#ifdef SNDRV_SERIAL_MS124W_MB_NOCOMBO
                        /* select exactly one of the four ports */
                        addr_byte = (1 << (substream->number + 4)) | 0x08;
 #else
index 04b2c3a..11b4240 100644 (file)
@@ -184,7 +184,7 @@ config SND_SBAWE
 
 config SND_SB16_CSP
        bool "Sound Blaster 16/AWE CSP support"
-       depends on SND_SB16 || SND_SBAWE
+       depends on (SND_SB16 || SND_SBAWE) && (BROKEN || !PPC)
        help
          Say 'Y' to include support for CSP core. This special coprocessor
          can do variable tasks like various compression and decompression
index 9b65db0..b4fab43 100644 (file)
@@ -123,7 +123,7 @@ MODULE_PARM_DESC(osrun_time, "how many seconds to wait for the ICS2115 OS");
 #else
 #define DPRINT(cond, args...) \
        if ((dev->debug & (cond)) == (cond)) { \
-            snd_printk (##args); \
+            snd_printk (args); \
        }
 #endif
 #else
@@ -165,7 +165,7 @@ static struct {
        { 0x0E, "Bad MIDI channel number" },
        { 0x10, "Download Record Error" },
        { 0x80, "Success" },
-       { 0x0, 0x0 }
+       { 0x0 }
 };
 
 #define NEEDS_ACK 1
@@ -361,7 +361,7 @@ snd_wavefront_cmd (snd_wavefront_t *dev,
 
        if (cmd == WFC_DOWNLOAD_MULTISAMPLE) {
                wfcmd->write_cnt = (unsigned long) rbuf;
-               rbuf = 0;
+               rbuf = NULL;
        }
 
        DPRINT (WF_DEBUG_CMD, "0x%x [%s] (%d,%d,%d)\n",
@@ -612,7 +612,7 @@ wavefront_delete_sample (snd_wavefront_t *dev, int sample_num)
        wbuf[0] = sample_num & 0x7f;
        wbuf[1] = sample_num >> 7;
 
-       if ((x = snd_wavefront_cmd (dev, WFC_DELETE_SAMPLE, 0, wbuf)) == 0) {
+       if ((x = snd_wavefront_cmd (dev, WFC_DELETE_SAMPLE, NULL, wbuf)) == 0) {
                dev->sample_status[sample_num] = WF_ST_EMPTY;
        }
 
@@ -798,7 +798,7 @@ wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header)
        bptr = munge_int32 (header->number, buf, 2);
        munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES);
     
-       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, 0, buf)) {
+       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) {
                snd_printk ("download patch failed\n");
                return -(EIO);
        }
@@ -836,7 +836,7 @@ wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header)
        buf[0] = header->number;
        munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES);
     
-       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, 0, buf)) {
+       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) {
                snd_printk ("download patch failed\n"); 
                return -(EIO);
        }
@@ -850,7 +850,7 @@ wavefront_freemem (snd_wavefront_t *dev)
 {
        char rbuf[8];
 
-       if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, 0)) {
+       if (snd_wavefront_cmd (dev, WFC_REPORT_FREE_MEMORY, rbuf, NULL)) {
                snd_printk ("can't get memory stats.\n");
                return -1;
        } else {
@@ -876,7 +876,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
 
        u16 sample_short;
        u32 length;
-       u16 __user *data_end = 0;
+       u16 __user *data_end = NULL;
        unsigned int i;
        const unsigned int max_blksize = 4096/2;
        unsigned int written;
@@ -1053,7 +1053,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
        if (snd_wavefront_cmd (dev, 
                           header->size ?
                           WFC_DOWNLOAD_SAMPLE : WFC_DOWNLOAD_SAMPLE_HEADER,
-                          0, sample_hdr)) {
+                          NULL, sample_hdr)) {
                snd_printk ("sample %sdownload refused.\n",
                            header->size ? "" : "header ");
                return -(EIO);
@@ -1079,7 +1079,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
                        blocksize = ((length-written+7)&~0x7);
                }
 
-               if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, 0, 0)) {
+               if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
                        snd_printk ("download block "
                                    "request refused.\n");
                        return -(EIO);
@@ -1186,7 +1186,7 @@ wavefront_send_alias (snd_wavefront_t *dev, wavefront_patch_info *header)
        munge_int32 (header->hdr.a.FrequencyBias, &alias_hdr[20], 3);
        munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2);
 
-       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, 0, alias_hdr)) {
+       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) {
                snd_printk ("download alias failed.\n");
                return -(EIO);
        }
@@ -1314,7 +1314,7 @@ wavefront_send_drum (snd_wavefront_t *dev, wavefront_patch_info *header)
                munge_int32 (((unsigned char *)drum)[i], &drumbuf[1+(i*2)], 2);
        }
 
-       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, 0, drumbuf)) {
+       if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) {
                snd_printk ("download drum failed.\n");
                return -(EIO);
        }
@@ -2085,7 +2085,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
 
        voices[0] = 32;
 
-       if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, 0, voices)) {
+       if (snd_wavefront_cmd (dev, WFC_SET_NVOICES, NULL, voices)) {
                snd_printk ("cannot set number of voices to 32.\n");
                goto gone_bad;
        }
index ac3c481..7c3d391 100644 (file)
@@ -99,7 +99,7 @@ MODULE_PARM(wss,"i");
 MODULE_PARM_DESC(wss,"change between ACI/WSS-mixer; use 0 and 1 - untested"
                 " default: do nothing; for PCM1-pro only");
 
-#if DEBUG
+#ifdef DEBUG
 static void print_bits(unsigned char c)
 {
        int j;
@@ -184,7 +184,7 @@ static int busy_wait(void)
 static inline int aci_rawwrite(unsigned char byte)
 {
        if (busy_wait() >= 0) {
-#if DEBUG
+#ifdef DEBUG
                printk(KERN_DEBUG "aci_rawwrite(%d)\n", byte);
 #endif
                outb(byte, COMMAND_REGISTER);
@@ -199,7 +199,7 @@ static inline int aci_rawread(void)
 
        if (busy_wait() >= 0) {
                byte=inb(STATUS_REGISTER);
-#if DEBUG
+#ifdef DEBUG
                printk(KERN_DEBUG "%d = aci_rawread()\n", byte);
 #endif
                return byte;
index c2abddd..4425064 100644 (file)
@@ -1235,10 +1235,10 @@ static struct {
 } isapnp_ad1816_list[] __initdata = {
        {       ISAPNP_ANY_ID, ISAPNP_ANY_ID,
                ISAPNP_VENDOR('A','D','S'), ISAPNP_FUNCTION(0x7150), 
-               0 },
+               NULL },
        {       ISAPNP_ANY_ID, ISAPNP_ANY_ID,
                ISAPNP_VENDOR('A','D','S'), ISAPNP_FUNCTION(0x7180),
-               0 },
+               NULL },
        {0}
 };
 
index 7e9e30e..af1225d 100644 (file)
@@ -2962,7 +2962,7 @@ static struct {
                ISAPNP_VENDOR('G','R','V'), ISAPNP_DEVICE(0x0001),
                ISAPNP_VENDOR('G','R','V'), ISAPNP_FUNCTION(0x0000),
                0, 0, 0, 1, 0},
-       {0}
+       {NULL}
 };
 
 static struct isapnp_device_id id_table[] __devinitdata = {
index a8c195f..2423b1f 100644 (file)
@@ -338,7 +338,7 @@ int ad1889_read_proc (char *page, char **start, off_t off,
                { "AC97_3D_CONTROL", 0x100 + AC97_3D_CONTROL, 16 },
                { "AC97_MODEM_RATE", 0x100 + AC97_MODEM_RATE, 16 },
                { "AC97_POWER_CONTROL", 0x100 + AC97_POWER_CONTROL, 16 },
-               { 0 }
+               { NULL }
        };
 
        if (dev == NULL)
@@ -452,9 +452,6 @@ static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t
        ssize_t ret = 0;
        DECLARE_WAITQUEUE(wait, current);
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        down(&state->sem);
 #if 0
        if (dmabuf->mapped) {
@@ -764,7 +761,7 @@ static int ad1889_open(struct inode *inode, struct file *file)
        ad1889_set_wav_rate(ad1889_dev, 44100);
        ad1889_set_wav_fmt(ad1889_dev, AFMT_S16_LE);
        AD1889_WRITEW(ad1889_dev, AD_DSWADA, 0x0404); /* attenuation */
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int ad1889_release(struct inode *inode, struct file *file)
@@ -1017,7 +1014,7 @@ static int __devinit ad1889_probe(struct pci_dev *pcidev, const struct pci_devic
        if ((err = ad1889_ac97_init(dev, 0)) != 0)
                goto err_free_dsp;
 
-       if (((proc_root = proc_mkdir("driver/ad1889", 0)) == NULL) ||
+       if (((proc_root = proc_mkdir("driver/ad1889", NULL)) == NULL) ||
            create_proc_read_entry("ac97", S_IFREG|S_IRUGO, proc_root, ac97_read_proc, dev->ac97_codec) == NULL ||
            create_proc_read_entry("info", S_IFREG|S_IRUGO, proc_root, ad1889_read_proc, dev) == NULL) 
                goto err_free_dsp;
@@ -1038,7 +1035,7 @@ err_free_irq:
 
 err_free_mem:
        ad1889_free_dev(dev);
-       pci_set_drvdata(pcidev, 0);
+       pci_set_drvdata(pcidev, NULL);
 
        return -ENODEV;
 }
index c0da38b..386107f 100644 (file)
@@ -1852,7 +1852,7 @@ static int cm_open_mixdev(struct inode *inode, struct file *file)
        }
                VALIDATE_STATE(s);
        file->private_data = s;
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int cm_release_mixdev(struct inode *inode, struct file *file)
@@ -1926,8 +1926,6 @@ static ssize_t cm_read(struct file *file, char __user *buffer, size_t count, lof
        int cnt;
 
        VALIDATE_STATE(s);
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (s->dma_adc.mapped)
                return -ENXIO;
        if (!s->dma_adc.ready && (ret = prog_dmabuf(s, 1)))
@@ -2028,8 +2026,6 @@ static ssize_t cm_write(struct file *file, const char __user *buffer, size_t cou
        int cnt;
 
        VALIDATE_STATE(s);
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (s->dma_dac.mapped)
                return -ENXIO;
        if (!s->dma_dac.ready && (ret = prog_dmabuf(s, 0)))
@@ -2878,7 +2874,7 @@ static int cm_open(struct inode *inode, struct file *file)
        set_fmt(s, fmtm, fmts);
        s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
        up(&s->open_sem);
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int cm_release(struct inode *inode, struct file *file)
index 1d65e18..9a2f50f 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _dmasound_h_
 /*
- *  linux/drivers/sound/dmasound/dmasound.h
+ *  linux/sound/oss/dmasound/dmasound.h
  *
  *
  *  Minor numbers for the sound driver.
 #define le2be16dbl(x)  (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
 
 #define IOCTL_IN(arg, ret) \
-       do { int error = get_user(ret, (int *)(arg)); \
+       do { int error = get_user(ret, (int __user *)(arg)); \
                if (error) return error; \
        } while (0)
-#define IOCTL_OUT(arg, ret)    ioctl_return((int *)(arg), ret)
+#define IOCTL_OUT(arg, ret)    ioctl_return((int __user *)(arg), ret)
 
-static inline int ioctl_return(int *addr, int value)
+static inline int ioctl_return(int __user *addr, int value)
 {
        return value < 0 ? value : put_user(value, addr);
 }
@@ -153,14 +153,14 @@ typedef struct {
      */
 
 typedef struct {
-    ssize_t (*ct_ulaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_alaw)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_s8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_u8)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_s16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_u16be)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_s16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
-    ssize_t (*ct_u16le)(const u_char *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_ulaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_alaw)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_s8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_u8)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_s16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_u16be)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_s16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
+    ssize_t (*ct_u16le)(const u_char __user *, size_t, u_char *, ssize_t *, ssize_t);
 } TRANS;
 
 struct sound_settings {
index fc19d66..8daaf87 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *  linux/drivers/sound/dmasound/dmasound_atari.c
+ *  linux/sound/oss/dmasound/dmasound_atari.c
  *
  *  Atari TT and Falcon DMA Sound Driver
  *
- *  See linux/drivers/sound/dmasound/dmasound_core.c for copyright and credits
+ *  See linux/sound/oss/dmasound/dmasound_core.c for copyright and credits
  *  prior to 28/01/2001
  *
  *  28/01/2001 [0.1] Iain Sandoe
index a434e45..2d78834 100644 (file)
@@ -1,10 +1,10 @@
 /*
- *  linux/drivers/sound/dmasound/dmasound_awacs.c
+ *  linux/sound/oss/dmasound/dmasound_awacs.c
  *
  *  PowerMac `AWACS' and `Burgundy' DMA Sound Driver
  *  with some limited support for DACA & Tumbler
  *
- *  See linux/drivers/sound/dmasound/dmasound_core.c for copyright and
+ *  See linux/sound/oss/dmasound/dmasound_core.c for copyright and
  *  history prior to 2001/01/26.
  *
  *     26/01/2001 ed 0.1 Iain Sandoe
@@ -326,12 +326,12 @@ extern int daca_leave_sleep(void);
 #undef IOCTL_OUT
 
 #define IOCTL_IN(arg, ret)     \
-       rc = get_user(ret, (int *)(arg)); \
+       rc = get_user(ret, (int __user *)(arg)); \
        if (rc) break;
 #define IOCTL_OUT(arg, ret)    \
-       ioctl_return2((int *)(arg), ret)
+       ioctl_return2((int __user *)(arg), ret)
 
-static inline int ioctl_return2(int *addr, int value)
+static inline int ioctl_return2(int __user *addr, int value)
 {
        return value < 0 ? value : put_user(value, addr);
 }
@@ -461,7 +461,7 @@ tas_dmasound_init(void)
        write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
        msleep(100);
        if (gpio_headphone_irq) {
-               if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",0) < 0) {
+               if (request_irq(gpio_headphone_irq,headphone_intr,0,"Headphone detect",NULL) < 0) {
                        printk(KERN_ERR "tumbler: Can't request headphone interrupt\n");
                        gpio_headphone_irq = 0;
                } else {
@@ -470,7 +470,7 @@ tas_dmasound_init(void)
                        val = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, gpio_headphone_detect, 0);
                        pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, gpio_headphone_detect, val | 0x80);
                        /* Trigger it */
-                       headphone_intr(0,0,0);
+                       headphone_intr(0,NULL,NULL);
                }
        }
        if (!gpio_headphone_irq) {
@@ -487,7 +487,7 @@ static int
 tas_dmasound_cleanup(void)
 {
        if (gpio_headphone_irq)
-               free_irq(gpio_headphone_irq, 0);
+               free_irq(gpio_headphone_irq, NULL);
        return 0;
 }
 
@@ -514,6 +514,7 @@ tas_set_frame_rate(void)
 static int
 tas_mixer_ioctl(u_int cmd, u_long arg)
 {
+       int __user *argp = (int __user *)arg;
        int data;
        int rc;
 
@@ -524,16 +525,16 @@ tas_mixer_ioctl(u_int cmd, u_long arg)
 
         if ((cmd & ~0xff) == MIXER_WRITE(0) &&
             tas_supported_mixers() & (1<<(cmd & 0xff))) {
-               rc = get_user(data, (int *)(arg));
+               rc = get_user(data, argp);
                 if (rc<0) return rc;
                tas_set_mixer_level(cmd & 0xff, data);
                tas_get_mixer_level(cmd & 0xff, &data);
-               return ioctl_return2((int *)(arg), data);
+               return ioctl_return2(argp, data);
         }
         if ((cmd & ~0xff) == MIXER_READ(0) &&
             tas_supported_mixers() & (1<<(cmd & 0xff))) {
                tas_get_mixer_level(cmd & 0xff, &data);
-               return ioctl_return2((int *)(arg), data);
+               return ioctl_return2(argp, data);
         }
 
        switch(cmd) {
@@ -627,10 +628,10 @@ static void PMacFree(void *ptr, unsigned int size)
 static int __init PMacIrqInit(void)
 {
        if (awacs)
-               if (request_irq(awacs_irq, pmac_awacs_intr, 0, "Built-in Sound misc", 0))
+               if (request_irq(awacs_irq, pmac_awacs_intr, 0, "Built-in Sound misc", NULL))
                        return 0;
-       if (request_irq(awacs_tx_irq, pmac_awacs_tx_intr, 0, "Built-in Sound out", 0)
-           || request_irq(awacs_rx_irq, pmac_awacs_rx_intr, 0, "Built-in Sound in", 0))
+       if (request_irq(awacs_tx_irq, pmac_awacs_tx_intr, 0, "Built-in Sound out", NULL)
+           || request_irq(awacs_rx_irq, pmac_awacs_rx_intr, 0, "Built-in Sound in", NULL))
                return 0;
        return 1;
 }
@@ -656,9 +657,9 @@ static void PMacIrqCleanup(void)
                msleep(200);
        }
        if (awacs)
-               free_irq(awacs_irq, 0);
-       free_irq(awacs_tx_irq, 0);
-       free_irq(awacs_rx_irq, 0);
+               free_irq(awacs_irq, NULL);
+       free_irq(awacs_tx_irq, NULL);
+       free_irq(awacs_rx_irq, NULL);
        
        if (awacs)
                iounmap((void *)awacs);
@@ -1504,7 +1505,7 @@ static int awacs_sleep_notify(struct pmu_sleep_notifier *self, int when)
                                write_audio_gpio(gpio_audio_reset, !gpio_audio_reset_pol);
                                msleep(150);
                                tas_leave_sleep(); /* Stub for now */
-                               headphone_intr(0,0,0);
+                               headphone_intr(0,NULL,NULL);
                                break;
                        case AWACS_DACA:
                                msleep(10); /* Check this !!! */
@@ -2969,7 +2970,7 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
 
                sound_device_id = 0;
                /* device ID appears post g3 b&w */
-               prop = (unsigned int *)get_property(info, "device-id", 0);
+               prop = (unsigned int *)get_property(info, "device-id", NULL);
                if (prop != 0)
                        sound_device_id = *prop;
 
@@ -3080,7 +3081,7 @@ printk("dmasound_pmac: Awacs/Screamer Codec Mfct: %d Rev %d\n", mfg, rev);
 
        } else if (is_pbook_g3) {
                struct device_node* mio;
-               macio_base = 0;
+               macio_base = NULL;
                for (mio = io->parent; mio; mio = mio->parent) {
                        if (strcmp(mio->name, "mac-io") == 0
                            && mio->n_addrs > 0) {
index 35ade6b..ed7333c 100644 (file)
@@ -978,6 +978,13 @@ int __init gus_wave_detect(int baseaddr)
        unsigned long   loc;
        unsigned char   val;
 
+       if (!request_region(baseaddr, 16, "GUS"))
+               return 0;
+       if (!request_region(baseaddr + 0x100, 12, "GUS")) { /* 0x10c-> is MAX */
+               release_region(baseaddr, 16);
+               return 0;
+       }
+
        gus_base = baseaddr;
 
        gus_write8(0x4c, 0);    /* Reset GF1 */
@@ -1015,8 +1022,11 @@ int __init gus_wave_detect(int baseaddr)
 
        /* See if there is first block there.... */
        gus_poke(0L, 0xaa);
-       if (gus_peek(0L) != 0xaa)
-               return (0);
+       if (gus_peek(0L) != 0xaa) {
+               release_region(baseaddr + 0x100, 12);
+               release_region(baseaddr, 16);
+               return 0;
+       }
 
        /* Now zero it out so that I can check for mirroring .. */
        gus_poke(0L, 0x00);
index 1f49d04..afe97c4 100644 (file)
@@ -959,7 +959,7 @@ static int hal2_open_mixdev(struct inode *inode, struct file *file)
 
        if (hal2) {
                file->private_data = hal2;
-               return 0;
+               return nonseekable_open(inode, file);
        }
        return -ENODEV;
 }
@@ -1178,8 +1178,6 @@ static ssize_t hal2_read(struct file *file, char *buffer,
 
        if (!count)
                return 0;
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (down_interruptible(&adc->sem))
                return -EINTR;
        if (file->f_flags & O_NONBLOCK) {
@@ -1234,8 +1232,6 @@ static ssize_t hal2_write(struct file *file, const char *buffer,
 
        if (!count)
                return 0;
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (down_interruptible(&dac->sem))
                return -EINTR;
        if (file->f_flags & O_NONBLOCK) {
@@ -1350,7 +1346,7 @@ static int hal2_open(struct inode *inode, struct file *file)
                dac->usecount++;
        }
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int hal2_release(struct inode *inode, struct file *file)
index e4f8542..918c2a2 100644 (file)
@@ -450,12 +450,38 @@ struct i810_card {
 /* extract register offset from codec struct */
 #define IO_REG_OFF(codec) (((struct i810_card *) codec->private_data)->ac97_id_map[codec->id])
 
-#define GET_CIV(port) MODULOP2(inb((port) + OFF_CIV), SG_LEN)
-#define GET_LVI(port) MODULOP2(inb((port) + OFF_LVI), SG_LEN)
+#define I810_IOREAD(size, type, card, off)                             \
+({                                                                     \
+       type val;                                                       \
+       if (card->use_mmio)                                             \
+               val=read##size(card->iobase_mmio+off);                  \
+       else                                                            \
+               val=in##size(card->iobase+off);                         \
+       val;                                                            \
+})
+
+#define I810_IOREADL(card, off)                I810_IOREAD(l, u32, card, off)
+#define I810_IOREADW(card, off)                I810_IOREAD(w, u16, card, off)
+#define I810_IOREADB(card, off)                I810_IOREAD(b, u8,  card, off)
+
+#define I810_IOWRITE(size, val, card, off)                             \
+({                                                                     \
+       if (card->use_mmio)                                             \
+               write##size(val, card->iobase_mmio+off);                \
+       else                                                            \
+               out##size(val, card->iobase+off);                       \
+})
+
+#define I810_IOWRITEL(val, card, off)  I810_IOWRITE(l, val, card, off)
+#define I810_IOWRITEW(val, card, off)  I810_IOWRITE(w, val, card, off)
+#define I810_IOWRITEB(val, card, off)  I810_IOWRITE(b, val, card, off)
+
+#define GET_CIV(card, port) MODULOP2(I810_IOREADB((card), (port) + OFF_CIV), SG_LEN)
+#define GET_LVI(card, port) MODULOP2(I810_IOREADB((card), (port) + OFF_LVI), SG_LEN)
 
 /* set LVI from CIV */
-#define CIV_TO_LVI(port, off) \
-       outb(MODULOP2(GET_CIV((port)) + (off), SG_LEN), (port) + OFF_LVI)
+#define CIV_TO_LVI(card, port, off) \
+       I810_IOWRITEB(MODULOP2(GET_CIV((card), (port)) + (off), SG_LEN), (card), (port) + OFF_LVI)
 
 static struct i810_card *devs = NULL;
 
@@ -714,9 +740,9 @@ static inline unsigned i810_get_dma_addr(struct i810_state *state, int rec)
                return 0;
 
        if (rec)
-               port = state->card->iobase + dmabuf->read_channel->port;
+               port = dmabuf->read_channel->port;
        else
-               port = state->card->iobase + dmabuf->write_channel->port;
+               port = dmabuf->write_channel->port;
 
        if(state->card->pci_id == PCI_DEVICE_ID_SI_7012) {
                port_picb = port + OFF_SR;
@@ -725,8 +751,8 @@ static inline unsigned i810_get_dma_addr(struct i810_state *state, int rec)
                port_picb = port + OFF_PICB;
 
        do {
-               civ = GET_CIV(port);
-               offset = inw(port_picb);
+               civ = GET_CIV(state->card, port);
+               offset = I810_IOREADW(state->card, port_picb);
                /* Must have a delay here! */ 
                if(offset == 0)
                        udelay(1);
@@ -745,7 +771,7 @@ static inline unsigned i810_get_dma_addr(struct i810_state *state, int rec)
                 * that we won't have to worry about the chip still being
                 * out of sync with reality ;-)
                 */
-       } while (civ != GET_CIV(port) || offset != inw(port_picb));
+       } while (civ != GET_CIV(state->card, port) || offset != I810_IOREADW(state->card, port_picb));
                 
        return (((civ + 1) * dmabuf->fragsize - (bytes * offset))
                % dmabuf->dmasize);
@@ -758,15 +784,15 @@ static inline void __stop_adc(struct i810_state *state)
        struct i810_card *card = state->card;
 
        dmabuf->enable &= ~ADC_RUNNING;
-       outb(0, card->iobase + PI_CR);
+       I810_IOWRITEB(0, card, PI_CR);
        // wait for the card to acknowledge shutdown
-       while( inb(card->iobase + PI_CR) != 0 ) ;
+       while( I810_IOREADB(card, PI_CR) != 0 ) ;
        // now clear any latent interrupt bits (like the halt bit)
        if(card->pci_id == PCI_DEVICE_ID_SI_7012)
-               outb( inb(card->iobase + PI_PICB), card->iobase + PI_PICB );
+               I810_IOWRITEB( I810_IOREADB(card, PI_PICB), card, PI_PICB );
        else
-               outb( inb(card->iobase + PI_SR), card->iobase + PI_SR );
-       outl( inl(card->iobase + GLOB_STA) & INT_PI, card->iobase + GLOB_STA);
+               I810_IOWRITEB( I810_IOREADB(card, PI_SR), card, PI_SR );
+       I810_IOWRITEL( I810_IOREADL(card, GLOB_STA) & INT_PI, card, GLOB_STA);
 }
 
 static void stop_adc(struct i810_state *state)
@@ -787,7 +813,7 @@ static inline void __start_adc(struct i810_state *state)
            (dmabuf->trigger & PCM_ENABLE_INPUT)) {
                dmabuf->enable |= ADC_RUNNING;
                // Interrupt enable, LVI enable, DMA enable
-               outb(0x10 | 0x04 | 0x01, state->card->iobase + PI_CR);
+               I810_IOWRITEB(0x10 | 0x04 | 0x01, state->card, PI_CR);
        }
 }
 
@@ -808,15 +834,15 @@ static inline void __stop_dac(struct i810_state *state)
        struct i810_card *card = state->card;
 
        dmabuf->enable &= ~DAC_RUNNING;
-       outb(0, card->iobase + PO_CR);
+       I810_IOWRITEB(0, card, PO_CR);
        // wait for the card to acknowledge shutdown
-       while( inb(card->iobase + PO_CR) != 0 ) ;
+       while( I810_IOREADB(card, PO_CR) != 0 ) ;
        // now clear any latent interrupt bits (like the halt bit)
        if(card->pci_id == PCI_DEVICE_ID_SI_7012)
-               outb( inb(card->iobase + PO_PICB), card->iobase + PO_PICB );
+               I810_IOWRITEB( I810_IOREADB(card, PO_PICB), card, PO_PICB );
        else
-               outb( inb(card->iobase + PO_SR), card->iobase + PO_SR );
-       outl( inl(card->iobase + GLOB_STA) & INT_PO, card->iobase + GLOB_STA);
+               I810_IOWRITEB( I810_IOREADB(card, PO_SR), card, PO_SR );
+       I810_IOWRITEL( I810_IOREADL(card, GLOB_STA) & INT_PO, card, GLOB_STA);
 }
 
 static void stop_dac(struct i810_state *state)
@@ -837,7 +863,7 @@ static inline void __start_dac(struct i810_state *state)
            (dmabuf->trigger & PCM_ENABLE_OUTPUT)) {
                dmabuf->enable |= DAC_RUNNING;
                // Interrupt enable, LVI enable, DMA enable
-               outb(0x10 | 0x04 | 0x01, state->card->iobase + PO_CR);
+               I810_IOWRITEB(0x10 | 0x04 | 0x01, state->card, PO_CR);
        }
 }
 static void start_dac(struct i810_state *state)
@@ -1000,12 +1026,12 @@ static int prog_dmabuf(struct i810_state *state, unsigned rec)
                        sg++;
                }
                spin_lock_irqsave(&state->card->lock, flags);
-               outb(2, state->card->iobase+c->port+OFF_CR);   /* reset DMA machine */
-               while( inb(state->card->iobase+c->port+OFF_CR) & 0x02 ) ;
-               outl((u32)state->card->chandma +
+               I810_IOWRITEB(2, state->card, c->port+OFF_CR);   /* reset DMA machine */
+               while( I810_IOREADB(state->card, c->port+OFF_CR) & 0x02 ) ;
+               I810_IOWRITEL((u32)state->card->chandma +
                    c->num*sizeof(struct i810_channel),
-                   state->card->iobase+c->port+OFF_BDBAR);
-               CIV_TO_LVI(state->card->iobase+c->port, 0);
+                   state->cardc->port+OFF_BDBAR);
+               CIV_TO_LVI(state->cardc->port, 0);
 
                spin_unlock_irqrestore(&state->card->lock, flags);
 
@@ -1037,14 +1063,13 @@ static void __i810_update_lvi(struct i810_state *state, int rec)
        void (*start)(struct i810_state *);
 
        count = dmabuf->count;
-       port = state->card->iobase;
        if (rec) {
-               port += dmabuf->read_channel->port;
+               port = dmabuf->read_channel->port;
                trigger = PCM_ENABLE_INPUT;
                start = __start_adc;
                count = dmabuf->dmasize - count;
        } else {
-               port += dmabuf->write_channel->port;
+               port = dmabuf->write_channel->port;
                trigger = PCM_ENABLE_OUTPUT;
                start = __start_dac;
        }
@@ -1059,14 +1084,14 @@ static void __i810_update_lvi(struct i810_state *state, int rec)
                        return;
 
                start(state);
-               while (!(inb(port + OFF_CR) & ((1<<4) | (1<<2))))
+               while (!(I810_IOREADB(state->card, port + OFF_CR) & ((1<<4) | (1<<2))))
                        ;
        }
 
        /* MASKP2(swptr, fragsize) - 1 is the tail of our transfer */
        x = MODULOP2(MASKP2(dmabuf->swptr, fragsize) - 1, dmabuf->dmasize);
        x >>= dmabuf->fragshift;
-       outb(x, port + OFF_LVI);
+       I810_IOWRITEB(x, state->card, port + OFF_LVI);
 }
 
 static void i810_update_lvi(struct i810_state *state, int rec)
@@ -1108,8 +1133,8 @@ static void i810_update_ptr(struct i810_state *state)
                        /* this is normal for the end of a read */
                        /* only give an error if we went past the */
                        /* last valid sg entry */
-                       if (GET_CIV(state->card->iobase + PI_BASE) !=
-                           GET_LVI(state->card->iobase + PI_BASE)) {
+                       if (GET_CIV(state->card, PI_BASE) !=
+                           GET_LVI(state->card, PI_BASE)) {
                                printk(KERN_WARNING "i810_audio: DMA overrun on read\n");
                                dmabuf->error++;
                        }
@@ -1133,13 +1158,13 @@ static void i810_update_ptr(struct i810_state *state)
                        /* this is normal for the end of a write */
                        /* only give an error if we went past the */
                        /* last valid sg entry */
-                       if (GET_CIV(state->card->iobase + PO_BASE) !=
-                           GET_LVI(state->card->iobase + PO_BASE)) {
+                       if (GET_CIV(state->card, PO_BASE) !=
+                           GET_LVI(state->card, PO_BASE)) {
                                printk(KERN_WARNING "i810_audio: DMA overrun on write\n");
                                printk("i810_audio: CIV %d, LVI %d, hwptr %x, "
                                        "count %d\n",
-                                       GET_CIV(state->card->iobase + PO_BASE),
-                                       GET_LVI(state->card->iobase + PO_BASE),
+                                       GET_CIV(state->card, PO_BASE),
+                                       GET_LVI(state->card, PO_BASE),
                                        dmabuf->hwptr, dmabuf->count);
                                dmabuf->error++;
                        }
@@ -1287,7 +1312,7 @@ static void i810_channel_interrupt(struct i810_card *card)
                struct i810_state *state = card->states[i];
                struct i810_channel *c;
                struct dmabuf *dmabuf;
-               unsigned long port = card->iobase;
+               unsigned long port;
                u16 status;
                
                if(!state)
@@ -1302,12 +1327,12 @@ static void i810_channel_interrupt(struct i810_card *card)
                } else  /* This can occur going from R/W to close */
                        continue;
                
-               port+=c->port;
+               port = c->port;
 
                if(card->pci_id == PCI_DEVICE_ID_SI_7012)
-                       status = inw(port + OFF_PICB);
+                       status = I810_IOREADW(card, port + OFF_PICB);
                else
-                       status = inw(port + OFF_SR);
+                       status = I810_IOREADW(card, port + OFF_SR);
 
 #ifdef DEBUG_INTERRUPTS
                printk("NUM %d PORT %X IRQ ( ST%d ", c->num, c->port, status);
@@ -1340,7 +1365,7 @@ static void i810_channel_interrupt(struct i810_card *card)
                        if(dmabuf->enable & ADC_RUNNING)
                                count = dmabuf->dmasize - count;
                        if (count >= (int)dmabuf->fragsize) {
-                               outb(inb(port+OFF_CR) | 1, port+OFF_CR);
+                               I810_IOWRITEB(I810_IOREADB(card, port+OFF_CR) | 1, card, port+OFF_CR);
 #ifdef DEBUG_INTERRUPTS
                                printk(" CONTINUE ");
 #endif
@@ -1356,9 +1381,9 @@ static void i810_channel_interrupt(struct i810_card *card)
                        }
                }
                if(card->pci_id == PCI_DEVICE_ID_SI_7012)
-                       outw(status & DMA_INT_MASK, port + OFF_PICB);
+                       I810_IOWRITEW(status & DMA_INT_MASK, card, port + OFF_PICB);
                else
-                       outw(status & DMA_INT_MASK, port + OFF_SR);
+                       I810_IOWRITEW(status & DMA_INT_MASK, card, port + OFF_SR);
        }
 #ifdef DEBUG_INTERRUPTS
        printk(")\n");
@@ -1372,7 +1397,7 @@ static irqreturn_t i810_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 
        spin_lock(&card->lock);
 
-       status = inl(card->iobase + GLOB_STA);
+       status = I810_IOREADL(card, GLOB_STA);
 
        if(!(status & INT_MASK)) 
        {
@@ -1384,7 +1409,7 @@ static irqreturn_t i810_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                i810_channel_interrupt(card);
 
        /* clear 'em */
-       outl(status & INT_MASK, card->iobase + GLOB_STA);
+       I810_IOWRITEL(status & INT_MASK, card, GLOB_STA);
        spin_unlock(&card->lock);
        return IRQ_HANDLED;
 }
@@ -1396,7 +1421,7 @@ static irqreturn_t i810_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
 {
        struct i810_state *state = (struct i810_state *)file->private_data;
-       struct i810_card *card=state ? state->card : 0;
+       struct i810_card *card=state ? state->card : NULL;
        struct dmabuf *dmabuf = &state->dmabuf;
        ssize_t ret;
        unsigned long flags;
@@ -1409,8 +1434,6 @@ static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, l
        printk("i810_audio: i810_read called, count = %d\n", count);
 #endif
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (dmabuf->mapped)
                return -ENXIO;
        if (dmabuf->enable & DAC_RUNNING)
@@ -1536,7 +1559,7 @@ static ssize_t i810_read(struct file *file, char __user *buffer, size_t count, l
 static ssize_t i810_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
 {
        struct i810_state *state = (struct i810_state *)file->private_data;
-       struct i810_card *card=state ? state->card : 0;
+       struct i810_card *card=state ? state->card : NULL;
        struct dmabuf *dmabuf = &state->dmabuf;
        ssize_t ret;
        unsigned long flags;
@@ -1549,8 +1572,6 @@ static ssize_t i810_write(struct file *file, const char __user *buffer, size_t c
        printk("i810_audio: i810_write called, count = %d\n", count);
 #endif
 
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
        if (dmabuf->mapped)
                return -ENXIO;
        if (dmabuf->enable & ADC_RUNNING)
@@ -1784,13 +1805,13 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        __stop_adc(state);
                }
                if (c != NULL) {
-                       outb(2, state->card->iobase+c->port+OFF_CR);   /* reset DMA machine */
-                       while ( inb(state->card->iobase+c->port+OFF_CR) & 2 )
+                       I810_IOWRITEB(2, state->card, c->port+OFF_CR);   /* reset DMA machine */
+                       while ( I810_IOREADB(state->card, c->port+OFF_CR) & 2 )
                                cpu_relax();
-                       outl((u32)state->card->chandma +
+                       I810_IOWRITEL((u32)state->card->chandma +
                            c->num*sizeof(struct i810_channel),
-                           state->card->iobase+c->port+OFF_BDBAR);
-                       CIV_TO_LVI(state->card->iobase+c->port, 0);
+                           state->cardc->port+OFF_BDBAR);
+                       CIV_TO_LVI(state->cardc->port, 0);
                }
 
                spin_unlock_irqrestore(&state->card->lock, flags);
@@ -1920,7 +1941,7 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                /* Global Status and Global Control register are now  */
                /* used to indicate this.                             */
 
-                i_glob_cnt = inl(state->card->iobase + GLOB_CNT);
+                i_glob_cnt = I810_IOREADL(state->card, GLOB_CNT);
 
                /* Current # of channels enabled */
                if ( i_glob_cnt & 0x0100000 )
@@ -1932,14 +1953,14 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 
                switch ( val ) {
                        case 2: /* 2 channels is always supported */
-                               outl(i_glob_cnt & 0xffcfffff,
-                                    state->card->iobase + GLOB_CNT);
+                               I810_IOWRITEL(i_glob_cnt & 0xffcfffff,
+                                    state->card, GLOB_CNT);
                                /* Do we need to change mixer settings????  */
                                break;
                        case 4: /* Supported on some chipsets, better check first */
                                if ( state->card->channels >= 4 ) {
-                                       outl((i_glob_cnt & 0xffcfffff) | 0x100000,
-                                             state->card->iobase + GLOB_CNT);
+                                       I810_IOWRITEL((i_glob_cnt & 0xffcfffff) | 0x100000,
+                                             state->card, GLOB_CNT);
                                        /* Do we need to change mixer settings??? */
                                } else {
                                        val = ret;
@@ -1947,8 +1968,8 @@ static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                                break;
                        case 6: /* Supported on some chipsets, better check first */
                                if ( state->card->channels >= 6 ) {
-                                       outl((i_glob_cnt & 0xffcfffff) | 0x200000,
-                                             state->card->iobase + GLOB_CNT);
+                                       I810_IOWRITEL((i_glob_cnt & 0xffcfffff) | 0x200000,
+                                             state->card, GLOB_CNT);
                                        /* Do we need to change mixer settings??? */
                                } else {
                                        val = ret;
@@ -2477,8 +2498,8 @@ found_virt:
                } else {
                        i810_set_dac_rate(state, 8000);
                        /* Put the ACLink in 2 channel mode by default */
-                       i = inl(card->iobase + GLOB_CNT);
-                       outl(i & 0xffcfffff, card->iobase + GLOB_CNT);
+                       i = I810_IOREADL(card, GLOB_CNT);
+                       I810_IOWRITEL(i & 0xffcfffff, card, GLOB_CNT);
                }
        }
                
@@ -2493,7 +2514,7 @@ found_virt:
 
        state->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int i810_release(struct inode *inode, struct file *file)
@@ -2569,7 +2590,7 @@ static u16 i810_ac97_get_io(struct ac97_codec *dev, u8 reg)
        int count = 100;
        u16 reg_set = IO_REG_OFF(dev) | (reg&0x7f);
        
-       while(count-- && (inb(card->iobase + CAS) & 1)) 
+       while(count-- && (I810_IOREADB(card, CAS) & 1)) 
                udelay(1);
        
        return inw(card->ac97base + reg_set);
@@ -2597,7 +2618,7 @@ static void i810_ac97_set_io(struct ac97_codec *dev, u8 reg, u16 data)
        int count = 100;
        u16 reg_set = IO_REG_OFF(dev) | (reg&0x7f);
        
-       while(count-- && (inb(card->iobase + CAS) & 1)) 
+       while(count-- && (I810_IOREADB(card, CAS) & 1)) 
                udelay(1);
        
         outw(data, card->ac97base + reg_set);
@@ -2660,7 +2681,7 @@ static int i810_open_mixdev(struct inode *inode, struct file *file)
                        if (card->ac97_codec[i] != NULL &&
                            card->ac97_codec[i]->dev_mixer == minor) {
                                file->private_data = card->ac97_codec[i];
-                               return 0;
+                               return nonseekable_open(inode, file);
                        }
        }
        return -ENODEV;
@@ -2686,7 +2707,7 @@ static /*const*/ struct file_operations i810_mixer_fops = {
 
 static inline int i810_ac97_exists(struct i810_card *card, int ac97_number)
 {
-       u32 reg = inl(card->iobase + GLOB_STA);
+       u32 reg = I810_IOREADL(card, GLOB_STA);
        switch (ac97_number) {
        case 0:
                return reg & (1<<8);
@@ -2757,7 +2778,7 @@ static inline int ich_use_mmio(struct i810_card *card)
  
 static int i810_ac97_power_up_bus(struct i810_card *card)
 {      
-       u32 reg = inl(card->iobase + GLOB_CNT);
+       u32 reg = I810_IOREADL(card, GLOB_CNT);
        int i;
        int primary_codec_id = 0;
 
@@ -2769,14 +2790,14 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
        reg&=~8;        /* ACLink on */
        
        /* At this point we deassert AC_RESET # */
-       outl(reg , card->iobase + GLOB_CNT);
+       I810_IOWRITEL(reg , card, GLOB_CNT);
 
        /* We must now allow time for the Codec initialisation.
           600mS is the specified time */
                
        for(i=0;i<10;i++)
        {
-               if((inl(card->iobase+GLOB_CNT)&4)==0)
+               if((I810_IOREADL(card, GLOB_CNT)&4)==0)
                        break;
 
                set_current_state(TASK_UNINTERRUPTIBLE);
@@ -2795,8 +2816,11 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
         *      See if the primary codec comes ready. This must happen
         *      before we start doing DMA stuff
         */     
-       /* see i810_ac97_init for the next 7 lines (jsaw) */
-       inw(card->ac97base);
+       /* see i810_ac97_init for the next 10 lines (jsaw) */
+       if (card->use_mmio)
+               readw(card->ac97base_mmio);
+       else
+               inw(card->ac97base);
        if (ich_use_mmio(card)) {
                primary_codec_id = (int) readl(card->iobase_mmio + SDM) & 0x3;
                printk(KERN_INFO "i810_audio: Primary codec has ID %d\n",
@@ -2814,7 +2838,10 @@ static int i810_ac97_power_up_bus(struct i810_card *card)
                else 
                        printk("no response.\n");
        }
-       inw(card->ac97base);
+       if (card->use_mmio)
+               readw(card->ac97base_mmio);
+       else
+               inw(card->ac97base);
        return 1;
 }
 
@@ -2839,15 +2866,15 @@ static int __devinit i810_ac97_init(struct i810_card *card)
        /* to check....                                         */
 
        card->channels = 2;
-       reg = inl(card->iobase + GLOB_STA);
+       reg = I810_IOREADL(card, GLOB_STA);
        if ( reg & 0x0200000 )
                card->channels = 6;
        else if ( reg & 0x0100000 )
                card->channels = 4;
        printk(KERN_INFO "i810_audio: Audio Controller supports %d channels.\n", card->channels);
        printk(KERN_INFO "i810_audio: Defaulting to base 2 channel mode.\n");
-       reg = inl(card->iobase + GLOB_CNT);
-       outl(reg & 0xffcfffff, card->iobase + GLOB_CNT);
+       reg = I810_IOREADL(card, GLOB_CNT);
+       I810_IOWRITEL(reg & 0xffcfffff, card, GLOB_CNT);
                
        for (num_ac97 = 0; num_ac97 < NR_AC97; num_ac97++) 
                card->ac97_codec[num_ac97] = NULL;
@@ -2858,8 +2885,10 @@ static int __devinit i810_ac97_init(struct i810_card *card)
        for (num_ac97 = 0; num_ac97 < nr_ac97_max; num_ac97++) {
                /* codec reset */
                printk(KERN_INFO "i810_audio: Resetting connection %d\n", num_ac97);
-               if (card->use_mmio) readw(card->ac97base_mmio + 0x80*num_ac97);
-               else inw(card->ac97base + 0x80*num_ac97);
+               if (card->use_mmio)
+                       readw(card->ac97base_mmio + 0x80*num_ac97);
+               else
+                       inw(card->ac97base + 0x80*num_ac97);
 
                /* If we have the SDATA_IN Map Register, as on ICH4, we
                   do not loop thru all possible codec IDs but thru all 
@@ -3062,7 +3091,7 @@ static void __devinit i810_configure_clocking (void)
                        goto config_out;
                }
                dmabuf->count = dmabuf->dmasize;
-               CIV_TO_LVI(card->iobase+dmabuf->write_channel->port, -1);
+               CIV_TO_LVI(carddmabuf->write_channel->port, -1);
                local_irq_save(flags);
                start_dac(state);
                offset = i810_get_dma_addr(state, 0);
@@ -3106,13 +3135,6 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
                return -ENODEV;
        }
        
-       if( pci_resource_start(pci_dev, 1) == 0)
-       {
-               /* MMIO only ICH5 .. here be dragons .. */
-               printk(KERN_ERR "i810_audio: Pure MMIO interfaces not yet supported.\n");
-               return -ENODEV;
-       }
-
        if ((card = kmalloc(sizeof(struct i810_card), GFP_KERNEL)) == NULL) {
                printk(KERN_ERR "i810_audio: out of memory\n");
                return -ENOMEM;
@@ -3125,6 +3147,11 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
        card->ac97base = pci_resource_start (pci_dev, 0);
        card->iobase = pci_resource_start (pci_dev, 1);
 
+       if (!(card->ac97base) || !(card->iobase)) {
+               card->ac97base = 0;
+               card->iobase = 0;
+       }
+
        /* if chipset could have mmio capability, check it */ 
        if (card_cap[pci_id->driver_data].flags & CAP_MMIO) {
                card->ac97base_mmio_phys = pci_resource_start (pci_dev, 2);
@@ -3139,6 +3166,11 @@ static int __devinit i810_probe(struct pci_dev *pci_dev, const struct pci_device
                }
        }
 
+       if (!(card->use_mmio) && (!(card->iobase) || !(card->ac97base))) {
+               printk(KERN_ERR "i810_audio: No I/O resources available.\n");
+               goto out_mem;
+       }
+
        card->irq = pci_dev->irq;
        card->next = devs;
        card->magic = I810_CARD_MAGIC;
index ed04f40..1beb4e9 100644 (file)
@@ -1874,8 +1874,6 @@ trident_read(struct file *file, char __user *buffer, size_t count, loff_t * ppos
        pr_debug("trident: trident_read called, count = %d\n", count);
 
        VALIDATE_STATE(state);
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
 
        if (dmabuf->mapped)
                return -ENXIO;
@@ -1992,8 +1990,6 @@ trident_write(struct file *file, const char __user *buffer, size_t count, loff_t
        pr_debug("trident: trident_write called, count = %d\n", count);
 
        VALIDATE_STATE(state);
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
 
        /*
         *      Guard against an mmap or ioctl while writing
@@ -2823,7 +2819,7 @@ trident_open(struct inode *inode, struct file *file)
        pr_debug("trident: open virtual channel %d, hard channel %d\n",
                 state->virt, dmabuf->channel->num);
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
@@ -4079,7 +4075,7 @@ trident_open_mixdev(struct inode *inode, struct file *file)
       match:
        file->private_data = card->ac97_codec[i];
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int
index 2c83d03..dc1c256 100644 (file)
@@ -10,7 +10,7 @@
  * NO WARRANTY
  *
  * For a list of known bugs (errata) and documentation,
- * see via-audio.pdf in linux/Documentation/DocBook.
+ * see via-audio.pdf in Documentation/DocBook.
  * If this documentation does not exist, run "make pdfdocs".
  */
 
@@ -1580,7 +1580,7 @@ match:
        file->private_data = card->ac97;
 
        DPRINTK ("EXIT, returning 0\n");
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int via_mixer_ioctl (struct inode *inode, struct file *file, unsigned int cmd,
@@ -2401,11 +2401,6 @@ static ssize_t via_dsp_read(struct file *file, char __user *buffer, size_t count
        card = file->private_data;
        assert (card != NULL);
 
-       if (ppos != &file->f_pos) {
-               DPRINTK ("EXIT, returning -ESPIPE\n");
-               return -ESPIPE;
-       }
-
        rc = via_syscall_down (card, nonblock);
        if (rc) goto out;
 
@@ -2589,11 +2584,6 @@ static ssize_t via_dsp_write(struct file *file, const char __user *buffer, size_
        card = file->private_data;
        assert (card != NULL);
 
-       if (ppos != &file->f_pos) {
-               DPRINTK ("EXIT, returning -ESPIPE\n");
-               return -ESPIPE;
-       }
-
        rc = via_syscall_down (card, nonblock);
        if (rc) goto out;
 
@@ -3345,7 +3335,7 @@ match:
        }
 
        DPRINTK ("EXIT, returning 0\n");
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 
index e438ba5..ce519a9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sound driver for Silicon Graphics 320 and 540 Visual Workstations'
- * onboard audio.  See notes in ../../Documentation/sound/oss/vwsnd .
+ * onboard audio.  See notes in Documentation/sound/oss/vwsnd .
  *
  * Copyright 1999 Silicon Graphics, Inc.  All rights reserved.
  *
index e793222..e0ecd44 100644 (file)
@@ -312,7 +312,7 @@ static struct {
        { 0x0E, "Bad MIDI channel number" },
        { 0x10, "Download Record Error" },
        { 0x80, "Success" },
-       { 0x0, 0x0 }
+       { 0 }
 };
 
 #define NEEDS_ACK 1
@@ -493,7 +493,7 @@ wavefront_cmd (int cmd, unsigned char *rbuf, unsigned char *wbuf)
 
        if (cmd == WFC_DOWNLOAD_MULTISAMPLE) {
                wfcmd->write_cnt = (unsigned int) rbuf;
-               rbuf = 0;
+               rbuf = NULL;
        }
 
        DPRINT (WF_DEBUG_CMD, "0x%x [%s] (%d,%d,%d)\n",
@@ -745,7 +745,7 @@ wavefront_delete_sample (int sample_num)
        wbuf[0] = sample_num & 0x7f;
        wbuf[1] = sample_num >> 7;
 
-       if ((x = wavefront_cmd (WFC_DELETE_SAMPLE, 0, wbuf)) == 0) {
+       if ((x = wavefront_cmd (WFC_DELETE_SAMPLE, NULL, wbuf)) == 0) {
                dev.sample_status[sample_num] = WF_ST_EMPTY;
        }
 
@@ -934,7 +934,7 @@ wavefront_send_patch (wavefront_patch_info *header)
        bptr = munge_int32 (header->number, buf, 2);
        munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES);
     
-       if (wavefront_cmd (WFC_DOWNLOAD_PATCH, 0, buf)) {
+       if (wavefront_cmd (WFC_DOWNLOAD_PATCH, NULL, buf)) {
                printk (KERN_ERR LOGNAME "download patch failed\n");
                return -(EIO);
        }
@@ -972,7 +972,7 @@ wavefront_send_program (wavefront_patch_info *header)
        buf[0] = header->number;
        munge_buf ((unsigned char *)&header->hdr.pr, &buf[1], WF_PROGRAM_BYTES);
     
-       if (wavefront_cmd (WFC_DOWNLOAD_PROGRAM, 0, buf)) {
+       if (wavefront_cmd (WFC_DOWNLOAD_PROGRAM, NULL, buf)) {
                printk (KERN_WARNING LOGNAME "download patch failed\n");        
                return -(EIO);
        }
@@ -986,7 +986,7 @@ wavefront_freemem (void)
 {
        char rbuf[8];
 
-       if (wavefront_cmd (WFC_REPORT_FREE_MEMORY, rbuf, 0)) {
+       if (wavefront_cmd (WFC_REPORT_FREE_MEMORY, rbuf, NULL)) {
                printk (KERN_WARNING LOGNAME "can't get memory stats.\n");
                return -1;
        } else {
@@ -1011,7 +1011,7 @@ wavefront_send_sample (wavefront_patch_info *header,
 
        UINT16 sample_short;
        UINT32 length;
-       UINT16 __user *data_end = 0;
+       UINT16 __user *data_end = NULL;
        unsigned int i;
        const int max_blksize = 4096/2;
        unsigned int written;
@@ -1188,7 +1188,7 @@ wavefront_send_sample (wavefront_patch_info *header,
 
        if (wavefront_cmd (header->size ?
                           WFC_DOWNLOAD_SAMPLE : WFC_DOWNLOAD_SAMPLE_HEADER,
-                          0, sample_hdr)) {
+                          NULL, sample_hdr)) {
                printk (KERN_WARNING LOGNAME "sample %sdownload refused.\n",
                        header->size ? "" : "header ");
                return -(EIO);
@@ -1214,7 +1214,7 @@ wavefront_send_sample (wavefront_patch_info *header,
                        blocksize = ((length-written+7)&~0x7);
                }
 
-               if (wavefront_cmd (WFC_DOWNLOAD_BLOCK, 0, 0)) {
+               if (wavefront_cmd (WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
                        printk (KERN_WARNING LOGNAME "download block "
                                "request refused.\n");
                        return -(EIO);
@@ -1321,7 +1321,7 @@ wavefront_send_alias (wavefront_patch_info *header)
        munge_int32 (header->hdr.a.FrequencyBias, &alias_hdr[20], 3);
        munge_int32 (*(&header->hdr.a.FrequencyBias+1), &alias_hdr[23], 2);
 
-       if (wavefront_cmd (WFC_DOWNLOAD_SAMPLE_ALIAS, 0, alias_hdr)) {
+       if (wavefront_cmd (WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) {
                printk (KERN_ERR LOGNAME "download alias failed.\n");
                return -(EIO);
        }
@@ -1445,7 +1445,7 @@ wavefront_send_drum (wavefront_patch_info *header)
                munge_int32 (((unsigned char *)drum)[i], &drumbuf[1+(i*2)], 2);
        }
 
-       if (wavefront_cmd (WFC_DOWNLOAD_EDRUM_PROGRAM, 0, drumbuf)) {
+       if (wavefront_cmd (WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) {
                printk (KERN_ERR LOGNAME "download drum failed.\n");
                return -(EIO);
        }
@@ -2738,7 +2738,7 @@ static int __init wavefront_do_reset (int atboot)
 
        voices[0] = 32;
 
-       if (wavefront_cmd (WFC_SET_NVOICES, 0, voices)) {
+       if (wavefront_cmd (WFC_SET_NVOICES, NULL, voices)) {
                printk (KERN_WARNING LOGNAME
                        "cannot set number of voices to 32.\n");
                goto gone_bad;
index 815de18..bf6097d 100644 (file)
@@ -146,12 +146,12 @@ struct snd_vortex {
 #endif
 
        /* Global resources */
-       char mixcapt[2];
-       char mixplayb[4];
+       s8 mixcapt[2];
+       s8 mixplayb[4];
 #ifndef CHIP_AU8820
-       char mixspdif[2];
-       char mixa3d[2];         /* mixers which collect all a3d streams. */
-       char mixxtlk[2];        /* crosstalk canceler mixer inputs. */
+       s8 mixspdif[2];
+       s8 mixa3d[2];   /* mixers which collect all a3d streams. */
+       s8 mixxtlk[2];  /* crosstalk canceler mixer inputs. */
 #endif
        u32 fixed_res[5];
 
index dd85d94..8d4919c 100644 (file)
@@ -765,7 +765,7 @@ snd_vortex_a3d_filter_info(snd_kcontrol_t *
 static int
 snd_vortex_a3d_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
 {
-       //a3dsrc_t *a = (a3dsrc_t*)(kcontrol->private_value);
+       //a3dsrc_t *a = kcontrol->private_data;
        /* No read yet. Would this be really useable/needed ? */
 
        return 0;
@@ -775,7 +775,7 @@ static int
 snd_vortex_a3d_hrtf_put(snd_kcontrol_t *
                        kcontrol, snd_ctl_elem_value_t * ucontrol)
 {
-       a3dsrc_t *a = (a3dsrc_t *) (kcontrol->private_value);
+       a3dsrc_t *a = kcontrol->private_data;
        int changed = 1, i;
        int coord[6];
        for (i = 0; i < 6; i++)
@@ -792,7 +792,7 @@ static int
 snd_vortex_a3d_itd_put(snd_kcontrol_t *
                       kcontrol, snd_ctl_elem_value_t * ucontrol)
 {
-       a3dsrc_t *a = (a3dsrc_t *) (kcontrol->private_value);
+       a3dsrc_t *a = kcontrol->private_data;
        int coord[6];
        int i, changed = 1;
        for (i = 0; i < 6; i++)
@@ -811,7 +811,7 @@ static int
 snd_vortex_a3d_ild_put(snd_kcontrol_t *
                       kcontrol, snd_ctl_elem_value_t * ucontrol)
 {
-       a3dsrc_t *a = (a3dsrc_t *) (kcontrol->private_value);
+       a3dsrc_t *a = kcontrol->private_data;
        int changed = 1;
        int l, r;
        /* There may be some scale tranlation needed here. */
@@ -828,7 +828,7 @@ static int
 snd_vortex_a3d_filter_put(snd_kcontrol_t
                          * kcontrol, snd_ctl_elem_value_t * ucontrol)
 {
-       a3dsrc_t *a = (a3dsrc_t *) (kcontrol->private_value);
+       a3dsrc_t *a = kcontrol->private_data;
        int i, changed = 1;
        int params[6];
        for (i = 0; i < 6; i++)
@@ -846,12 +846,12 @@ snd_vortex_a3d_filter_put(snd_kcontrol_t
 }
 
 static snd_kcontrol_new_t vortex_a3d_kcontrol __devinitdata = {
-       .iface = SNDRV_CTL_ELEM_IFACE_PCM,.name =
-           "Playback PCM advanced processing",.index =
-           0,.access =
-           SNDRV_CTL_ELEM_ACCESS_READWRITE,.private_value =
-           0,.info = snd_vortex_a3d_hrtf_info,.get =
-           snd_vortex_a3d_get,.put = snd_vortex_a3d_hrtf_put
+       .iface = SNDRV_CTL_ELEM_IFACE_PCM,
+       .name = "Playback PCM advanced processing",
+       .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+       .info = snd_vortex_a3d_hrtf_info,
+       .get = snd_vortex_a3d_get,
+       .put = snd_vortex_a3d_hrtf_put,
 };
 
 /* Control (un)registration. */
@@ -864,7 +864,7 @@ static int vortex_a3d_register_controls(vortex_t * vortex)
                if ((kcontrol =
                     snd_ctl_new1(&vortex_a3d_kcontrol, vortex)) == NULL)
                        return -ENOMEM;
-               kcontrol->private_value = (int)&(vortex->a3d[i]);
+               kcontrol->private_data = &vortex->a3d[i];
                kcontrol->id.numid = CTRLID_HRTF;
                kcontrol->info = snd_vortex_a3d_hrtf_info;
                kcontrol->put = snd_vortex_a3d_hrtf_put;
@@ -876,7 +876,7 @@ static int vortex_a3d_register_controls(vortex_t * vortex)
                if ((kcontrol =
                     snd_ctl_new1(&vortex_a3d_kcontrol, vortex)) == NULL)
                        return -ENOMEM;
-               kcontrol->private_value = (int)&(vortex->a3d[i]);
+               kcontrol->private_data = &vortex->a3d[i];
                kcontrol->id.numid = CTRLID_ITD;
                kcontrol->info = snd_vortex_a3d_itd_info;
                kcontrol->put = snd_vortex_a3d_itd_put;
@@ -888,7 +888,7 @@ static int vortex_a3d_register_controls(vortex_t * vortex)
                if ((kcontrol =
                     snd_ctl_new1(&vortex_a3d_kcontrol, vortex)) == NULL)
                        return -ENOMEM;
-               kcontrol->private_value = (int)&(vortex->a3d[i]);
+               kcontrol->private_data = &vortex->a3d[i];
                kcontrol->id.numid = CTRLID_GAINS;
                kcontrol->info = snd_vortex_a3d_ild_info;
                kcontrol->put = snd_vortex_a3d_ild_put;
@@ -900,7 +900,7 @@ static int vortex_a3d_register_controls(vortex_t * vortex)
                if ((kcontrol =
                     snd_ctl_new1(&vortex_a3d_kcontrol, vortex)) == NULL)
                        return -ENOMEM;
-               kcontrol->private_value = (int)&(vortex->a3d[i]);
+               kcontrol->private_data = &vortex->a3d[i];
                kcontrol->id.numid = CTRLID_FILTER;
                kcontrol->info = snd_vortex_a3d_filter_info;
                kcontrol->put = snd_vortex_a3d_filter_put;
index 9dc7de8..313411a 100644 (file)
@@ -843,7 +843,7 @@ static int snd_azf3328_playback_trigger(snd_pcm_substream_t * substream, int cmd
                snd_azf3328_setdmaa(chip, runtime->dma_addr, snd_pcm_lib_period_bytes(substream), snd_pcm_lib_buffer_bytes(substream), 0);
 
                spin_lock_irqsave(&chip->reg_lock, flags);
-#if WIN9X
+#ifdef WIN9X
                /* FIXME: enable playback/recording??? */
                status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2;
                outw(status1, chip->codec_port+IDX_IO_PLAY_FLAGS);
@@ -933,7 +933,7 @@ static int snd_azf3328_capture_trigger(snd_pcm_substream_t * substream, int cmd)
                snd_azf3328_setdmaa(chip, runtime->dma_addr, snd_pcm_lib_period_bytes(substream), snd_pcm_lib_buffer_bytes(substream), 1);
 
                spin_lock_irqsave(&chip->reg_lock, flags);
-#if WIN9X
+#ifdef WIN9X
                /* FIXME: enable playback/recording??? */
                status1 |= DMA_PLAY_SOMETHING1 | DMA_PLAY_SOMETHING2;
                outw(status1, chip->codec_port+IDX_IO_REC_FLAGS);
@@ -993,7 +993,7 @@ static snd_pcm_uframes_t snd_azf3328_playback_pointer(snd_pcm_substream_t * subs
        unsigned long flags;
 
        spin_lock_irqsave(&chip->reg_lock, flags);
-#if QUERY_HARDWARE
+#ifdef QUERY_HARDWARE
        bufptr = inl(chip->codec_port+IDX_IO_PLAY_DMA_START_1);
 #else
        bufptr = substream->runtime->dma_addr;
@@ -1016,7 +1016,7 @@ static snd_pcm_uframes_t snd_azf3328_capture_pointer(snd_pcm_substream_t * subst
        unsigned long flags;
 
        spin_lock_irqsave(&chip->reg_lock, flags);
-#if QUERY_HARDWARE
+#ifdef QUERY_HARDWARE
        bufptr = inl(chip->codec_port+IDX_IO_REC_DMA_START_1);
 #else
        bufptr = substream->runtime->dma_addr;
index 91a6041..86430a0 100644 (file)
@@ -1185,35 +1185,35 @@ static void snd_cs4281_proc_read(snd_info_entry_t *entry,
 }
 
 static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data,
-                               struct file *file, char __user *buf, long count)
+                               struct file *file, char __user *buf,
+                               unsigned long count, unsigned long pos)
 {
        long size;
        cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO);
        
        size = count;
-       if (file->f_pos + size > CS4281_BA0_SIZE)
-               size = (long)CS4281_BA0_SIZE - file->f_pos;
+       if (pos + size > CS4281_BA0_SIZE)
+               size = (long)CS4281_BA0_SIZE - pos;
        if (size > 0) {
-               if (copy_to_user_fromio(buf, chip->ba0 + file->f_pos, size))
+               if (copy_to_user_fromio(buf, chip->ba0 + pos, size))
                        return -EFAULT;
-               file->f_pos += size;
        }
        return size;
 }
 
 static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data,
-                               struct file *file, char __user *buf, long count)
+                               struct file *file, char __user *buf,
+                               unsigned long count, unsigned long pos)
 {
        long size;
        cs4281_t *chip = snd_magic_cast(cs4281_t, entry->private_data, return -ENXIO);
        
        size = count;
-       if (file->f_pos + size > CS4281_BA1_SIZE)
-               size = (long)CS4281_BA1_SIZE - file->f_pos;
+       if (pos + size > CS4281_BA1_SIZE)
+               size = (long)CS4281_BA1_SIZE - pos;
        if (size > 0) {
-               if (copy_to_user_fromio(buf, chip->ba1 + file->f_pos, size))
+               if (copy_to_user_fromio(buf, chip->ba1 + pos, size))
                        return -EFAULT;
-               file->f_pos += size;
        }
        return size;
 }
index 9a17583..e9810d2 100644 (file)
@@ -2866,18 +2866,18 @@ void __devinit snd_cs46xx_gameport(cs46xx_t *chip)
  */
 
 static long snd_cs46xx_io_read(snd_info_entry_t *entry, void *file_private_data,
-                              struct file *file, char __user *buf, long count)
+                              struct file *file, char __user *buf,
+                              unsigned long count, unsigned long pos)
 {
        long size;
        snd_cs46xx_region_t *region = (snd_cs46xx_region_t *)entry->private_data;
        
        size = count;
-       if (file->f_pos + (size_t)size > region->size)
-               size = region->size - file->f_pos;
+       if (pos + (size_t)size > region->size)
+               size = region->size - pos;
        if (size > 0) {
-               if (copy_to_user_fromio(buf, region->remap_addr + file->f_pos, size))
+               if (copy_to_user_fromio(buf, region->remap_addr + pos, size))
                        return -EFAULT;
-               file->f_pos += size;
        }
        return size;
 }
index f658de4..437d13b 100644 (file)
@@ -1990,6 +1990,8 @@ static void es1968_update_hw_volume(unsigned long private_data)
                        if ((val & 0xff00) < 0x1f00)
                                val += 0x0100;
                }
+               if (val == 0x1f1f)
+                       val |= 0x8000;
                snd_ac97_write_cache(chip->ac97, AC97_MASTER, val);
                snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
                               &chip->master_volume->id);
index 08b94db..d1f1ec2 100644 (file)
@@ -2295,7 +2295,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
        snd_ice1712_hoontech_cards,
        snd_ice1712_delta_cards,
        snd_ice1712_ews_cards,
-       0,
+       NULL,
 };
 
 static unsigned char __devinit snd_ice1712_read_i2c(ice1712_t *ice,
index a7a55a9..60fb189 100644 (file)
@@ -1071,7 +1071,7 @@ static int snd_vt1724_playback_indep_open(snd_pcm_substream_t *substream)
                return -EBUSY; /* FIXME: should handle blocking mode properly */
        }
        up(&ice->open_mutex);
-       runtime->private_data = (void*)(1 << (substream->number + 4));
+       runtime->private_data = (void*)(1UL << (substream->number + 4));
        ice->playback_con_substream_ds[substream->number] = substream;
        runtime->hw = snd_vt1724_2ch_stereo;
        snd_pcm_set_sync(substream);
@@ -1815,7 +1815,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
        snd_vt1724_revo_cards,
        snd_vt1724_amp_cards, 
        snd_vt1724_aureon_cards,
-       0,
+       NULL,
 };
 
 
index 6046ac1..b09b6f7 100644 (file)
@@ -1328,7 +1328,7 @@ static struct shortname_table {
        { 0x5455, "ALi M5455" },
        { 0x746d, "AMD AMD8111" },
 #endif
-       { 0, 0 },
+       { 0 },
 };
 
 static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
index 8c0bc76..eabfcd3 100644 (file)
@@ -968,7 +968,7 @@ static struct m3_quirk m3_quirk_list[] = {
                .amp_gpio = 0x03,
        },
        /* END */
-       { 0 }
+       { NULL }
 };
 
 
index 2b918cc..7e312df 100644 (file)
@@ -1154,18 +1154,18 @@ static long long snd_mixart_BA1_llseek(snd_info_entry_t *entry,
   mixart_BA0 proc interface for BAR 0 - read callback
  */
 static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data,
-                               struct file *file, char __user *buf, long count)
+                               struct file *file, char __user *buf,
+                               unsigned long count, unsigned long pos)
 {
        mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO);
 
        count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
        if(count <= 0)
                return 0;
-       if(file->f_pos + count > MIXART_BA0_SIZE)
-               count = (long)(MIXART_BA0_SIZE - file->f_pos);
-       if(copy_to_user_fromio(buf, MIXART_MEM( mgr, file->f_pos ), count))
+       if(pos + count > MIXART_BA0_SIZE)
+               count = (long)(MIXART_BA0_SIZE - pos);
+       if(copy_to_user_fromio(buf, MIXART_MEM( mgr, pos ), count))
                return -EFAULT;
-       file->f_pos += count;
        return count;
 }
 
@@ -1173,18 +1173,18 @@ static long snd_mixart_BA0_read(snd_info_entry_t *entry, void *file_private_data
   mixart_BA1 proc interface for BAR 1 - read callback
  */
 static long snd_mixart_BA1_read(snd_info_entry_t *entry, void *file_private_data,
-                               struct file *file, char __user *buf, long count)
+                               struct file *file, char __user *buf,
+                               unsigned long count, unsigned long pos)
 {
        mixart_mgr_t *mgr = snd_magic_cast(mixart_mgr_t, entry->private_data, return -ENXIO);
 
        count = count & ~3; /* make sure the read size is a multiple of 4 bytes */
        if(count <= 0)
                return 0;
-       if(file->f_pos + count > MIXART_BA1_SIZE)
-               count = (long)(MIXART_BA1_SIZE - file->f_pos);
-       if(copy_to_user_fromio(buf, MIXART_REG( mgr, file->f_pos ), count))
+       if(pos + count > MIXART_BA1_SIZE)
+               count = (long)(MIXART_BA1_SIZE - pos);
+       if(copy_to_user_fromio(buf, MIXART_REG( mgr, pos ), count))
                return -EFAULT;
-       file->f_pos += count;
        return count;
 }
 
index c8c7f29..0e42f2f 100644 (file)
@@ -703,7 +703,7 @@ static int
 snd_nm256_capture_copy(snd_pcm_substream_t *substream,
                       int channel, /* not used (interleaved data) */
                       snd_pcm_uframes_t pos,
-                      void *dst,
+                      void __user *dst,
                       snd_pcm_uframes_t count)
 {
        snd_pcm_runtime_t *runtime = substream->runtime;
index c91602c..628516c 100644 (file)
@@ -4971,16 +4971,16 @@ static int __devinit snd_hdsp_create(snd_card_t *card,
 
        hdsp->irq = -1;
        hdsp->state = 0;
-       hdsp->midi[0].rmidi = 0;
-       hdsp->midi[1].rmidi = 0;
-       hdsp->midi[0].input = 0;
-       hdsp->midi[1].input = 0;
-       hdsp->midi[0].output = 0;
-       hdsp->midi[1].output = 0;
+       hdsp->midi[0].rmidi = NULL;
+       hdsp->midi[1].rmidi = NULL;
+       hdsp->midi[0].input = NULL;
+       hdsp->midi[1].input = NULL;
+       hdsp->midi[0].output = NULL;
+       hdsp->midi[1].output = NULL;
        spin_lock_init(&hdsp->midi[0].lock);
        spin_lock_init(&hdsp->midi[1].lock);
        hdsp->iobase = 0;
-       hdsp->res_port = 0;
+       hdsp->res_port = NULL;
        hdsp->control_register = 0;
        hdsp->control2_register = 0;
        hdsp->io_type = Undefined;
index 5f9475d..af77bd8 100644 (file)
@@ -805,7 +805,7 @@ static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream)
        sonic->mode |= SV_MODE_PLAY;
        sonic->playback_substream = substream;
        runtime->hw = snd_sonicvibes_playback;
-       snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_sonicvibes_hw_constraint_dac_rate, 0, SNDRV_PCM_HW_PARAM_RATE, -1);
+       snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, snd_sonicvibes_hw_constraint_dac_rate, NULL, SNDRV_PCM_HW_PARAM_RATE, -1);
        return 0;
 }
 
index 4f80fec..6b307b0 100644 (file)
@@ -896,7 +896,7 @@ static int __init snd_pmac_detect(pmac_t *chip)
                sound = sound->next;
        if (! sound)
                return -ENODEV;
-       prop = (unsigned int *) get_property(sound, "sub-frame", 0);
+       prop = (unsigned int *) get_property(sound, "sub-frame", NULL);
        if (prop && *prop < 16)
                chip->subframe = *prop;
        /* This should be verified on older screamers */
@@ -938,7 +938,7 @@ static int __init snd_pmac_detect(pmac_t *chip)
                // chip->can_byte_swap = 0; /* FIXME: check this */
                chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
        }
-       prop = (unsigned int *)get_property(sound, "device-id", 0);
+       prop = (unsigned int *)get_property(sound, "device-id", NULL);
        if (prop)
                chip->device_id = *prop;
        chip->has_iic = (find_devices("perch") != NULL);
index 38f415e..6d5197c 100644 (file)
@@ -898,11 +898,11 @@ static void release_urb_ctx(snd_urb_ctx_t *u)
 {
        if (u->urb) {
                usb_free_urb(u->urb);
-               u->urb = 0;
+               u->urb = NULL;
        }
        if (u->buf) {
                kfree(u->buf);
-               u->buf = 0;
+               u->buf = NULL;
        }
 }
 
@@ -923,7 +923,7 @@ static void release_substream_urbs(snd_usb_substream_t *subs, int force)
                release_urb_ctx(&subs->syncurb[i]);
        if (subs->tmpbuf) {
                kfree(subs->tmpbuf);
-               subs->tmpbuf = 0;
+               subs->tmpbuf = NULL;
        }
        subs->nurbs = 0;
 }
index a17d3f8..13921f1 100644 (file)
@@ -574,7 +574,7 @@ static void usb_mixer_elem_free(snd_kcontrol_t *kctl)
 {
        if (kctl->private_data) {
                snd_magic_kfree((void *)kctl->private_data);
-               kctl->private_data = 0;
+               kctl->private_data = NULL;
        }
 }
 
@@ -1318,7 +1318,7 @@ static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl)
                usb_mixer_elem_info_t *cval = snd_magic_cast(usb_mixer_elem_info_t, kctl->private_data,);
                num_ins = cval->max;
                snd_magic_kfree(cval);
-               kctl->private_data = 0;
+               kctl->private_data = NULL;
        }
        if (kctl->private_value) {
                char **itemlist = (char **)kctl->private_value;